Binary encoded mutations#

namespace binary#

Predefined mutation operators for the binary encoded genetic algorithm.

class Flip#

#include <mutation/binary.hpp>
class Flip : public gapp::mutation::Mutation<BinaryGene>#

Standard flip mutation for the binary encoded genetic algorithm. Each gene of the chromosome is flipped (either from 0 to 1, or from 1 to 0) with the specified mutation probability.

Public Functions

inline virtual constexpr bool allow_variable_chrom_length(
) const noexcept override#

This method specifies whether the mutation operator supports variable chromosome lengths or not. If variable chromosome lengths are supported, the Candidates passed to the mutation operator are allowed to have chromosome lengths that are different from the chromosome length specified for the GA that the operator is used in.

This method will return false by default. If a particular mutation method allows variable chromosome lengths, it should override this method to return true.

Returns:

True if the mutation operator support variable chromosome lengths.

inline explicit constexpr Mutation(Probability pm) noexcept#

Create a mutation operator.

Parameters:

pm – The mutation probability. Must be in the closed interval [0.0, 1.0].