Optimist
0.0.0
A C++ library for optimization
|
Class container for the scalar function. More...
#include <ScalarFunction.hh>
Inherits Optimist::Function< Real, 1, 1, DerivedFunction >.
Public Member Functions | |
ScalarFunction () | |
std::string | name () const |
void | evaluate (Real x, Real &out) const |
void | first_derivative (Real x, Real &out) const |
void | second_derivative (Real x, Real &out) const |
![]() | |
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 InputType & | solution (const Integer i) const |
const InputType & | guess (const Integer i) const |
bool | is_solution (const InputType &x, const Real tol=EPSILON_LOW) const |
Public Attributes | |
friend | Function< Real, 1, 1, ScalarFunction< Real, DerivedFunction > > |
Additional Inherited Members | |
![]() | |
using | InputType |
using | OutputType |
using | FirstDerivativeType |
using | SecondDerivativeType |
![]() | |
std::vector< InputType > | m_solutions |
std::vector< InputType > | m_guesses |
The Function
class in Optimist
provides a common interface for representing and evaluating mathematical functions. This class is designed to handle a generic function \(\mathbf{f}(\mathbf{x}): \mathbb{R}^{n} \rightarrow \mathbb{R}^{m}\), where \(\mathbf{x}\) is a vector of input variables and \(\mathbf{f}(\mathbf{x})\) is a vector of output values.
The Function
class serves as a base class for developing specific function representations that can be used in various numerical algorithms. In general, the Function
class and its derived classes are designed to support:
\[ \mathbf{f}(\mathbf{x}) = \mathbf{0} \text{,} \quad \text{with} \quad \mathbf{f}: \mathbb{R}^{n} \rightarrow \mathbb{R}^{n} \text{,} \]
\[ \min_{\mathbf{x}} f(\mathbf{x}) \text{,} \quad f: \mathbb{R}^{n} \rightarrow \mathbb{R} \text{.} \]
If \(n > 1\), the function is multi-dimensional, otherwise, it is scalar. The linear algebra operations required for multi-dimensional functions are performed using the Eigen
library, which provides a high-level interface for matrix operations. For scalar functions ( \(n = 1\)), the base type changes to Real
, a scalar type defined in the Optimist
library.
Real | Scalar number type. |
DerivedFunction | Derived scalar function class. |
|
inline |
Class constructor for the function.
|
inline |
Compute the function value at the input point.
[in] | x | Input point. |
[out] | out | The function value. |
|
inline |
Compute the function first derivative at the input point.
[in] | x | Input point. |
[out] | out | The function first derivative. |
|
inline |
Get the function name.
|
inline |
Compute the function second derivative at the input point.
[in] | x | Input point. |
[out] | out | The function second derivative. |
friend Optimist::ScalarFunction< Real, DerivedFunction >::Function< Real, 1, 1, ScalarFunction< Real, DerivedFunction > > |