Optimist  0.0.0
A C++ library for optimization
Loading...
Searching...
No Matches
Optimist::RootFinder::Varona< Scalar > Class Template Reference

Class container for the Varona's methods. More...

#include <Varona.hh>

Inherits Optimist::RootFinder::RootFinder< Scalar, Varona< Scalar > >.

Public Types

using Method
Public Types inherited from Optimist::RootFinder::RootFinder< Scalar, Varona< Scalar > >
using Scalar
using Input
using Output
Public Types inherited from Optimist::SolverBase< Scalar, Scalar, Varona< Scalar > >
using InputTrait
using OutputTrait
using Scalar
using FirstDerivative
using SecondDerivative

Public Member Functions

 Varona ()
constexpr std::string name_impl () const
Method method () const
void method (Method t_method)
void enable_4th_order_method ()
void enable_8th_order_method ()
void enable_16th_order_method ()
void enable_32th_order_method ()
void set_method (Method t_method)
template<typename FunctionLambda, typename FirstDerivativeLambda>
bool solve_impl (FunctionLambda &&function, FirstDerivativeLambda &&first_derivative, Scalar x_ini, Scalar &x_sol)
Public Member Functions inherited from Optimist::RootFinder::RootFinder< Scalar, Varona< Scalar > >
 RootFinder ()
constexpr std::string name () const
Integer jacobian_evaluations () const
Integer max_jacobian_evaluations () const
Integer hessian_evaluations () const
Integer max_hessian_evaluations () const
bool solve (FunctionLambda &&function, const Input &x_ini, Output &x_sol)
Public Member Functions inherited from Optimist::SolverBase< Scalar, Scalar, Varona< Scalar > >
 SolverBase ()
void reset_bounds (const Integer n=InputTrait::IsDynamic ? 0 :InputTrait::Dimension)
const Scalarlower_bound () const
const Scalarupper_bound () const
void bounds (const Scalar &t_lower_bound, const Scalar &t_upper_bound)
constexpr Integer input_dimension () const
constexpr Integer output_dimension () const
Integer function_evaluations () const
void max_function_evaluations (const Integer t_max_function_evaluations)
Integer iterations () const
Integer max_iterations () const
Scalar alpha () const
Integer relaxations () const
Integer max_relaxations () const
Scalar tolerance () const
void verbose_mode (bool t_verbose)
void enable_verbose_mode ()
void disable_verbose_mode ()
void damped_mode (bool t_damped)
void enable_damped_mode ()
void disable_damped_mode ()
std::string task () const
bool converged () const
std::ostream & ostream () const
bool solve (FunctionLambda &&function, const Scalar &x_ini, Scalar &x_sol)
bool rootfind (const FunctionBase< FunctionInput, FunctionOutput, DerivedFunction > &function, const Scalar &x_ini, Scalar &x_sol)
bool optimize (const FunctionBase< FunctionInput, FunctionOutput, DerivedFunction > &function, const Scalar &x_ini, Scalar &x_sol)
constexpr std::string name () const

Static Public Attributes

static constexpr bool RequiresFunction {true}
static constexpr bool RequiresFirstDerivative {true}
static constexpr bool RequiresSecondDerivative {false}
Static Public Attributes inherited from Optimist::RootFinder::RootFinder< Scalar, Varona< Scalar > >
static constexpr bool IsRootFinder
static constexpr bool IsOptimizer

Protected Member Functions

template<typename FunctionLambda>
void compute_step (FunctionLambda &&function, Scalar x_old, Scalar function_old, Scalar first_derivative_old, Scalar &step_old)
Protected Member Functions inherited from Optimist::RootFinder::RootFinder< Scalar, Varona< Scalar > >
bool evaluate_jacobian (JacobianLambda &&jacobian, const Input &x, FirstDerivative &out)
bool evaluate_hessian (HessianLambda &&hessian, const Input &x, SecondDerivative &out)
Protected Member Functions inherited from Optimist::SolverBase< Scalar, Scalar, Varona< Scalar > >
Integer first_derivative_evaluations () const
Integer max_first_derivative_evaluations () const
Integer second_derivative_evaluations () const
Integer max_second_derivative_evaluations () const
void reset_counters ()
bool evaluate_function (FunctionLambda &&function, const Scalar &x, Scalar &out)
bool evaluate_first_derivative (FirstDerivativeLambda &&function, const Scalar &x, FirstDerivative &out)
bool evaluate_second_derivative (SecondDerivativeLambda &&function, const Scalar &x, SecondDerivative &out)
bool damp (FunctionLambda &&function, const Scalar &x_old, const Scalar &function_old, const Scalar &step_old, Scalar &x_new, Scalar &function_new, Scalar &step_new)
void header ()
void bottom ()
void info (Scalar residuals, const std::string &notes="-")

Static Protected Member Functions

static Scalar Q (Scalar t)
static Scalar W (Scalar t, Scalar s)
static Scalar H (Scalar t, Scalar s, Scalar u)
static Scalar J (Scalar t, Scalar s, Scalar u, Scalar v)

Private Attributes

Method m_method {Method::ORDER_4}

Additional Inherited Members

Protected Attributes inherited from Optimist::SolverBase< Scalar, Scalar, Varona< Scalar > >
Scalar m_lower_bound
Scalar m_upper_bound
Integer m_function_evaluations
Integer m_first_derivative_evaluations
Integer m_second_derivative_evaluations
Integer m_max_function_evaluations
Integer m_max_first_derivative_evaluations
Integer m_max_second_derivative_evaluations
Integer m_iterations
Integer m_max_iterations
Scalar m_alpha
Integer m_relaxations
Integer m_max_relaxations
Scalar m_tolerance
bool m_verbose
bool m_damped
std::ostream * m_ostream
std::string m_task
bool m_converged

Detailed Description

template<typename Scalar>
class Optimist::RootFinder::Varona< Scalar >
Template Parameters
ScalarFloating-point number type.

Member Typedef Documentation

◆ Method

template<typename Scalar>
using Optimist::RootFinder::Varona< Scalar >::Method
Initial value:
enum class Method : Integer {
ORDER_4 = 41,
ORDER_8 = 8,
ORDER_16 = 16,
ORDER_32 = 32
}
enum class Method :Integer { STANDARD=0, SPENDLEY=1 } Method
Definition NelderMead.hh:101
OPTIMIST_DEFAULT_INTEGER_TYPE Integer
The Integer type as used for the API.
Definition Optimist.hh:97

Varona solver type enumeration.

Constructor & Destructor Documentation

◆ Varona()

template<typename Scalar>
Optimist::RootFinder::Varona< Scalar >::Varona ( )
inline

Class constructor for the Varona's solvers.

Member Function Documentation

◆ compute_step()

template<typename Scalar>
template<typename FunctionLambda>
void Optimist::RootFinder::Varona< Scalar >::compute_step ( FunctionLambda && function,
Scalar x_old,
Scalar function_old,
Scalar first_derivative_old,
Scalar & step_old )
inlineprotected

Compute the step using the Varona's methods.

Parameters
[in]functionFunction lambda.
[in]x_oldOld point.
[in]function_oldOld function value.
[in]first_derivative_oldOld first derivative value.
[out]step_oldOld step.

◆ enable_16th_order_method()

template<typename Scalar>
void Optimist::RootFinder::Varona< Scalar >::enable_16th_order_method ( )
inline

Enable the Varona's 16-th order method.

◆ enable_32th_order_method()

template<typename Scalar>
void Optimist::RootFinder::Varona< Scalar >::enable_32th_order_method ( )
inline

Enable the Varona's 32-th order method.

◆ enable_4th_order_method()

template<typename Scalar>
void Optimist::RootFinder::Varona< Scalar >::enable_4th_order_method ( )
inline

Enable the Varona's 4-th order method.

◆ enable_8th_order_method()

template<typename Scalar>
void Optimist::RootFinder::Varona< Scalar >::enable_8th_order_method ( )
inline

Enable the Varona's 8-th order method.

◆ H()

template<typename Scalar>
Scalar Optimist::RootFinder::Varona< Scalar >::H ( Scalar t,
Scalar s,
Scalar u )
inlinestaticprotected

Compute the \( H \) function for the Varona's methods.

Parameters
[in]tInput value.
[in]sInput value.
[in]uInput value.
Returns
The \( H \) function value.

◆ J()

template<typename Scalar>
Scalar Optimist::RootFinder::Varona< Scalar >::J ( Scalar t,
Scalar s,
Scalar u,
Scalar v )
inlinestaticprotected

Compute the \( J \) function for the Varona's methods.

Parameters
[in]tInput value.
[in]sInput value.
[in]uInput value.
[in]vInput value.
Returns
The \( J \) function value.

◆ method() [1/2]

template<typename Scalar>
Method Optimist::RootFinder::Varona< Scalar >::method ( ) const
inline

Get the enumeration type of the Varona solver method.

Returns
The Varona solver enumeration type.

◆ method() [2/2]

template<typename Scalar>
void Optimist::RootFinder::Varona< Scalar >::method ( Method t_method)
inline

Set the enumeration type of the Varona solver method.

Parameters
[in]t_methodThe Varona solver enumeration type.

◆ name_impl()

template<typename Scalar>
std::string Optimist::RootFinder::Varona< Scalar >::name_impl ( ) const
inlineconstexpr

Get the Varona solver name.

Returns
The Varona solver name.

◆ Q()

template<typename Scalar>
Scalar Optimist::RootFinder::Varona< Scalar >::Q ( Scalar t)
inlinestaticprotected

Compute the \( Q \) function for the Varona's methods.

Parameters
[in]tInput value.
Returns
The \( Q \) function value.

◆ set_method()

template<typename Scalar>
void Optimist::RootFinder::Varona< Scalar >::set_method ( Method t_method)
inline

Set the Varona solver type.

Parameters
[in]t_methodThe Varona solver type enumeration.

◆ solve_impl()

template<typename Scalar>
template<typename FunctionLambda, typename FirstDerivativeLambda>
bool Optimist::RootFinder::Varona< Scalar >::solve_impl ( FunctionLambda && function,
FirstDerivativeLambda && first_derivative,
Scalar x_ini,
Scalar & x_sol )
inline

Solve the nonlinear equation \( f(x) = 0 \), with \( f: \mathbb{R} \rightarrow \mathbb{R} \).

Template Parameters
FunctionLambdaFunction lambda type.
FirstDerivativeLambdaFirst derivative lambda type.
Parameters
[in]functionFunction lambda.
[in]first_derivativeFirst derivative lambda.
[in]x_iniInitialization point.
[out]x_solSolution point.
Returns
The convergence boolean flag.

◆ W()

template<typename Scalar>
Scalar Optimist::RootFinder::Varona< Scalar >::W ( Scalar t,
Scalar s )
inlinestaticprotected

Compute the \( W \) function for the Varona's methods.

Parameters
[in]tInput value.
[in]sInput value.
Returns
The \( W \) function value.

Member Data Documentation

◆ m_method

template<typename Scalar>
Method Optimist::RootFinder::Varona< Scalar >::m_method {Method::ORDER_4}
private

Varona solver type.

◆ RequiresFirstDerivative

template<typename Scalar>
bool Optimist::RootFinder::Varona< Scalar >::RequiresFirstDerivative {true}
staticconstexpr

◆ RequiresFunction

template<typename Scalar>
bool Optimist::RootFinder::Varona< Scalar >::RequiresFunction {true}
staticconstexpr

◆ RequiresSecondDerivative

template<typename Scalar>
bool Optimist::RootFinder::Varona< Scalar >::RequiresSecondDerivative {false}
staticconstexpr

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