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

Implementation of the Sphere function. More...

#include <SphereFunction.h>

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

Public Member Functions

 SphereFunction (const std::size_t dim, GeneType lb, GeneType ub)
 Constructs the Sphere function with given dimensions and bounds.
 
double evaluate (const std::vector< GeneType > &phenotype) const override
 Evaluates the N-dimensional Sphere function.
 
std::size_t size () const override
 Returns the dimensionality of the optimization problem.
 
std::string name () const override
 Short identifier used to select a GPU evaluation kernel.
 
GeneType getLowerBound (std::size_t) const override
 Gets the lower bound for a specific dimension.
 
GeneType getUpperBound (std::size_t) const override
 Gets the upper bound for a specific dimension.
 
- Public Member Functions inherited from galib::FitnessFunction< GeneType >
virtual ~FitnessFunction ()=default
 
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::SphereFunction< GeneType >

Implementation of the Sphere function.

A simple unimodal function representing an n-dimensional paraboloid. Global minimum: f(0, ..., 0) = 0.

Template Parameters
GeneTypeThe numeric type of the genes.

Definition at line 28 of file SphereFunction.h.

Constructor & Destructor Documentation

◆ SphereFunction()

template<typename GeneType = double>
galib::benchmark::SphereFunction< GeneType >::SphereFunction ( const std::size_t  dim,
GeneType  lb,
GeneType  ub 
)
inlineexplicit

Constructs the Sphere function with given dimensions and bounds.

Parameters
dimProblem dimensionality.
lbUniform lower bound.
ubUniform upper bound.

Definition at line 40 of file SphereFunction.h.

Member Function Documentation

◆ evaluate()

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

Evaluates the N-dimensional Sphere function.

Parameters
phenotypeInput vector.
Returns
Fitness value.

Implements galib::FitnessFunction< GeneType >.

Definition at line 48 of file SphereFunction.h.

◆ getLowerBound()

template<typename GeneType = double>
GeneType galib::benchmark::SphereFunction< GeneType >::getLowerBound ( 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 SphereFunction.h.

◆ getUpperBound()

template<typename GeneType = double>
GeneType galib::benchmark::SphereFunction< GeneType >::getUpperBound ( 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 60 of file SphereFunction.h.

◆ name()

template<typename GeneType = double>
std::string galib::benchmark::SphereFunction< GeneType >::name ( ) const
inlineoverridevirtual

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.

Returns
Problem name string, or "" for custom functions.

Reimplemented from galib::FitnessFunction< GeneType >.

Definition at line 57 of file SphereFunction.h.

◆ size()

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

Returns the dimensionality of the optimization problem.

Returns
Number of dimensions.

Implements galib::FitnessFunction< GeneType >.

Definition at line 56 of file SphereFunction.h.


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