|
Optimist
0.0.0
A C++ library for optimization
|
#include <Ackley.hh>
Inherits Optimist::TestSet::DenseCostFunction< Vector, N, Ackley< Vector, N > >.
Public Types | |
| using | Base = DenseCostFunction<Vector, N, Ackley<Vector, N>> |
| using | Dense |
| using | DenseMatrix |
| using | Scalar |
| Public Types inherited from Optimist::TestSet::DenseCostFunction< Vector, N, Ackley< Vector, N > > | |
| using | VectorTrait |
| using | Scalar |
| using | Dense |
| using | DenseMatrix |
| Public Types inherited from Optimist::FunctionBase< Input, Output, DerivedFunction > | |
| using | InputTrait = TypeTrait<Input> |
| using | OutputTrait = TypeTrait<Output> |
| using | Scalar = typename InputTrait::Scalar |
| using | FirstDerivative |
| using | SecondDerivative |
Public Member Functions | |
| Ackley () | |
| constexpr std::string | name_impl () const |
| Scalar | value (const Dense &x) const |
| void | gradient (const Dense &x, Dense &g) const |
| void | hessian (const Dense &x, DenseMatrix &H) const |
| Public Member Functions inherited from Optimist::TestSet::DenseCostFunction< Vector, N, Ackley< Vector, N > > | |
| bool | evaluate_impl (const Vector &x, Scalar &out) const |
| bool | first_derivative_impl (const Vector &x, FirstDerivative &out) const |
| bool | second_derivative_impl (const Vector &x, SecondDerivative &out) const |
| Public Member Functions inherited from Optimist::Function< Input, Output, DerivedFunction > | |
| Function () | |
| constexpr std::string | name () const |
| bool | evaluate (const Input &x, Output &out) const |
| bool | jacobian (const Input &x, FirstDerivative &out) const |
| bool | hessian (const Input &x, SecondDerivative &out) const |
| Public Member Functions inherited from Optimist::FunctionBase< Input, Output, DerivedFunction > | |
| FunctionBase () | |
| constexpr std::string | name () const |
| bool | evaluate (const Input &x, Output &out) const |
| bool | first_derivative (const Input &x, FirstDerivative &out) const |
| bool | second_derivative (const Input &x, SecondDerivative &out) const |
| constexpr Integer | input_dimension () const |
| constexpr Integer | output_dimension () const |
| const std::vector< Input > & | solutions () const |
| const std::vector< Input > & | guesses () const |
| const Input & | solution (const Integer i) const |
| const Input & | guess (const Integer i) const |
| bool | is_solution (const Input &x, const Scalar tol=FunctionBase::SQRT_EPSILON) const |
Static Public Member Functions | |
| static constexpr Scalar | domain () |
| Static Public Member Functions inherited from Optimist::TestSet::DenseCostFunction< Vector, N, Ackley< Vector, N > > | |
| static constexpr Integer | dimension () |
Static Private Member Functions | |
| template<typename T> | |
| static Eigen::Matrix< T, Eigen::Dynamic, 1 > | gradient_t (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &x) |
Additional Inherited Members | |
| Protected Member Functions inherited from Optimist::TestSet::DenseCostFunction< Vector, N, Ackley< Vector, N > > | |
| void | add_solution (const Dense &x) |
| void | add_guess (const Dense &x) |
| Static Protected Member Functions inherited from Optimist::TestSet::DenseCostFunction< Vector, N, Ackley< Vector, N > > | |
| static Dense | make (std::initializer_list< Scalar > values) |
| Protected Attributes inherited from Optimist::FunctionBase< Input, Output, DerivedFunction > | |
| std::vector< Input > | m_solutions |
| std::vector< Input > | m_guesses |
\[ f(\mathbf{x}) = -20\exp\left(-0.2\sqrt{\frac{1}{N}\sum x_i^2}\right) - \exp\left(\frac{1}{N}\sum\cos(2\pi x_i)\right) + 20 + e \text{,} \]
a nearly flat outer region riddled with local minima around a deep funnel with global minimum \( f(\mathbf{0}) = 0 \). The usual search domain is \( [-5, 5]^N \). It is meant for global optimizers. The Hessian is obtained by forward-mode automatic differentiation of the gradient (Eigen's AutoDiffScalar). The function is not differentiable at the origin, where the gradient is set to zero.
| Vector | Eigen vector type. |
| N | Problem dimension. |
| using Optimist::TestSet::Ackley< Vector, N >::Base = DenseCostFunction<Vector, N, Ackley<Vector, N>> |
| using Optimist::TestSet::DenseCostFunction< Vector, N, Ackley< Vector, N > >::Dense |
| using Optimist::TestSet::DenseCostFunction< Vector, N, Ackley< Vector, N > >::DenseMatrix |
| using Optimist::TestSet::DenseCostFunction< Vector, N, Ackley< Vector, N > >::Scalar |
|
inline |
Class constructor for Ackley's function.
|
inlinestaticconstexpr |
Usual half-width of the search domain.
|
inline |
|
inlinestaticprivate |
Gradient written for a generic scalar type, so that it can be differentiated automatically.
|
inline |
|
inlineconstexpr |
|
inline |