Integer-encoded genetic algorithm#
-
namespace gapp
class IntegerGene#
#include <encoding/integer.hpp>
class GaTraits<IntegerGene>#
#include <encoding/integer.hpp>
class IntegerGA#
#include <encoding/integer.hpp>
-
class IntegerGA : public gapp::GA<IntegerGene>#
Integer-encoded genetic algorithm class. This is the main solver that should be used for binary-encoded objective functions.
Similar to the binary-encoded GA, but the values of a genes can be any integer in a closed interval, not just 0 or 1. The particular interval is specified by the gene bounds.
See also
Public Functions
-
GA(Positive<size_t> population_size = DEFAULT_POPSIZE)#
Create a genetic algorithm using the default genetic operators.
The algorithm used will be deduced from the number of objectives of the fitness function (single- or multi-objective), along with the mutation probability used, which will be deduced from the chromosome length.
- Parameters:
population_size – The number of candidates in the population. Must be at least 1.
- GA( )#
Create a genetic algorithm using the default genetic operators. The mutation probability used will be deduced from the chromosome length.
- Parameters:
population_size – The number of candidates in the population. Must be at least 1.
algorithm – The algorithm to use. The default algorithm will be used if it’s a nullptr.
- GA(
- Positive<size_t> population_size,
- std::unique_ptr<crossover::Crossover<T>> crossover,
- std::unique_ptr<mutation::Mutation<T>> mutation,
- std::unique_ptr<stopping::StopCondition> stop_condition = std::make_unique<stopping::NoEarlyStop>(),
Create a genetic algorithm using the specified operators. The algorithm used will be deduced from the number of objectives of the fitness function (single- or multi-objective).
- Parameters:
population_size – The number of candidates in the population. Must be at least 1.
crossover – The crossover operator to use. Can’t be a nullptr.
mutation – The mutation operator to use. Can’t be a nullptr.
stop_condition – The early-stop condition to use. No early-stopping will be used if it’s a nullptr.
- GA(
- Positive<size_t> population_size,
- std::unique_ptr<algorithm::Algorithm> algorithm,
- std::unique_ptr<crossover::Crossover<T>> crossover,
- std::unique_ptr<mutation::Mutation<T>> mutation,
- std::unique_ptr<stopping::StopCondition> stop_condition = std::make_unique<stopping::NoEarlyStop>(),
Create a genetic algorithm using the specified algorithm and operators.
- Parameters:
population_size – The number of candidates in the population. Must be at least 1.
algorithm – The algorithm to use. The default algorithm will be used if it’s a nullptr.
crossover – The crossover operator to use. Can’t be a nullptr.
mutation – The mutation operator to use. Can’t be a nullptr.
stop_condition – The early-stop condition to use. No early-stopping will be used if it’s a nullptr.
-
template<typename AlgorithmType>
GA( - Positive<size_t> population_size,
- AlgorithmType algorithm,
Create a genetic algorithm using the default genetic operators. The mutation probability will be deduced from the chromosome length.
- Parameters:
population_size – The number of candidates in the population. Must be at least 1.
algorithm – The algorithm to use.
-
template<typename CrossoverType, typename MutationType, typename StoppingType = stopping::NoEarlyStop>
GA( - Positive<size_t> population_size,
- CrossoverType crossover,
- MutationType mutation,
- StoppingType stop_condition = {},
Create a genetic algorithm using the specified operators. The algorithm used will be deduced from the number of objectives of the fitness function (single- or multi-objective).
- Parameters:
population_size – The number of candidates in the population. Must be at least 1.
crossover – The crossover operator to use.
mutation – The mutation operator to use.
stop_condition – The early-stop condition to use.
-
template<typename AlgorithmType, typename CrossoverType, typename MutationType, typename StoppingType = stopping::NoEarlyStop>
GA( - Positive<size_t> population_size,
- AlgorithmType algorithm,
- CrossoverType crossover,
- MutationType mutation,
- StoppingType stop_condition = {},
Create a genetic algorithm using the specified algorithm and operators.
- Parameters:
population_size – The number of candidates in the population. Must be at least 1.
algorithm – The algorithm to use.
crossover – The crossover operator to use.
mutation – The mutation operator to use.
stop_condition – The early-stop condition to use.
-
GA(Positive<size_t> population_size = DEFAULT_POPSIZE)#