SG++-Doxygen-Documentation
|
Base class for analytical objective function examples ("test functions"). More...
#include <TestScalarFunction.hpp>
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::DataVector & | getDisplacement () 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... | |
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.
|
explicit |
Constructor.
The displacement is set to all zeros, so to displace the function call generateDisplacement() afterwards.
d | dimension of the domain |
|
override |
Destructor.
|
overridevirtual |
Evaluate displaced function.
x | point \(\vec{x} \in \mathbb{R}^d\) |
Implements sgpp::optimization::ScalarFunction.
References sgpp::optimization::ScalarFunction::d, displacement, evalUndisplaced(), and xTmp.
|
pure virtual |
Pure virtual method for evaluating the undisplaced function.
x | point \(\vec{x} \in \mathbb{R}^d\) |
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 |
References displacement.
void sgpp::optimization::test_problems::TestScalarFunction::setDisplacement | ( | const base::DataVector & | displacement | ) |
displacement | currently used displacement |
References displacement.
Referenced by sgpp::optimization::test_problems::UnconstrainedTestProblem::generateDisplacement(), sgpp::optimization::test_problems::ConstrainedTestProblem::generateDisplacement(), sgpp::optimization::test_problems::UnconstrainedTestProblem::setDisplacement(), and sgpp::optimization::test_problems::ConstrainedTestProblem::setDisplacement().
|
protected |
displacement vector
Referenced by eval(), getDisplacement(), and setDisplacement().
|
protected |
temporary vector for displacing
Referenced by eval().