version 0.4.1
Ikarus::TrustRegion< NLO, preConditioner, UF > Class Template Reference

Trust Region solver for non-linear optimization problems. More...

#include <ikarus/solver/nonlinearsolver/trustregion.hh>

Inheritance diagram for Ikarus::TrustRegion< NLO, preConditioner, UF >:
[legend]

Public Types

using ValueType = typename NLO::template ParameterValue< 0 >
 
using CorrectionType = typename NLO::DerivativeType
 Type of the correction of x += deltaX. More...
 
using UpdateFunction = UF
 Type of the update function. More...
 
using NonLinearOperator = NLO
 Type of the non-linear operator. More...
 
using ScalarType = std::remove_cvref_t< typename NLO::template FunctionReturnType< 0 > >
 
using MatrixType = std::remove_cvref_t< typename NLO::template FunctionReturnType< 2 > >
 Type of the Hessian. More...
 

Public Member Functions

 TrustRegion (const NLO &nonLinearOperator, UF updateFunction={})
 Constructs a TrustRegion solver instance. More...
 
void setup (const TrustRegionSettings &settings)
 Sets up the TrustRegion solver with the provided settings and checks feasibility. More...
 
template<typename SolutionType = NoPredictor>
requires std::is_same_v<SolutionType, NoPredictor> || std::is_convertible_v<SolutionType, CorrectionType>
NonLinearSolverInformation solve (const SolutionType &dxPredictor=NoPredictor{})
 Solves the nonlinear optimization problem using the TrustRegion algorithm. More...
 
auto & nonLinearOperator ()
 Access the nonlinear operator. More...
 
void subscribe (NonLinearSolverMessages message, std::shared_ptr< IObserver< NonLinearSolverMessages > > observer)
 Subscribe an observer to receive notifications for a specific message type. More...
 
void subscribeAll (std::shared_ptr< IObserver< NonLinearSolverMessages > > observer)
 Subscribe an observer to receive notifications for all message types. More...
 
void subscribeAll (std::initializer_list< std::shared_ptr< IObserver< NonLinearSolverMessages > > > observers)
 Subscribe multiple observers to receive notifications for all message types. More...
 
void unSubscribe (NonLinearSolverMessages message, std::shared_ptr< IObserver< NonLinearSolverMessages > > observer)
 Unsubscribe an observer from receiving notifications for a specific message type. More...
 
void unSubscribeAll (std::shared_ptr< IObserver< NonLinearSolverMessages > > observer)
 Unsubscribe an observer from receiving notifications for all message types. More...
 
void notify (NonLinearSolverMessages message)
 Notify observers about a specific message type. More...
 
void notify (NonLinearSolverMessages message, ScalarType val)
 Notify observers about a specific message type with a floating-point value. More...
 
void notify (NonLinearSolverMessages message, int val)
 Notify observers about a specific message type with an integer value. More...
 
void notify (NonLinearSolverMessages message, const std::string &val)
 Notify observers about a specific message type with a string value. More...
 
void notify (NonLinearSolverMessages message, int val1, double val2)
 Notify observers about a specific message type with an integer and a double value. More...
 
void notify (NonLinearSolverMessages message, int val1, const std::string &val2)
 Notify observers about a specific message type with an integer value and a string value. More...
 
void notify (NonLinearSolverMessages message, Eigen::VectorX< ScalarType > vec)
 Notify observers about a specific message type with an Eigen::VectorX. More...
 
void notify (MT message)
 
void notify (MT message, ScalarType val)
 
void notify (MT message, int val)
 
void notify (MT message, const std::string &val)
 
void notify (MT message, int val1, double val2)
 
void notify (MT message, int val1, const std::string &val2)
 
void notify (MT message, Eigen::VectorX< ScalarType > vec)
 

Detailed Description

template<typename NLO, PreConditioner preConditioner = PreConditioner::IncompleteCholesky, typename UF = utils::UpdateDefault>
class Ikarus::TrustRegion< NLO, preConditioner, UF >

Refer to [2] for details of the algorithm.

This code is heavily inspired by the trust-region implementation of Manopt.

Template Parameters
NLOType of the nonlinear operator to solve.
preConditionerType of preconditioner to use (default is IncompleteCholesky).
UFType of the update function

Member Typedef Documentation

◆ CorrectionType

template<typename NLO , PreConditioner preConditioner = PreConditioner::IncompleteCholesky, typename UF = utils::UpdateDefault>
using Ikarus::TrustRegion< NLO, preConditioner, UF >::CorrectionType = typename NLO::DerivativeType

◆ MatrixType

template<typename NLO , PreConditioner preConditioner = PreConditioner::IncompleteCholesky, typename UF = utils::UpdateDefault>
using Ikarus::TrustRegion< NLO, preConditioner, UF >::MatrixType = std::remove_cvref_t<typename NLO::template FunctionReturnType<2> >

◆ NonLinearOperator

template<typename NLO , PreConditioner preConditioner = PreConditioner::IncompleteCholesky, typename UF = utils::UpdateDefault>
using Ikarus::TrustRegion< NLO, preConditioner, UF >::NonLinearOperator = NLO

◆ ScalarType

template<typename NLO , PreConditioner preConditioner = PreConditioner::IncompleteCholesky, typename UF = utils::UpdateDefault>
using Ikarus::TrustRegion< NLO, preConditioner, UF >::ScalarType = std::remove_cvref_t<typename NLO::template FunctionReturnType<0> >

Type of the scalar cost

◆ UpdateFunction

template<typename NLO , PreConditioner preConditioner = PreConditioner::IncompleteCholesky, typename UF = utils::UpdateDefault>
using Ikarus::TrustRegion< NLO, preConditioner, UF >::UpdateFunction = UF

◆ ValueType

template<typename NLO , PreConditioner preConditioner = PreConditioner::IncompleteCholesky, typename UF = utils::UpdateDefault>
using Ikarus::TrustRegion< NLO, preConditioner, UF >::ValueType = typename NLO::template ParameterValue<0>

Type of the parameter vector of the nonlinear operator

Constructor & Destructor Documentation

◆ TrustRegion()

template<typename NLO , PreConditioner preConditioner = PreConditioner::IncompleteCholesky, typename UF = utils::UpdateDefault>
Ikarus::TrustRegion< NLO, preConditioner, UF >::TrustRegion ( const NLO &  nonLinearOperator,
UF  updateFunction = {} 
)
inlineexplicit
Parameters
nonLinearOperatorNonlinear operator to solve.
updateFunctionUpdate function

Member Function Documentation

◆ nonLinearOperator()

template<typename NLO , PreConditioner preConditioner = PreConditioner::IncompleteCholesky, typename UF = utils::UpdateDefault>
auto & Ikarus::TrustRegion< NLO, preConditioner, UF >::nonLinearOperator ( )
inline
Returns
Reference to the nonlinear operator.

◆ notify() [1/14]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( MT  message)
inherited

◆ notify() [2/14]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( MT  message,
const std::string &  val 
)
inherited

◆ notify() [3/14]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( MT  message,
Eigen::VectorX< ScalarType >  vec 
)
inherited

◆ notify() [4/14]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( MT  message,
int  val 
)
inherited

◆ notify() [5/14]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( MT  message,
int  val1,
const std::string &  val2 
)
inherited

◆ notify() [6/14]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( MT  message,
int  val1,
double  val2 
)
inherited

◆ notify() [7/14]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( MT  message,
ScalarType  val 
)
inherited

◆ notify() [8/14]

Parameters
messageThe message type to notify about.

◆ notify() [9/14]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( NonLinearSolverMessages  message,
const std::string &  val 
)
inherited
Parameters
messageThe message type to notify about.
valThe string value to be sent with the notification.

◆ notify() [10/14]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( NonLinearSolverMessages  message,
Eigen::VectorX< ScalarType >  vec 
)
inherited
Template Parameters
ScalarTypeThe type of the elements in the Eigen::VectorX.
Parameters
messageThe message type to notify about.
vecThe Eigen::VectorX to be sent with the notification.

◆ notify() [11/14]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( NonLinearSolverMessages  message,
int  val 
)
inherited
Parameters
messageThe message type to notify about.
valThe integer value to be sent with the notification.

◆ notify() [12/14]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( NonLinearSolverMessages  message,
int  val1,
const std::string &  val2 
)
inherited
Parameters
messageThe message type to notify about.
val1The integer value to be sent with the notification.
val2The string value to be sent with the notification.

◆ notify() [13/14]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( NonLinearSolverMessages  message,
int  val1,
double  val2 
)
inherited
Parameters
messageThe message type to notify about.
val1The integer value to be sent with the notification.
val2The double value to be sent with the notification.

◆ notify() [14/14]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( NonLinearSolverMessages  message,
ScalarType  val 
)
inherited
Template Parameters
ScalarTypeThe type of the floating-point value.
Parameters
messageThe message type to notify about.
valThe floating-point value to be sent with the notification.

◆ setup()

template<typename NLO , PreConditioner preConditioner = PreConditioner::IncompleteCholesky, typename UF = utils::UpdateDefault>
void Ikarus::TrustRegion< NLO, preConditioner, UF >::setup ( const TrustRegionSettings settings)
inline
Parameters
p_settingsTrustRegionSettings containing the solver configuration.

◆ solve()

template<typename NLO , PreConditioner preConditioner = PreConditioner::IncompleteCholesky, typename UF = utils::UpdateDefault>
template<typename SolutionType = NoPredictor>
requires std::is_same_v<SolutionType, NoPredictor> || std::is_convertible_v<SolutionType, CorrectionType>
NonLinearSolverInformation Ikarus::TrustRegion< NLO, preConditioner, UF >::solve ( const SolutionType &  dxPredictor = NoPredictor{})
inline
Template Parameters
SolutionTypeType of the solution predictor (default is NoPredictor).
Parameters
dxPredictorSolution predictor.
Returns
NonLinearSolverInformation containing information about the solver result.

◆ subscribe()

void Ikarus::IObservable< MT >::subscribe ( NonLinearSolverMessages  message,
std::shared_ptr< IObserver< NonLinearSolverMessages > >  observer 
)
inherited
Parameters
messageThe message type to subscribe to.
observerThe observer to be subscribed.

◆ subscribeAll() [1/2]

void Ikarus::IObservable< NonLinearSolverMessages >::subscribeAll ( std::initializer_list< std::shared_ptr< IObserver< NonLinearSolverMessages > > >  observers)
inherited
Parameters
observersList of observers to be subscribed.

◆ subscribeAll() [2/2]

void Ikarus::IObservable< NonLinearSolverMessages >::subscribeAll ( std::shared_ptr< IObserver< NonLinearSolverMessages > >  observer)
inherited
Parameters
observerThe observer to be subscribed.

◆ unSubscribe()

void Ikarus::IObservable< MT >::unSubscribe ( NonLinearSolverMessages  message,
std::shared_ptr< IObserver< NonLinearSolverMessages > >  observer 
)
inherited
Parameters
messageThe message type to unsubscribe from.
observerThe observer to be unsubscribed.

◆ unSubscribeAll()

void Ikarus::IObservable< MT >::unSubscribeAll ( std::shared_ptr< IObserver< NonLinearSolverMessages > >  observer)
inherited
Parameters
observerThe observer to be unsubscribed.

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