GALib-Parallel
Header-only C++ library for parallel evolutionary algorithms
Loading...
Searching...
No Matches
Public Member Functions | List of all members
galib::benchmark::HimmelblauFitness< GeneType > Class Template Reference

Implementation of Himmelblau's function. More...

#include <HimmelblauFunction.h>

Inheritance diagram for galib::benchmark::HimmelblauFitness< GeneType >:
[legend]

Public Member Functions

 HimmelblauFitness ()=default
 
double evaluate (const std::vector< GeneType > &phenotype) const override
 Evaluates the 2D Himmelblau function.
 
std::size_t size () const
 Returns the dimensionality of the optimization problem.
 
GeneType getLowerBound (const std::size_t dimension) const override
 Gets the lower bound for a specific dimension.
 
GeneType getUpperBound (const std::size_t dimension) const override
 Gets the upper bound for a specific dimension.
 
- Public Member Functions inherited from galib::FitnessFunction< GeneType >
virtual ~FitnessFunction ()=default
 
virtual std::string name () const
 Short identifier used to select a GPU evaluation kernel.
 
GeneType getLowerBound () const
 Convenience method to get the lower bound of the first dimension.
 
GeneType getUpperBound () const
 Convenience method to get the upper bound of the first dimension.
 

Detailed Description

template<typename GeneType = double>
class galib::benchmark::HimmelblauFitness< GeneType >

Implementation of Himmelblau's function.

A multi-modal 2D function with 4 identical local minima. Global minima: f(3.0, 2.0) = 0, f(-2.805, 3.131) = 0, f(-3.779, -3.283) = 0, f(3.584, -1.848) = 0.

Template Parameters
GeneTypeThe numeric type of the genes.

Definition at line 23 of file HimmelblauFunction.h.

Constructor & Destructor Documentation

◆ HimmelblauFitness()

template<typename GeneType = double>
galib::benchmark::HimmelblauFitness< GeneType >::HimmelblauFitness ( )
default

Member Function Documentation

◆ evaluate()

template<typename GeneType = double>
double galib::benchmark::HimmelblauFitness< GeneType >::evaluate ( const std::vector< GeneType > &  phenotype) const
inlineoverridevirtual

Evaluates the 2D Himmelblau function.

Parameters
phenotypeMust have exactly 2 elements.
Returns
Fitness value.
Exceptions
std::invalid_argumentif phenotype size != 2.

Implements galib::FitnessFunction< GeneType >.

Definition at line 38 of file HimmelblauFunction.h.

◆ getLowerBound()

template<typename GeneType = double>
GeneType galib::benchmark::HimmelblauFitness< GeneType >::getLowerBound ( const std::size_t  dimension) const
inlineoverridevirtual

Gets the lower bound for a specific dimension.

Parameters
dimensionIndex of the dimension.
Returns
Lower bound value.

Implements galib::FitnessFunction< GeneType >.

Definition at line 59 of file HimmelblauFunction.h.

◆ getUpperBound()

template<typename GeneType = double>
GeneType galib::benchmark::HimmelblauFitness< GeneType >::getUpperBound ( const std::size_t  dimension) const
inlineoverridevirtual

Gets the upper bound for a specific dimension.

Parameters
dimensionIndex of the dimension.
Returns
Upper bound value.

Implements galib::FitnessFunction< GeneType >.

Definition at line 63 of file HimmelblauFunction.h.

◆ size()

template<typename GeneType = double>
std::size_t galib::benchmark::HimmelblauFitness< GeneType >::size ( ) const
inlinevirtual

Returns the dimensionality of the optimization problem.

Returns
Number of dimensions.

Implements galib::FitnessFunction< GeneType >.

Definition at line 55 of file HimmelblauFunction.h.


The documentation for this class was generated from the following file: