Permutation encoded crossovers#

namespace perm#

Predefined crossover operators for the permutation encoded GA.

class Order1#

#include <crossover/permutation.hpp>
class Order1 : public gapp::crossover::Crossover<PermutationGene>#

Order (OX1) crossover operator for the permutation encoded GA.

In order to create a child, a range of genes is randomly selected from parent1 and copied directly to the child into the same position, while the remaining genes are filled in from parent2 in the order they appear in, starting at the end of the randomly selected range.

The second child is created by repeating this process with the roles of the two parents swapped. The same range of genes is used for the directly copied genes.

Public Functions

inline explicit constexpr Crossover() noexcept#

Create a crossover operator using the default crossover probability.

inline explicit constexpr Crossover(Probability pc) noexcept#

Create a crossover operator.

Parameters:

pc – The crossover probability. Must be in the closed interval [0.0, 1.0].

class Order2#

#include <crossover/permutation.hpp>
class Order2 : public gapp::crossover::Crossover<PermutationGene>#

Order based (OX2) crossover operator for the permutation encoded GA. This crossover operator is a slightly modified version of the Order1 operator.

In order to create a child, a range of genes is randomly selected from parent1 and copied directly to the child into the same position, while the remaining genes are filled in from parent 2 in the order they appear in, starting at the beginning of the chromosome.

The second child is created by repeating this process with the roles of the two parents swapped. The same range of genes is used for the directly copied genes.

Public Functions

inline explicit constexpr Crossover() noexcept#

Create a crossover operator using the default crossover probability.

inline explicit constexpr Crossover(Probability pc) noexcept#

Create a crossover operator.

Parameters:

pc – The crossover probability. Must be in the closed interval [0.0, 1.0].

class Position#

#include <crossover/permutation.hpp>
class Position : public gapp::crossover::Crossover<PermutationGene>#

Position/position-based (POS) crossover operator for the permutation encoded GA. This crossover operator is a modification of the Order1 operator.

In order to create a child, a random number of positions are selected randomly from parent1 (instead of the continuous range selected in the Order1 crossover operator), then these genes are copied directly from parent1 to the child into the same positons. The remaining genes which are still missing from the child are copied from parent2 in the order they appear in, starting at the beginning of the chromosome.

The second child is created by repeating this process with the roles of the two parents swapped, but using the same positions for direct copying that were used to create the first child.

Public Functions

inline explicit constexpr Crossover() noexcept#

Create a crossover operator using the default crossover probability.

inline explicit constexpr Crossover(Probability pc) noexcept#

Create a crossover operator.

Parameters:

pc – The crossover probability. Must be in the closed interval [0.0, 1.0].

class Cycle#

#include <crossover/permutation.hpp>
class Cycle : public gapp::crossover::Crossover<PermutationGene>#

Cycle (CX) crossover operator for the permutation encoded GA.

This operator works by identifying cycles of genes between the parent chromosomes, and building the 2 child solutions from these cycles. Each of the genes in the children appears in the same position in one of the parents.

Public Functions

inline explicit constexpr Crossover() noexcept#

Create a crossover operator using the default crossover probability.

inline explicit constexpr Crossover(Probability pc) noexcept#

Create a crossover operator.

Parameters:

pc – The crossover probability. Must be in the closed interval [0.0, 1.0].

class Edge#

#include <crossover/permutation.hpp>
class Edge : public gapp::crossover::Crossover<PermutationGene>#

Edge assembly/recombination (EAX) crossover operator for the permutation encoded GA.

The children are created from the parents by trying to keep as many edges present in the parents as possible, and not introducing new edges into the children. This crossover operator is significantly slower than the other implemented operators, but produces good results.

Public Functions

inline explicit constexpr Crossover() noexcept#

Create a crossover operator using the default crossover probability.

inline explicit constexpr Crossover(Probability pc) noexcept#

Create a crossover operator.

Parameters:

pc – The crossover probability. Must be in the closed interval [0.0, 1.0].

class PMX#

#include <crossover/permutation.hpp>
class PMX : public gapp::crossover::Crossover<PermutationGene>#

Partially mapped (PMX) crossover operator for the permutation encoded GA.

Similar to the Order1 crossover, a random range of genes is selected from parent1 and copied directly intto the same positions of the child chromosome, and the remaining genes not yet in the child are filled in from parent2 using a different method from the one used in the Order1 crossover.

The second child is created by performing the same process with the roles of the 2 parents swapped.

Public Functions

inline explicit constexpr Crossover() noexcept#

Create a crossover operator using the default crossover probability.

inline explicit constexpr Crossover(Probability pc) noexcept#

Create a crossover operator.

Parameters:

pc – The crossover probability. Must be in the closed interval [0.0, 1.0].