|
Optimist
0.0.0
A C++ library for optimization
|
Helper base class for scalar cost functions \( f : \mathbb{R}^N \to \mathbb{R} \) written once in terms of dense vectors. More...
#include <DenseFunction.hh>
Inherits Optimist::Function< Vector, Vector::Scalar, Derived >.
Public Types | |
| using | VectorTrait = TypeTrait<Vector> |
| using | Scalar = typename Vector::Scalar |
| using | Dense = Utils::DenseVector<Vector> |
| using | DenseMatrix = Utils::DenseMatrix<Vector> |
| Public Types inherited from Optimist::FunctionBase< Vector, Vector::Scalar, Derived > | |
| using | InputTrait |
| using | OutputTrait |
| using | Scalar |
| using | FirstDerivative |
| using | SecondDerivative |
Public Member Functions | |
| 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< Vector, Vector::Scalar, Derived > | |
| Function () | |
| constexpr std::string | name () const |
| bool | evaluate (const Vector &x, Vector::Scalar &out) const |
| bool | jacobian (const Vector &x, FirstDerivative &out) const |
| bool | hessian (const Vector &x, SecondDerivative &out) const |
| Public Member Functions inherited from Optimist::FunctionBase< Vector, Vector::Scalar, Derived > | |
| FunctionBase () | |
| constexpr std::string | name () const |
| bool | evaluate (const Vector &x, Vector::Scalar &out) const |
| bool | first_derivative (const Vector &x, FirstDerivative &out) const |
| bool | second_derivative (const Vector &x, SecondDerivative &out) const |
| constexpr Integer | input_dimension () const |
| constexpr Integer | output_dimension () const |
| const std::vector< Vector > & | solutions () const |
| const std::vector< Vector > & | guesses () const |
| const Vector & | solution (const Integer i) const |
| const Vector & | guess (const Integer i) const |
| bool | is_solution (const Vector &x, const Scalar tol=FunctionBase::SQRT_EPSILON) const |
Static Public Member Functions | |
| static constexpr Integer | dimension () |
Protected Member Functions | |
| void | add_solution (const Dense &x) |
| void | add_guess (const Dense &x) |
Static Protected Member Functions | |
| static Dense | make (std::initializer_list< Scalar > values) |
Private Member Functions | |
| const Derived & | derived () const |
Additional Inherited Members | |
| Protected Attributes inherited from Optimist::FunctionBase< Vector, Vector::Scalar, Derived > | |
| std::vector< Vector > | m_solutions |
| std::vector< Vector > | m_guesses |
The derived class implements
and this class takes care of the conversion from/to fixed-size, dynamic-size and sparse Eigen vectors.
| Vector | Eigen vector type. |
| N | Problem dimension. |
| Derived | Derived function class. |
| using Optimist::TestSet::DenseCostFunction< Vector, N, Derived >::Dense = Utils::DenseVector<Vector> |
| using Optimist::TestSet::DenseCostFunction< Vector, N, Derived >::DenseMatrix = Utils::DenseMatrix<Vector> |
| using Optimist::TestSet::DenseCostFunction< Vector, N, Derived >::Scalar = typename Vector::Scalar |
| using Optimist::TestSet::DenseCostFunction< Vector, N, Derived >::VectorTrait = TypeTrait<Vector> |
|
inlineprotected |
Add a suggested initial guess given its dense coefficients.
|
inlineprotected |
Add a known solution given its dense coefficients.
|
inlineprivate |
|
inlinestaticconstexpr |
Problem dimension.
|
inline |
Evaluate the cost function.
|
inline |
Evaluate the gradient of the cost function.
|
inlinestaticprotected |
Build a dense vector from a list of coefficients.
|
inline |
Evaluate the Hessian of the cost function.