version 0.4.4
Ikarus::TrustRegion< F, preConditioner, UF, IDBCF > Class Template Reference

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

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

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

Public Types

using Settings = TRSettings
 Type of the settings for the TrustRegion solver. More...
 
using FTraits = typename F::Traits
 
using Domain = typename FTraits::Domain
 Type of the parameter vector of. More...
 
using CorrectionType = typename FTraits::template Range< 1 >
 Type of the correction of x += deltaX. More...
 
using UpdateFunction = UF
 Type of the update function. More...
 
using DifferentiableFunction = F
 Type of function to minimize. More...
 
using IDBCForceFunction = IDBCF
 Type representing the force function to handle inhomogeneous Dirichlet BCs. More...
 
using EnergyType = typename FTraits::template Range< 0 >
 Type of the scalar cost. More...
 
using GradientType = typename FTraits::template Range< 1 >
 Type of the gradient vector. More...
 
using HessianType = typename FTraits::template Range< 2 >
 Type of the Hessian matrix. More...
 
using JacobianType = HessianType
 
using State = NonlinearSolverStateType< F >
 
using MessageType = NonLinearSolverMessages
 
using Callback = std::function< void(NonLinearSolverMessages, const State &)>
 
using Token = std::shared_ptr< Callback >
 

Public Member Functions

template<typename UF2 = UF, typename IDBCF2 = IDBCF>
 TrustRegion (const F &f, UF2 &&updateFunction={}, IDBCF2 &&idbcForceFunction={})
 Constructs a TrustRegion solver instance. More...
 
void setup (const Settings &settings)
 Sets up the TrustRegion solver with the provided settings and checks feasibility. More...
 
NonLinearSolverInformation solve (Domain &x, double stepSize=0.0)
 Solves the nonlinear optimization problem using the TrustRegion algorithm. More...
 
auto & energy ()
 Access the energy function. More...
 
const auto & energy () const
 Access the energy function. More...
 
auto residual () const
 Access the residual. More...
 
const UpdateFunctionupdateFunction () const
 Access the update function. More...
 
const IDBCForceFunctionidbcForceFunction () const
 Access the force function calculating internal forces due to inhomogeneous Dirichlet BCs. More...
 
Token registerListener (Callback callback)
 This method is used to register a Listener function. More...
 
void unregisterListener (Token token)
 deregisters a specific function More...
 
void notify (NonLinearSolverMessages message, const State &data)
 This calls all the registered functions. More...
 

Detailed Description

template<typename F, PreConditioner preConditioner, typename UF, typename IDBCF>
class Ikarus::TrustRegion< F, preConditioner, UF, IDBCF >

Refer to [5] for details of the algorithm.

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

Template Parameters
FType of the differentiable function to solve.
preConditionerType of preconditioner to use (default is IncompleteCholesky).
UFType of the update function
IDBCFType of the force function to handle inhomogeneous Dirichlet BCs (defaults to IDBCForceDefault).

Member Typedef Documentation

◆ Callback

using Ikarus::Broadcaster< NonLinearSolverMessages , NonlinearSolverStateType< F > >::Callback = std::function<void(NonLinearSolverMessages , const State&)>
inherited

◆ CorrectionType

template<typename F , PreConditioner preConditioner, typename UF , typename IDBCF >
using Ikarus::TrustRegion< F, preConditioner, UF, IDBCF >::CorrectionType = typename FTraits::template Range<1>

◆ DifferentiableFunction

template<typename F , PreConditioner preConditioner, typename UF , typename IDBCF >
using Ikarus::TrustRegion< F, preConditioner, UF, IDBCF >::DifferentiableFunction = F

◆ Domain

template<typename F , PreConditioner preConditioner, typename UF , typename IDBCF >
using Ikarus::TrustRegion< F, preConditioner, UF, IDBCF >::Domain = typename FTraits::Domain

◆ EnergyType

template<typename F , PreConditioner preConditioner, typename UF , typename IDBCF >
using Ikarus::TrustRegion< F, preConditioner, UF, IDBCF >::EnergyType = typename FTraits::template Range<0>

◆ FTraits

template<typename F , PreConditioner preConditioner, typename UF , typename IDBCF >
using Ikarus::TrustRegion< F, preConditioner, UF, IDBCF >::FTraits = typename F::Traits

◆ GradientType

template<typename F , PreConditioner preConditioner, typename UF , typename IDBCF >
using Ikarus::TrustRegion< F, preConditioner, UF, IDBCF >::GradientType = typename FTraits::template Range<1>

◆ HessianType

template<typename F , PreConditioner preConditioner, typename UF , typename IDBCF >
using Ikarus::TrustRegion< F, preConditioner, UF, IDBCF >::HessianType = typename FTraits::template Range<2>

◆ IDBCForceFunction

template<typename F , PreConditioner preConditioner, typename UF , typename IDBCF >
using Ikarus::TrustRegion< F, preConditioner, UF, IDBCF >::IDBCForceFunction = IDBCF

◆ JacobianType

template<typename F , PreConditioner preConditioner, typename UF , typename IDBCF >
using Ikarus::TrustRegion< F, preConditioner, UF, IDBCF >::JacobianType = HessianType

◆ MessageType

◆ Settings

template<typename F , PreConditioner preConditioner, typename UF , typename IDBCF >
using Ikarus::TrustRegion< F, preConditioner, UF, IDBCF >::Settings = TRSettings

◆ State

using Ikarus::NonlinearSolverBase< F, Args >::State = NonlinearSolverStateType<F>
inherited

◆ Token

using Ikarus::Broadcaster< NonLinearSolverMessages , NonlinearSolverStateType< F > >::Token = std::shared_ptr<Callback>
inherited

◆ UpdateFunction

template<typename F , PreConditioner preConditioner, typename UF , typename IDBCF >
using Ikarus::TrustRegion< F, preConditioner, UF, IDBCF >::UpdateFunction = UF

Constructor & Destructor Documentation

◆ TrustRegion()

template<typename F , PreConditioner preConditioner, typename UF , typename IDBCF >
template<typename UF2 = UF, typename IDBCF2 = IDBCF>
Ikarus::TrustRegion< F, preConditioner, UF, IDBCF >::TrustRegion ( const F &  f,
UF2 &&  updateFunction = {},
IDBCF2 &&  idbcForceFunction = {} 
)
inlineexplicit
Parameters
fFunction to solve.
updateFunctionUpdate function
idbcForceFunctionForce function to handle inhomogeneous Dirichlet BCs (default is IDBCForceDefault).

Member Function Documentation

◆ energy() [1/2]

template<typename F , PreConditioner preConditioner, typename UF , typename IDBCF >
auto & Ikarus::TrustRegion< F, preConditioner, UF, IDBCF >::energy ( )
inline
Returns
Reference to the energy function.

◆ energy() [2/2]

template<typename F , PreConditioner preConditioner, typename UF , typename IDBCF >
const auto & Ikarus::TrustRegion< F, preConditioner, UF, IDBCF >::energy ( ) const
inline
Returns
Reference to the energy function.

◆ idbcForceFunction()

template<typename F , PreConditioner preConditioner, typename UF , typename IDBCF >
const IDBCForceFunction & Ikarus::TrustRegion< F, preConditioner, UF, IDBCF >::idbcForceFunction ( ) const
inline
Returns
Reference to the function.

◆ notify()

void Ikarus::Broadcaster< NonLinearSolverMessages , NonlinearSolverStateType< F > >::notify ( NonLinearSolverMessages  message,
const State data 
)
inlineinherited

◆ registerListener()

Token Ikarus::Broadcaster< NonLinearSolverMessages , NonlinearSolverStateType< F > >::registerListener ( Callback  callback)
inlineinherited

The function that is passed in is first stored in a shared_ptr. After this, the shared_ptr is added to the vector of listener functions, which leads to a implicit conversion to a weak_ptr. The shared_ptr is then returned to the Listener that has called this function to be stored in a vector of shared_ptr<void> listener.hh.

Parameters
callbackthe callback function
Returns
Token

◆ residual()

template<typename F , PreConditioner preConditioner, typename UF , typename IDBCF >
auto Ikarus::TrustRegion< F, preConditioner, UF, IDBCF >::residual ( ) const
inline
Returns
The residual by value.

◆ setup()

template<typename F , PreConditioner preConditioner, typename UF , typename IDBCF >
void Ikarus::TrustRegion< F, preConditioner, UF, IDBCF >::setup ( const Settings settings)
inline
Parameters
p_settingsTrustRegionSettings containing the solver configuration.

◆ solve()

template<typename F , PreConditioner preConditioner, typename UF , typename IDBCF >
NonLinearSolverInformation Ikarus::TrustRegion< F, preConditioner, UF, IDBCF >::solve ( Domain x,
double  stepSize = 0.0 
)
inline
Parameters
xthe solution.
stepSizethe step size of the control routine (defaults to 0.0)
Returns
NonLinearSolverInformation containing information about the solver result.

◆ unregisterListener()

void Ikarus::Broadcaster< NonLinearSolverMessages , NonlinearSolverStateType< F > >::unregisterListener ( Token  token)
inlineinherited

◆ updateFunction()

template<typename F , PreConditioner preConditioner, typename UF , typename IDBCF >
const UpdateFunction & Ikarus::TrustRegion< F, preConditioner, UF, IDBCF >::updateFunction ( ) const
inline
Returns
Reference to the function.

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