Optimist  0.0.0
A C++ library for optimization
Loading...
Searching...
No Matches
Optimist::TestSet::RosenbrockCost< Vector, N > Class Template Reference

Rosenbrock's cost function in \( N \) dimensions (chained form). More...

#include <RosenbrockCost.hh>

Inherits Optimist::TestSet::DenseCostFunction< Vector, N, RosenbrockCost< Vector, N > >.

Public Types

using Base = DenseCostFunction<Vector, N, RosenbrockCost<Vector, N>>
Public Types inherited from Optimist::TestSet::DenseCostFunction< Vector, N, RosenbrockCost< 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

 RosenbrockCost ()
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, RosenbrockCost< 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

Additional Inherited Members

Static Public Member Functions inherited from Optimist::TestSet::DenseCostFunction< Vector, N, RosenbrockCost< Vector, N > >
static constexpr Integer dimension ()
Protected Member Functions inherited from Optimist::TestSet::DenseCostFunction< Vector, N, RosenbrockCost< 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, RosenbrockCost< 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

Detailed Description

template<typename Vector, Integer N>
requires (N >= 2)
class Optimist::TestSet::RosenbrockCost< Vector, N >

\[ f(\mathbf{x}) = \sum_{i=1}^{N-1} 100(x_{i+1} - x_i^2)^2 + (1 - x_i)^2 \text{,} \]

with global minimum \( f(1, \dots, 1) = 0 \) at the end of a long, narrow, curved valley. Unlike Rosenbrock, which exposes the residuals of the decoupled variant to root finders, this is the scalar cost function used to benchmark optimizers.

Template Parameters
VectorEigen vector type.
NProblem dimension.

Member Typedef Documentation

◆ Base

template<typename Vector, Integer N>
using Optimist::TestSet::RosenbrockCost< Vector, N >::Base = DenseCostFunction<Vector, N, RosenbrockCost<Vector, N>>

Constructor & Destructor Documentation

◆ RosenbrockCost()

template<typename Vector, Integer N>
Optimist::TestSet::RosenbrockCost< Vector, N >::RosenbrockCost ( )
inline

Class constructor for Rosenbrock's cost function.

Member Function Documentation

◆ gradient()

template<typename Vector, Integer N>
void Optimist::TestSet::RosenbrockCost< Vector, N >::gradient ( const Dense & x,
Dense & g ) const
inline

◆ hessian()

template<typename Vector, Integer N>
void Optimist::TestSet::RosenbrockCost< Vector, N >::hessian ( const Dense & x,
DenseMatrix & H ) const
inline

◆ name_impl()

template<typename Vector, Integer N>
std::string Optimist::TestSet::RosenbrockCost< Vector, N >::name_impl ( ) const
inlineconstexpr

◆ value()

template<typename Vector, Integer N>
Scalar Optimist::TestSet::RosenbrockCost< Vector, N >::value ( const Dense & x) const
inline

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