highprecisionpso::TwoCupsFunction Class Reference

This class represents a test function with 2D many optimal positions. More...

#include <two_cups_function.h>

Inheritance diagram for highprecisionpso::TwoCupsFunction:

Public Member Functions

mpf_t * DistanceTo1DLocalOptimum (const std::vector< mpf_t * > &pos, int d)
 Calculates for a position and a dimension the next local optimum if only the value of the position in the specified dimension is varied and returns the distance to it. More...
 
mpf_t * Eval (const std::vector< mpf_t * > &pos)
 Calculates the sum over a single dimensional function evaluated on each position entry. More...
 
std::string GetName ()
 Returns a string representation of this object. More...
 
- Public Member Functions inherited from highprecisionpso::Function
 Function ()
 A constructor. More...
 
 Function (double search_space_lower_bound, double search_space_upper_bound)
 A constructor, specifying the lower and upper search space bounds. More...
 
 Function (std::vector< double > search_space_lower_bound, std::vector< double > search_space_upper_bound)
 A constructor specifying the lower and upper search space bounds. More...
 
virtual ~Function ()
 The destructor. More...
 
virtual mpf_t * DistanceTo1DLocalOptimumTernarySearch (const std::vector< mpf_t * > &pos, int d, mpf_t *start_distance)
 Calculates for a position and a dimension the next local optimum if only the value of the position in the specified dimension is varied and returns the distance to it. More...
 
mpf_t * Evaluate (const std::vector< mpf_t * > &pos)
 This is the initial function for evaluation of a position. More...
 
virtual std::vector< mpf_t * > GetLowerSearchSpaceBound ()
 Returns the lower search space bound of the search space for this objective function. More...
 
virtual std::vector< mpf_t * > GetUpperSearchSpaceBound ()
 Returns the upper search space bound of the search space for this objective function. More...
 
void InitSearchSpaceBounds ()
 Initializes the search space bounds. More...
 
void SetFunctionBound (SearchSpaceBound *search_space_bound)
 Updates the bound of the search space according to the given data. More...
 

Detailed Description

This class represents a test function with 2D many optimal positions.

Member Function Documentation

mpf_t* highprecisionpso::TwoCupsFunction::DistanceTo1DLocalOptimum ( const std::vector< mpf_t * > &  pos,
int  d 
)
virtual

Calculates for a position and a dimension the next local optimum if only the value of the position in the specified dimension is varied and returns the distance to it.

Parameters
posThe position.
dThe index of the observed dimension.
Returns
min( abs( pos[d]-1 ), abs( pos[d]+1 ) ).

Reimplemented from highprecisionpso::Function.

mpf_t* highprecisionpso::TwoCupsFunction::Eval ( const std::vector< mpf_t * > &  pos)
virtual

Calculates the sum over a single dimensional function evaluated on each position entry.

The single dimensional function performs in two different ways. If the position entry is not positive then the distance to -1 is calculated and the square of this distance is returned. If the position entry is positive then the distance to 1 is calculated and the fourth power of this distance is returned.

Parameters
posThe position.
Returns
d=0..D-1tc( pos[d] ), where tc( x )= ( x + 1 )2 if x is not positive and tc( x )= ( x -1 )4 if x is positive.

Implements highprecisionpso::Function.

std::string highprecisionpso::TwoCupsFunction::GetName ( )
virtual

Returns a string representation of this object.

Returns
The name of the object.

Implements highprecisionpso::Function.


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