Solving N-Queens with Order-One Crossover

To solve N-queens, you need to implement a crossover strategy that preserves the integrity of your permutation. While there are numerous approaches to doing this, one common strategy is known as order-one crossover.

Before you start, create a new file crossover.ex within the toolbox folder. Next, create a new module that looks like this:

 defmodule​ Toolbox.Crossover ​do
  alias Types.Chromosome
 # ...
 end

Just like selection.ex in toolbox contains useful selection strategies, you’ll implement useful crossover strategies in Toolbox.Crossover.

Implementing Order-One Crossover

Order-one crossover, sometimes called “Davis order” crossover, is a crossover strategy on ordered lists or permutations. ...

Get Genetic Algorithms in Elixir now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.