|
GALib-Parallel
Header-only C++ library for parallel evolutionary algorithms
|
Abstract base class for objective functions to be minimized. More...
#include <FitnessFunction.h>
Public Member Functions | |
| virtual | ~FitnessFunction ()=default |
| virtual double | evaluate (const std::vector< GeneType > &phenotype) const =0 |
| Evaluates the fitness of a candidate solution. | |
| virtual std::size_t | size () const =0 |
| Returns the dimensionality of the optimization problem. | |
| virtual std::string | name () const |
| Short identifier used to select a GPU evaluation kernel. | |
| virtual GeneType | getLowerBound (std::size_t dimension) const =0 |
| Gets the lower bound for a specific dimension. | |
| GeneType | getLowerBound () const |
| Convenience method to get the lower bound of the first dimension. | |
| virtual GeneType | getUpperBound (std::size_t dimension) const =0 |
| Gets the upper bound for a specific dimension. | |
| GeneType | getUpperBound () const |
| Convenience method to get the upper bound of the first dimension. | |
Abstract base class for objective functions to be minimized.
Users should inherit from this class to define their own optimization problems, or use FunctionalFitness to wrap a lambda.
| GeneType | The numeric type of the genes (default: double). |
Definition at line 21 of file FitnessFunction.h.
|
virtualdefault |
|
pure virtual |
Evaluates the fitness of a candidate solution.
Lower return values indicate better fitness (minimization convention).
| phenotype | Gene values of the individual to evaluate. |
Implemented in galib::benchmark::RastriginFunction< GeneType >, galib::benchmark::DeJongF5Function< GeneType >, galib::benchmark::HeavyTrigFunction< GeneType >, galib::benchmark::HimmelblauFitness< GeneType >, galib::benchmark::SphereFunction< GeneType >, and galib::FunctionalFitness< GeneType >.
Referenced by galib::DifferentialEvolutionGA< GeneType >::run().
|
inline |
Convenience method to get the lower bound of the first dimension.
Definition at line 63 of file FitnessFunction.h.
References galib::FitnessFunction< GeneType >::getLowerBound().
Referenced by galib::FitnessFunction< GeneType >::getLowerBound().
|
pure virtual |
Gets the lower bound for a specific dimension.
| dimension | Index of the dimension. |
Implemented in galib::benchmark::HimmelblauFitness< GeneType >, galib::benchmark::DeJongF5Function< GeneType >, galib::FunctionalFitness< GeneType >, galib::benchmark::HeavyTrigFunction< GeneType >, galib::benchmark::RastriginFunction< GeneType >, and galib::benchmark::SphereFunction< GeneType >.
Referenced by galib::utils::AlgorithmBuilder< GeneType >::buildCellularGA(), galib::utils::AlgorithmBuilder< GeneType >::buildIslandGA(), galib::utils::AlgorithmBuilder< GeneType >::buildStandardGA(), and galib::DifferentialEvolutionGA< GeneType >::run().
|
inline |
Convenience method to get the upper bound of the first dimension.
Definition at line 78 of file FitnessFunction.h.
References galib::FitnessFunction< GeneType >::getUpperBound().
Referenced by galib::FitnessFunction< GeneType >::getUpperBound().
|
pure virtual |
Gets the upper bound for a specific dimension.
| dimension | Index of the dimension. |
Implemented in galib::benchmark::HimmelblauFitness< GeneType >, galib::benchmark::DeJongF5Function< GeneType >, galib::FunctionalFitness< GeneType >, galib::benchmark::HeavyTrigFunction< GeneType >, galib::benchmark::RastriginFunction< GeneType >, and galib::benchmark::SphereFunction< GeneType >.
Referenced by galib::utils::AlgorithmBuilder< GeneType >::buildCellularGA(), galib::utils::AlgorithmBuilder< GeneType >::buildIslandGA(), galib::utils::AlgorithmBuilder< GeneType >::buildStandardGA(), and galib::DifferentialEvolutionGA< GeneType >::run().
|
inlinevirtual |
Short identifier used to select a GPU evaluation kernel.
Override in benchmark subclasses to enable GPU-side evaluation ("Sphere", "Rastrigin", "HeavyTrig"). Return empty string (default) to use the CPU callback path.
Reimplemented in galib::benchmark::HeavyTrigFunction< GeneType >, galib::benchmark::RastriginFunction< GeneType >, and galib::benchmark::SphereFunction< GeneType >.
Definition at line 50 of file FitnessFunction.h.
|
pure virtual |
Returns the dimensionality of the optimization problem.
Implemented in galib::benchmark::HimmelblauFitness< GeneType >, galib::benchmark::DeJongF5Function< GeneType >, galib::benchmark::HeavyTrigFunction< GeneType >, galib::benchmark::RastriginFunction< GeneType >, galib::benchmark::SphereFunction< GeneType >, and galib::FunctionalFitness< GeneType >.
Referenced by galib::utils::AlgorithmBuilder< GeneType >::buildIslandGA().