SG++-Doxygen-Documentation
sgpp::optimization::test_problems::TestScalarFunction Class Referenceabstract

Base class for analytical objective function examples ("test functions"). More...

#include <TestScalarFunction.hpp>

Inheritance diagram for sgpp::optimization::test_problems::TestScalarFunction:
sgpp::optimization::ScalarFunction sgpp::optimization::test_problems::AbsoluteValueObjective sgpp::optimization::test_problems::AckleyObjective sgpp::optimization::test_problems::BealeObjective sgpp::optimization::test_problems::BraninObjective sgpp::optimization::test_problems::BubbleWrapObjective sgpp::optimization::test_problems::EasomYangObjective sgpp::optimization::test_problems::EggholderObjective sgpp::optimization::test_problems::FloudasObjective sgpp::optimization::test_problems::G03Objective sgpp::optimization::test_problems::G04Objective sgpp::optimization::test_problems::G05Objective sgpp::optimization::test_problems::G06Objective sgpp::optimization::test_problems::G08Objective sgpp::optimization::test_problems::G09Objective sgpp::optimization::test_problems::G10Objective sgpp::optimization::test_problems::G11Objective sgpp::optimization::test_problems::G12Objective sgpp::optimization::test_problems::G13Objective sgpp::optimization::test_problems::GoldsteinPriceObjective sgpp::optimization::test_problems::GriewankObjective sgpp::optimization::test_problems::Hartman3Objective sgpp::optimization::test_problems::Hartman6Objective sgpp::optimization::test_problems::HimmelblauObjective sgpp::optimization::test_problems::HoelderTableObjective sgpp::optimization::test_problems::IncreasingPowerObjective sgpp::optimization::test_problems::MichalewiczObjective sgpp::optimization::test_problems::MladineoObjective sgpp::optimization::test_problems::PermObjective sgpp::optimization::test_problems::RastriginObjective sgpp::optimization::test_problems::RosenbrockObjective sgpp::optimization::test_problems::SchwefelObjective sgpp::optimization::test_problems::SHCBObjective sgpp::optimization::test_problems::SimionescuObjective sgpp::optimization::test_problems::SolandObjective sgpp::optimization::test_problems::SphereObjective sgpp::optimization::test_problems::TremblingParabolaObjective

Public Member Functions

double eval (const base::DataVector &x) override
 Evaluate displaced function. More...
 
virtual double evalUndisplaced (const base::DataVector &x)=0
 Pure virtual method for evaluating the undisplaced function. More...
 
const base::DataVectorgetDisplacement () const
 
void setDisplacement (const base::DataVector &displacement)
 
 TestScalarFunction (size_t d)
 Constructor. More...
 
 ~TestScalarFunction () override
 Destructor. More...
 
- Public Member Functions inherited from sgpp::optimization::ScalarFunction
virtual void clone (std::unique_ptr< ScalarFunction > &clone) const =0
 Pure virtual method for cloning the function. More...
 
size_t getNumberOfParameters () const
 
 ScalarFunction (size_t d)
 Constructor. More...
 
virtual ~ScalarFunction ()
 Destructor. More...
 

Protected Attributes

base::DataVector displacement
 displacement vector More...
 
base::DataVector xTmp
 temporary vector for displacing More...
 
- Protected Attributes inherited from sgpp::optimization::ScalarFunction
size_t d
 dimension of the domain More...
 

Detailed Description

Base class for analytical objective function examples ("test functions").

This class differs from ScalarFunction in the way that evaluation point \(\vec{x}\) are pseudorandomly displaced when calling the eval() function. Evaluting the undisplaced function must be implemented in evalUndisplaced. The displaced function is \(\vec{x} \mapsto f(\vec{x} + \vec{d})\) for a vector \(\vec{d}\) ("displacement").

Taking the average of results of multiple runs with different displacements makes results more robust and significant.

Constructor & Destructor Documentation

sgpp::optimization::test_problems::TestScalarFunction::TestScalarFunction ( size_t  d)
explicit

Constructor.

The displacement is set to all zeros, so to displace the function call generateDisplacement() afterwards.

Parameters
ddimension of the domain
sgpp::optimization::test_problems::TestScalarFunction::~TestScalarFunction ( )
override

Destructor.

Member Function Documentation

double sgpp::optimization::test_problems::TestScalarFunction::eval ( const base::DataVector x)
overridevirtual

Evaluate displaced function.

Parameters
xpoint \(\vec{x} \in \mathbb{R}^d\)
Returns
\(f(\vec{x} + \vec{d})\) with displacement \(\vec{d}\)

Implements sgpp::optimization::ScalarFunction.

References sgpp::optimization::ScalarFunction::d, displacement, evalUndisplaced(), and xTmp.

virtual double sgpp::optimization::test_problems::TestScalarFunction::evalUndisplaced ( const base::DataVector x)
pure virtual

Pure virtual method for evaluating the undisplaced function.

Parameters
xpoint \(\vec{x} \in \mathbb{R}^d\)
Returns
\(f(\vec{x})\)

Implemented in sgpp::optimization::test_problems::Hartman3Objective, sgpp::optimization::test_problems::Hartman6Objective, sgpp::optimization::test_problems::TremblingParabolaObjective, sgpp::optimization::test_problems::EasomYangObjective, sgpp::optimization::test_problems::EggholderObjective, sgpp::optimization::test_problems::GoldsteinPriceObjective, sgpp::optimization::test_problems::GriewankObjective, sgpp::optimization::test_problems::AckleyObjective, sgpp::optimization::test_problems::BraninObjective, sgpp::optimization::test_problems::BubbleWrapObjective, sgpp::optimization::test_problems::IncreasingPowerObjective, sgpp::optimization::test_problems::PermObjective, sgpp::optimization::test_problems::RastriginObjective, sgpp::optimization::test_problems::RosenbrockObjective, sgpp::optimization::test_problems::G03Objective, sgpp::optimization::test_problems::G09Objective, sgpp::optimization::test_problems::BealeObjective, sgpp::optimization::test_problems::HoelderTableObjective, sgpp::optimization::test_problems::MladineoObjective, sgpp::optimization::test_problems::SchwefelObjective, sgpp::optimization::test_problems::SHCBObjective, sgpp::optimization::test_problems::G04Objective, sgpp::optimization::test_problems::G05Objective, sgpp::optimization::test_problems::G08Objective, sgpp::optimization::test_problems::AbsoluteValueObjective, sgpp::optimization::test_problems::MichalewiczObjective, sgpp::optimization::test_problems::SphereObjective, sgpp::optimization::test_problems::FloudasObjective, sgpp::optimization::test_problems::G06Objective, sgpp::optimization::test_problems::G10Objective, sgpp::optimization::test_problems::G11Objective, sgpp::optimization::test_problems::G12Objective, sgpp::optimization::test_problems::G13Objective, sgpp::optimization::test_problems::SimionescuObjective, sgpp::optimization::test_problems::SolandObjective, and sgpp::optimization::test_problems::HimmelblauObjective.

Referenced by eval().

const base::DataVector & sgpp::optimization::test_problems::TestScalarFunction::getDisplacement ( ) const
Returns
currently used displacement

References displacement.

Member Data Documentation

base::DataVector sgpp::optimization::test_problems::TestScalarFunction::displacement
protected

displacement vector

Referenced by eval(), getDisplacement(), and setDisplacement().

base::DataVector sgpp::optimization::test_problems::TestScalarFunction::xTmp
protected

temporary vector for displacing

Referenced by eval().


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