Optimist  0.0.0
A C++ library for optimization
Loading...
Searching...
No Matches
Optimist::TestSet::Schaffer2< Real > Class Template Reference

Class container for the Schaffer2 function. More...

#include <Schaffer2.hh>

Inherits Optimist::CostFunction< Real, 2, Schaffer2< Real > >.

Public Types

using Vector = typename CostFunction<Real, 2, Schaffer2<Real>>::Vector
 
using RowVector = typename CostFunction<Real, 2, Schaffer2<Real>>::RowVector
 
using Matrix = typename CostFunction<Real, 2, Schaffer2<Real>>::Matrix
 
- Public Types inherited from Optimist::CostFunction< Real, 2, Schaffer2< Real > >
using Vector
 
using RowVector
 
using Matrix
 
- Public Types inherited from Optimist::Function< Real, N, 1, Schaffer2< Real > >
using InputType
 
using OutputType
 
using FirstDerivativeType
 
using SecondDerivativeType
 

Public Member Functions

 Schaffer2 ()
 
std::string name_impl () const
 
void evaluate_impl (const Vector &x, Real &out) const
 
void first_derivative_impl (const Vector &x, RowVector &out) const
 
void second_derivative_impl (const Vector &x, Matrix &out) const
 
- Public Member Functions inherited from Optimist::CostFunction< Real, 2, Schaffer2< Real > >
 CostFunction ()
 
std::string name () const
 
void evaluate (const Vector &x, Vector &out) const
 
void gradient (const Vector &x, RowVector &out) const
 
void hessian (const Vector &x, Matrix &out) const
 
- Public Member Functions inherited from Optimist::Function< Real, N, 1, Schaffer2< Real > >
 Function ()
 
std::string name () const
 
void evaluate (const InputType &x, OutputType &out) const
 
void first_derivative (const InputType &x, FirstDerivativeType &out) const
 
void second_derivative (const InputType &x, SecondDerivativeType &out) const
 
constexpr Integer input_dimension () const
 
constexpr Integer output_dimension () const
 
const std::vector< InputType > & solutions () const
 
const std::vector< InputType > & guesses () const
 
const InputTypesolution (const Integer i) const
 
const InputTypeguess (const Integer i) const
 
bool is_solution (const InputType &x, const Real tol=EPSILON_LOW) const
 

Additional Inherited Members

- Public Attributes inherited from Optimist::CostFunction< Real, 2, Schaffer2< Real > >
friend Function< Real, N, 1, CostFunction< Real, N, DerivedFunction > >
 
- Protected Attributes inherited from Optimist::Function< Real, N, 1, Schaffer2< Real > >
std::vector< InputTypem_solutions
 
std::vector< InputTypem_guesses
 

Detailed Description

template<typename Real>
class Optimist::TestSet::Schaffer2< Real >

Class container for the Schaffer2 function, which is defined as:

\[f(\mathbf{x}) = 0.5 + \displaystyle\frac{\sin^{2}(x_1^2 - x_2^2) - 0.5}{(1 + 0.001(x_1^2 + x_2^2))^2} \text{.} \]

The function has global minima at \(\mathbf{x} = (0, 0)\), with \(f(\mathbf{x}) = 0\). The initial guesses are generated on the square \(x_i \in \left[-100, 100\right]\).

Template Parameters
RealScalar number type.

Member Typedef Documentation

◆ Matrix

template<typename Real>
using Optimist::TestSet::Schaffer2< Real >::Matrix = typename CostFunction<Real, 2, Schaffer2<Real>>::Matrix

Basic constants.

◆ RowVector

template<typename Real>
using Optimist::TestSet::Schaffer2< Real >::RowVector = typename CostFunction<Real, 2, Schaffer2<Real>>::RowVector

◆ Vector

template<typename Real>
using Optimist::TestSet::Schaffer2< Real >::Vector = typename CostFunction<Real, 2, Schaffer2<Real>>::Vector

Constructor & Destructor Documentation

◆ Schaffer2()

template<typename Real>
Optimist::TestSet::Schaffer2< Real >::Schaffer2 ( )
inline

Class constructor for the Schaffer2 function.

Member Function Documentation

◆ evaluate_impl()

template<typename Real>
void Optimist::TestSet::Schaffer2< Real >::evaluate_impl ( const Vector & x,
Real & out ) const
inline

Compute the function value at the input point.

Parameters
[in]xInput point.
[out]outThe function value.

◆ first_derivative_impl()

template<typename Real>
void Optimist::TestSet::Schaffer2< Real >::first_derivative_impl ( const Vector & x,
RowVector & out ) const
inline

Compute the first derivative value at the input point.

Parameters
[in]xInput point.
[out]outThe first derivative value.

◆ name_impl()

template<typename Real>
std::string Optimist::TestSet::Schaffer2< Real >::name_impl ( ) const
inline

Get the function name.

Returns
The function name.

◆ second_derivative_impl()

template<typename Real>
void Optimist::TestSet::Schaffer2< Real >::second_derivative_impl ( const Vector & x,
Matrix & out ) const
inline

Compute the second derivative value at the input point.

Parameters
[in]xInput point.
[out]outThe second derivative value.

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