highprecisionpso::Function Class Referenceabstract

This class is an abstract class. It supplies the interface for objective functions. More...

#include <function.h>

Inheritance diagram for highprecisionpso::Function:

Public Member Functions

 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 * 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...
 
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...
 
virtual mpf_t * Eval (const std::vector< mpf_t * > &pos)=0
 Returns the evaluation of the current function at the given position. 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::string GetName ()=0
 Returns a string representation of this object. 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 is an abstract class. It supplies the interface for objective functions.

Constructor & Destructor Documentation

virtual highprecisionpso::Function::~Function ( )
inlinevirtual

The destructor.

highprecisionpso::Function::Function ( )

A constructor.

highprecisionpso::Function::Function ( double  search_space_lower_bound,
double  search_space_upper_bound 
)

A constructor, specifying the lower and upper search space bounds.

Parameters
search_space_lower_boundThe lower search space bound for each dimension.
search_space_upper_boundThe upper search space bound for each dimension.
highprecisionpso::Function::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.

Parameters
search_space_lower_boundThe lower search space bound.
search_space_upper_boundThe upper search space bound.

Member Function Documentation

virtual mpf_t* highprecisionpso::Function::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.

For a given position all values (beside the value in the specified dimension) are regarded as constants. By a ternary search, where the value of the position in the specified dimension is varied, a local optimum is calculated. The result is the distance of the evaluated position and the found local optimum.

Parameters
posThe position.
dThe index of the observed dimension.
Returns
The distance to the next local optimum in a single dimensional setting.

Reimplemented in highprecisionpso::Norm1Plus2PowerMinusK, highprecisionpso::ScaledSphereRand, highprecisionpso::ScaledHadamardRotatedSphere, highprecisionpso::Norm2PowerK, highprecisionpso::InclinedPlaneAsym, highprecisionpso::NormInfinity, highprecisionpso::RandomPositiveDefiniteSecondDerivative, highprecisionpso::ScaledSphere, highprecisionpso::Schwefel1, highprecisionpso::MonoSphere, highprecisionpso::InclinedPlane, highprecisionpso::SortingFunction, highprecisionpso::TwoCupsFunction, highprecisionpso::DiagonalFunction, highprecisionpso::Norm1, and highprecisionpso::SpherePlus.

virtual mpf_t* highprecisionpso::Function::DistanceTo1DLocalOptimumTernarySearch ( const std::vector< mpf_t * > &  pos,
int  d,
mpf_t *  start_distance 
)
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.

For a given position all values (beside the value in the specified dimension) are regarded as constants. By a ternary search, where the value of the position in the specified dimension is varied, a local optimum is calculated. The result is the distance of the evaluated position and the found local optimum.

Parameters
posThe position.
dThe index of the observed dimension.
start_distanceThe initial step length for the ternary search.
Returns
The distance to the next local optimum in a single dimensional setting.
mpf_t* highprecisionpso::Function::Evaluate ( const std::vector< mpf_t * > &  pos)

This is the initial function for evaluation of a position.

Here the cases are handled where the position lies outside of the search space bounds.

Warning
Do not override this method. If you write your own function override the function eval!
Parameters
posThe position which should be evaluated.
Returns
The function value of the position.
virtual std::vector<mpf_t*> highprecisionpso::Function::GetLowerSearchSpaceBound ( )
virtual

Returns the lower search space bound of the search space for this objective function.

Returns
The lower bound.
virtual std::vector<mpf_t*> highprecisionpso::Function::GetUpperSearchSpaceBound ( )
virtual

Returns the upper search space bound of the search space for this objective function.

Returns
The upper bound.
void highprecisionpso::Function::InitSearchSpaceBounds ( )

Initializes the search space bounds.

void highprecisionpso::Function::SetFunctionBound ( SearchSpaceBound search_space_bound)

Updates the bound of the search space according to the given data.

Parameters
search_space_boundThe information about the updated search space bounds.

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