Problems#

namespace problems#

Implementations of some benchmark functions that can be used to test the genetic algorithms. There are some benchmark problems implemented for every encoding type, and the real-encoded problems can also be used for the binary-encoded GAs.

All of the problems are implemented for maximization.

class BenchmarkFunctionTraits#

#include <problems/benchmark_function.hpp>
template<typename T>
class BenchmarkFunctionTraits#

Base class that contains the properties of a benchmark function.

Subclassed by gapp::problems::BenchmarkFunction< BinaryGene >, gapp::problems::BenchmarkFunction< IntegerGene >, gapp::problems::BenchmarkFunction< PermutationGene >, gapp::problems::BenchmarkFunction< T >

Public Functions

inline const std::string &name() const noexcept#
Returns:

The name of the benchmark function.

inline size_t num_objectives() const noexcept#
Returns:

The number of objectives.

inline const BoundsVector<T> &bounds() const noexcept#
Returns:

The lower and upper bounds of each variable of the benchmark function.

inline const FitnessVector &optimal_value() const noexcept#
Returns:

The optimal value of the benchmark function.

inline const Chromosome<T> &optimum() const noexcept#
Returns:

The maximum of the benchmark function.

inline const FitnessVector &ideal_point() const noexcept#
Returns:

The ideal point of the pareto front. Same as the optimal value for single objective benchmarks.

inline const FitnessVector &nadir_point() const noexcept#
Returns:

The nadir point of the pareto front. Same as the optimal value for single objective benchmarks.

virtual ~BenchmarkFunctionTraits() = default#

Destructor.

class BenchmarkFunction#

#include <problems/benchmark_function.hpp>
template<typename T>
class BenchmarkFunction : public gapp::FitnessFunctionBase<T>, public gapp::problems::BenchmarkFunctionTraits<T>#

Base class used for all of the benchmark functions. Includes some additional properties for each benchmark in addition to what is in a fitness function (eg. known optimum, optimal values).

Public Functions

inline size_t num_vars() const noexcept#
Returns:

The number of variables of the benchmark function.

template<>
class BenchmarkFunction<RealGene> : public gapp::FitnessFunctionBase<RealGene>, public gapp::FitnessFunctionBase<BinaryGene>, public gapp::problems::BenchmarkFunctionTraits<RealGene>#

Specialization of the benchmark function for the real encoded problems. These are also usable as binary benchmark functions, not just real encoded ones.

Subclassed by gapp::problems::Ackley, gapp::problems::DTLZ1, gapp::problems::DTLZ2, gapp::problems::DTLZ3, gapp::problems::DTLZ4, gapp::problems::DTLZ5, gapp::problems::DTLZ6, gapp::problems::DTLZ7, gapp::problems::Griewank, gapp::problems::Kursawe, gapp::problems::Levy, gapp::problems::Rastrigin, gapp::problems::Rosenbrock, gapp::problems::Schwefel, gapp::problems::Sphere, gapp::problems::ZDT1, gapp::problems::ZDT2, gapp::problems::ZDT3, gapp::problems::ZDT4, gapp::problems::ZDT6

Public Functions

inline size_t num_vars() const noexcept#
Returns:

The number of variables of the benchmark function.

Private Functions

virtual FitnessVector invoke(
const Chromosome<RealGene> &chrom,
) const override = 0#

The implementation of the fitness function. Should be thread-safe.

inline virtual FitnessVector invoke(
const Chromosome<BinaryGene> &chrom,
) const final#

The implementation of the fitness function. Should be thread-safe.