All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
roboptim::SolverState< P > Class Template Reference

State of the solver. More...

#include <roboptim/core/solver-state.hh>

Inheritance diagram for roboptim::SolverState< P >:

Public Types

typedef P problem_t
 Problem type. More...
 
typedef P::function_t::argument_t argument_t
 Import argument types from problem. More...
 
typedef P::value_type value_type
 Import value type from problem. More...
 
typedef P::function_t function_t
 Import function type from problem. More...
 
typedef std::map< std::string,
StateParameter< function_t > > 
parameters_t
 Map of parameters. More...
 

Public Member Functions

 SolverState (const problem_t &problem)
 Instantiate a solver from a problem. More...
 
virtual ~SolverState ()
 
const argument_tx () const
 Retrieve the current optimization parameters. More...
 
argument_tx ()
 
const boost::optional
< value_type > & 
cost () const
 Retrieve the current cost. More...
 
boost::optional< value_type > & cost ()
 
const boost::optional
< value_type > & 
constraintViolation () const
 Retrieve the current constraint violation. More...
 
boost::optional< value_type > & constraintViolation ()
 
virtual std::ostream & print (std::ostream &) const
 Display the solver state on the specified output stream. More...
 
Parameters
const parameters_tparameters () const
 
parameters_tparameters ()
 
template<typename T >
const T & getParameter (const std::string &key) const
 Get a parameter. More...
 
template<typename T >
T & getParameter (const std::string &key)
 Get a parameter. More...
 

Protected Attributes

argument_t x_
 Current optimization parameters. More...
 
boost::optional< value_typecost_
 Current cost. More...
 
boost::optional< value_typeconstraintViolation_
 Current constraint violation. More...
 
parameters_t parameters_
 Solver state extra parameters (solver-specific parameters etc.). More...
 

Detailed Description

template<typename P>
class roboptim::SolverState< P >

State of the solver.

Template Parameters
Pproblem type.

Member Typedef Documentation

template<typename P>
typedef P::function_t::argument_t roboptim::SolverState< P >::argument_t

Import argument types from problem.

template<typename P>
typedef P::function_t roboptim::SolverState< P >::function_t

Import function type from problem.

template<typename P>
typedef std::map<std::string, StateParameter<function_t> > roboptim::SolverState< P >::parameters_t

Map of parameters.

template<typename P>
typedef P roboptim::SolverState< P >::problem_t

Problem type.

template<typename P>
typedef P::value_type roboptim::SolverState< P >::value_type

Import value type from problem.

Constructor & Destructor Documentation

template<typename P >
roboptim::SolverState< P >::SolverState ( const problem_t problem)
explicit

Instantiate a solver from a problem.

Parameters
problemproblem that should be solved

References roboptim::SolverState< P >::x_.

template<typename P >
roboptim::SolverState< P >::~SolverState ( )
virtual

Member Function Documentation

template<typename P >
const boost::optional< typename SolverState< P >::value_type > & roboptim::SolverState< P >::constraintViolation ( ) const

Retrieve the current constraint violation.

Returns
current constraint violation
template<typename P >
boost::optional< typename SolverState< P >::value_type > & roboptim::SolverState< P >::constraintViolation ( )
template<typename P >
const boost::optional< typename SolverState< P >::value_type > & roboptim::SolverState< P >::cost ( ) const

Retrieve the current cost.

Returns
current cost
template<typename P >
boost::optional< typename SolverState< P >::value_type > & roboptim::SolverState< P >::cost ( )
template<typename P >
template<typename T >
const T & roboptim::SolverState< P >::getParameter ( const std::string &  key) const

Get a parameter.

Template Parameters
Tparameter type.
Parameters
keyparameter key.
Returns
parameter.
Exceptions
std::out_of_range
template<typename P >
template<typename T >
T & roboptim::SolverState< P >::getParameter ( const std::string &  key)

Get a parameter.

Template Parameters
Tparameter type.
Parameters
keyparameter key.
Returns
parameter.
Exceptions
std::out_of_range
template<typename P >
const SolverState< P >::parameters_t & roboptim::SolverState< P >::parameters ( ) const
template<typename P >
SolverState< P >::parameters_t & roboptim::SolverState< P >::parameters ( )
template<typename P >
std::ostream & roboptim::SolverState< P >::print ( std::ostream &  o) const
virtual

Display the solver state on the specified output stream.

Parameters
ooutput stream used for display
Returns
output stream

References roboptim::decindent(), roboptim::iendl(), roboptim::incindent(), and x_.

template<typename P >
const SolverState< P >::argument_t & roboptim::SolverState< P >::x ( ) const

Retrieve the current optimization parameters.

Returns
current optimization parameters

Note: we do not use (const_)argument_ref here since this would return a reference to a local temporary variable when dealing with Eigen::Ref: const Eigen::Ref<const argument_t>&

References x_.

template<typename P >
SolverState< P >::argument_t & roboptim::SolverState< P >::x ( )

References x_.

Member Data Documentation

template<typename P>
boost::optional<value_type> roboptim::SolverState< P >::constraintViolation_
protected

Current constraint violation.

The solver may not provide the constraint violation at each iteration, hence the use of boost::optional.

template<typename P>
boost::optional<value_type> roboptim::SolverState< P >::cost_
protected

Current cost.

The solver may not provide the cost at each iteration, hence the use of boost::optional.

template<typename P>
parameters_t roboptim::SolverState< P >::parameters_
protected

Solver state extra parameters (solver-specific parameters etc.).

template<typename P>
argument_t roboptim::SolverState< P >::x_
protected

Current optimization parameters.

Referenced by roboptim::SolverState< P >::SolverState().