Loading...
Searching...
No Matches
Optimization problems

Optimization problem without constraints. More...

Classes

class  roboptim::Problem< F, boost::mpl::vector<> >
class  roboptim::Problem< F, CLIST >
class  roboptim::ResultWithWarnings
 Represents the solution of an optimization problem when errors occurred during the solving process. More...
class  roboptim::Result
 Represents the solution of an optimization problem. More...
class  roboptim::SolverError
 Base exception class for solving errors. More...
class  roboptim::SolverFactory< T >
 Define a solver factory that instanciate the plug-ins. More...
struct  roboptim::StateParameter< F >
 Solver state parameters type. More...
class  roboptim::SolverState< P >
 State of the solver. More...
class  roboptim::SolverWarning
 Exception used for non-critical errors during optimization. More...
struct  roboptim::Parameter
 Solver parameter type. More...
class  roboptim::Solver< F, C >
 Solver for a specific problem class. More...

Typedefs

typedef boost::mpl::vector roboptim::Problem< F, boost::mpl::vector<> >::constraintsList_t
typedef F roboptim::Problem< F, boost::mpl::vector<> >::function_t
 Function type.
typedef function_t::value_type roboptim::Problem< F, boost::mpl::vector<> >::value_type
typedef function_t::vector_t roboptim::Problem< F, boost::mpl::vector<> >::vector_t
 Vector type.
typedef function_t::argument_t roboptim::Problem< F, boost::mpl::vector<> >::argument_t
 Argument type.
typedef function_t::size_type roboptim::Problem< F, boost::mpl::vector<> >::size_type
 Size type.
typedef boost::optional< argument_troboptim::Problem< F, boost::mpl::vector<> >::startingPoint_t
 Optional vector defines a starting point.
typedef function_t::interval_t roboptim::Problem< F, boost::mpl::vector<> >::interval_t
typedef function_t::intervals_t roboptim::Problem< F, boost::mpl::vector<> >::intervals_t
typedef std::vector< value_typeroboptim::Problem< F, boost::mpl::vector<> >::scaling_t
 Scaling vector.
typedef scaling_t scales_t roboptim::Problem< F, boost::mpl::vector<> >::ROBOPTIM_CORE_DEPRECATED
 Scaling vector (deprecated typedef).
typedef function_t::names_t roboptim::Problem< F, boost::mpl::vector<> >::names_t
 Vector of names (e.g. for arguments).
typedef detail::list_converter< CLIST >::type roboptim::Problem< F, CLIST >::constraintsList_t
 Constraints types list.
typedef F roboptim::Problem< F, CLIST >::function_t
 Function type.
typedef detail::shared_ptr_variant< constraintsList_t >::type roboptim::Problem< F, CLIST >::constraint_t
 Constraint's type.
typedef function_t::value_type roboptim::Problem< F, CLIST >::value_type
 Import function's value_type type.
typedef function_t::vector_t roboptim::Problem< F, CLIST >::vector_t
 Vector type.
typedef function_t::argument_t roboptim::Problem< F, CLIST >::argument_t
 Argument type.
typedef function_t::size_type roboptim::Problem< F, CLIST >::size_type
 Size type.
typedef std::vector< constraint_troboptim::Problem< F, CLIST >::constraints_t
 Constraints are represented as a vector of constraints.
typedef boost::optional< argument_troboptim::Problem< F, CLIST >::startingPoint_t
 Optional vector defines a starting point.
typedef function_t::interval_t roboptim::Problem< F, CLIST >::interval_t
 Interval type (e.g. for bounds).
typedef function_t::intervals_t roboptim::Problem< F, CLIST >::intervals_t
 Intervals type.
typedef std::vector< value_typeroboptim::Problem< F, CLIST >::scaling_t
 Scaling vector.
typedef scaling_t scales_t roboptim::Problem< F, CLIST >::ROBOPTIM_CORE_DEPRECATED
 Scaling vector (deprecated typedef).
typedef function_t::names_t roboptim::Problem< F, CLIST >::names_t
 Vector of names (e.g. for arguments).
typedef std::vector< intervals_troboptim::Problem< F, CLIST >::intervalsVect_t
 Vector of interval vectors.
typedef std::vector< scaling_troboptim::Problem< F, CLIST >::scalingVect_t
 Vector of scaling vectors.
typedef scalingVect_t scalesVect_t roboptim::Problem< F, CLIST >::ROBOPTIM_CORE_DEPRECATED
 Vector of scaling vectors (deprecated typedef).
typedef F::value_type roboptim::StateParameter< F >::value_type
typedef F::vector_t roboptim::StateParameter< F >::vector_t
typedef boost::variant< value_type, vector_t, int, std::string, bool > roboptim::StateParameter< F >::stateParameterValues_t
 Allowed types for parameters:
typedef P roboptim::SolverState< P >::problem_t
 Problem type.
typedef P::function_t::argument_t roboptim::SolverState< P >::argument_t
 Import argument types from problem.
typedef P::value_type roboptim::SolverState< P >::value_type
 Import value type from problem.
typedef P::function_t roboptim::SolverState< P >::function_t
 Import function type from problem.
typedef std::map< std::string, StateParameter< function_t > > roboptim::SolverState< P >::parameters_t
 Map of parameters.
typedef Function::value_type roboptim::Parameter::value_type
typedef Function::vector_t roboptim::Parameter::vector_t
typedef boost::variant< value_type, vector_t, int, std::string, bool > roboptim::Parameter::parameterValues_t
 Allowed types for solver parameters:
typedef Problem< F, C > roboptim::Solver< F, C >::problem_t
 Solver problem type.
typedef F::vector_t roboptim::Solver< F, C >::vector_t
 Import vector type from cost function.
typedef std::map< std::string, Parameterroboptim::Solver< F, C >::parameters_t
 Map of parameters.
typedef SolverState< problem_troboptim::Solver< F, C >::solverState_t
 State of the solver.
typedef boost::function< void(const problem_t &problem, solverState_t &state)> roboptim::Solver< F, C >::callback_t
 Per-iteration callback type.

Functions

std::ostream & roboptim::Problem< F, boost::mpl::vector<> >::print (std::ostream &o) const
 Display the problem on the specified output stream.
std::ostream & roboptim::Problem< F, CLIST >::print (std::ostream &o) const
 Display the problem on the specified output stream.
template<typename F>
std::ostream & roboptim::operator<< (std::ostream &o, const Problem< F, boost::mpl::vector<> > &pb)
 Override operator<< to handle problem display.
template<typename F, typename CLIST>
std::ostream & roboptim::operator<< (std::ostream &o, const Problem< F, CLIST > &pb)
 Override operator<< to handle problem display.
virtual std::ostream & roboptim::StateParameter< F >::print (std::ostream &) const
 Display the solver parameter on the specified output stream.
virtual roboptim::StateParameter< F >::~StateParameter ()
 Virtual destructor.
 roboptim::SolverState< P >::SolverState (const problem_t &problem)
 Instantiate a solver from a problem.
virtual roboptim::SolverState< P >::~SolverState ()
const argument_troboptim::SolverState< P >::x () const
 Retrieve the current optimization parameters.
argument_troboptim::SolverState< P >::x ()
const boost::optional< value_type > & roboptim::SolverState< P >::cost () const
 Retrieve the current cost.
boost::optional< value_type > & roboptim::SolverState< P >::cost ()
const boost::optional< value_type > & roboptim::SolverState< P >::constraintViolation () const
 Retrieve the current constraint violation.
boost::optional< value_type > & roboptim::SolverState< P >::constraintViolation ()
virtual std::ostream & roboptim::SolverState< P >::print (std::ostream &) const
 Display the solver state on the specified output stream.
ROBOPTIM_DLLAPI roboptim::Parameter::Parameter ()
 Default constructor.
 roboptim::Solver< F, C >::Solver (const problem_t &problem)
 Instantiate a solver from a problem.
template<typename F_, typename C_>
 roboptim::Solver< F, C >::Solver (const Problem< F_, C_ > &problem)
 Instantiate a solver from a problem in a different problem class.
virtual roboptim::Solver< F, C >::~Solver ()
const problem_troboptim::Solver< F, C >::problem () const
 Retrieve the problem.
virtual void roboptim::Solver< F, C >::setIterationCallback (callback_t)
 Set the per-iteration callback.
virtual std::ostream & roboptim::Solver< F, C >::print (std::ostream &) const
 Display the solver on the specified output stream.

Variables

std::string roboptim::StateParameter< F >::description
 Parameter description (for humans).
stateParameterValues_t roboptim::StateParameter< F >::value
 Value.
argument_t roboptim::SolverState< P >::x_
 Current optimization parameters.
boost::optional< value_typeroboptim::SolverState< P >::cost_
 Current cost.
boost::optional< value_typeroboptim::SolverState< P >::constraintViolation_
 Current constraint violation.
parameters_t roboptim::SolverState< P >::parameters_
 Solver state extra parameters (solver-specific parameters etc.).
std::string roboptim::Parameter::description
 Parameter description (for humans).
parameterValues_t roboptim::Parameter::value
 Value.
const problem_t roboptim::Solver< F, C >::problem_
 Problem that will be solved.
parameters_t roboptim::Solver< F, C >::parameters_
 Solver parameters (run-time configuration).
std::string roboptim::Solver< F, C >::plugin_name_
 Plugin name.
static log4cxx::LoggerPtr roboptim::Solver< F, C >::logger
 Pointer to function logger (see log4cxx documentation).

Friends

template<typename F_, typename CLIST_>
class roboptim::Problem< F, boost::mpl::vector<> >::Problem
template<typename F_, typename CLIST_>
class roboptim::Problem< F, CLIST >::Problem

Constructors and destructors.

 roboptim::Problem< F, boost::mpl::vector<> >::Problem (const function_t &)
 roboptim::Problem< F, boost::mpl::vector<> >::Problem (const Problem< F, boost::mpl::vector<> > &)
 Copy constructor.
template<typename F_>
 roboptim::Problem< F, boost::mpl::vector<> >::Problem (const Problem< F_, boost::mpl::vector<> > &)
 Copy constructor (convert from another class of problem).
virtual roboptim::Problem< F, boost::mpl::vector<> >::~Problem ()
 Virtual destructor.

Cost function.

const function_troboptim::Problem< F, boost::mpl::vector<> >::function () const
 Retrieve cost function.
intervals_troboptim::Problem< F, boost::mpl::vector<> >::argumentBounds ()
 Retrieve arguments bounds.
const intervals_troboptim::Problem< F, boost::mpl::vector<> >::argumentBounds () const
 Retrieve arguments bounds.
scaling_troboptim::Problem< F, boost::mpl::vector<> >::argumentScaling ()
 Retrieve arguments scaling.
const scaling_troboptim::Problem< F, boost::mpl::vector<> >::argumentScaling () const
 Retrieve arguments scaling.
scales_t & roboptim::Problem< F, boost::mpl::vector<> >::argumentScales () ROBOPTIM_CORE_DEPRECATED
 Retrieve arguments scaling (deprecated version).
const scales_t & roboptim::Problem< F, boost::mpl::vector<> >::argumentScales () const ROBOPTIM_CORE_DEPRECATED
 Retrieve arguments scaling (deprecated version).
names_troboptim::Problem< F, boost::mpl::vector<> >::argumentNames ()
 Retrieve arguments names.
const names_troboptim::Problem< F, boost::mpl::vector<> >::argumentNames () const
 Retrieve arguments names.

Starting point (initial guess).

startingPoint_troboptim::Problem< F, boost::mpl::vector<> >::startingPoint ()
 Set the initial guess.
const startingPoint_troboptim::Problem< F, boost::mpl::vector<> >::startingPoint () const
 Get the initial guess.

Constructors and destructors.

 roboptim::Problem< F, CLIST >::Problem (const function_t &cost)
 roboptim::Problem< F, CLIST >::Problem (const Problem< F, CLIST > &pb)
 Copy constructor.
template<typename F_, typename CLIST_>
 roboptim::Problem< F, CLIST >::Problem (const Problem< F_, CLIST_ > &pb)
 Copy constructor (convert from another class of problem).
virtual roboptim::Problem< F, CLIST >::~Problem ()
 Virtual destructor.

Cost function.

const function_troboptim::Problem< F, CLIST >::function () const
 Retrieve cost function.
intervals_troboptim::Problem< F, CLIST >::argumentBounds ()
 Retrieve arguments bounds.
const intervals_troboptim::Problem< F, CLIST >::argumentBounds () const
 Retrieve arguments bounds.
scaling_troboptim::Problem< F, CLIST >::argumentScaling ()
 Retrieve arguments scaling.
const scaling_troboptim::Problem< F, CLIST >::argumentScaling () const
 Retrieve arguments scaling.
scales_t & roboptim::Problem< F, CLIST >::argumentScales () ROBOPTIM_CORE_DEPRECATED
 Retrieve arguments scaling (deprecated version).
const scales_t & roboptim::Problem< F, CLIST >::argumentScales () const ROBOPTIM_CORE_DEPRECATED
 Retrieve arguments scaling (deprecated version).
names_troboptim::Problem< F, CLIST >::argumentNames ()
 Retrieve arguments names.
const names_troboptim::Problem< F, CLIST >::argumentNames () const
 Retrieve arguments names.

Constraints.

const constraints_troboptim::Problem< F, CLIST >::constraints () const
 Retrieve constraints.
template<typename C>
void roboptim::Problem< F, CLIST >::addConstraint (boost::shared_ptr< C > constraint, interval_t interval, value_type scale=1.)
 Add a constraint to the problem.
template<typename C>
void roboptim::Problem< F, CLIST >::addConstraint (boost::shared_ptr< C > constraint, intervals_t intervals, scaling_t scaling)
 Add a constraint to the problem.
const intervalsVect_troboptim::Problem< F, CLIST >::boundsVector () const
 Retrieve constraints bounds vector.
const scalingVect_troboptim::Problem< F, CLIST >::scalingVector () const
 Retrieve constraints scaling vector.
const scalesVect_t & roboptim::Problem< F, CLIST >::scalesVector () const ROBOPTIM_CORE_DEPRECATED
 Retrieve constraints scaling vector (deprecated version).

Starting point (initial guess).

startingPoint_troboptim::Problem< F, CLIST >::startingPoint ()
 Set the initial guess.
const startingPoint_troboptim::Problem< F, CLIST >::startingPoint () const
 Get the initial guess.

Parameters

const parameters_troboptim::SolverState< P >::parameters () const
parameters_troboptim::SolverState< P >::parameters ()
template<typename T>
const T & roboptim::SolverState< P >::getParameter (const std::string &key) const
 Get a parameter.
template<typename T>
T & roboptim::SolverState< P >::getParameter (const std::string &key)
 Get a parameter.

Parameters

const parameters_troboptim::Solver< F, C >::parameters () const
parameters_troboptim::Solver< F, C >::parameters ()
template<typename T>
const T & roboptim::Solver< F, C >::getParameter (const std::string &key) const

Plugin name

const std::string & roboptim::Solver< F, C >::pluginName () const
std::string & roboptim::Solver< F, C >::pluginName ()

Detailed Description

Optimization problem without constraints.

Optimization problem.

An optimization problem is defined as:

  • a cost function ( $\mathbb{R}^n \rightarrow \mathbb{R}$)
  • a set of intervals and scale factors for arguments.

The goal of the optimization process is finding a point which minimizes the cost function

To use the class, one has to instantiate a problem with a reference to a cost function. method: a reference to a function and an interval is needed.

The cost function is immutable.

Unlike other classes which just copy functions, pointers are used here in order to allow sub-classes of constraints to be inserted in the problem. For instance, a twice derivable function can be inserted in a problem which expects a derivable function.

Template Parameters
Ffunction type

An optimization problem is defined as:

  • a cost function ( $\mathbb{R}^n \rightarrow \mathbb{R}$)
  • one or more constraints functions, ( $\mathbb{R}^n \rightarrow \mathbb{R}^m$) associated with an interval and a scale,
  • a set of intervals and scale factors for arguments.

The goal of the optimization process is finding a point which minimizes the cost function and which respects the constraints (i.e. the result of some functions is inside of specific interval).

To use the class, one has to instantiate a problem with a reference to a cost function. Then, constraints can be added through the addConstraint method: a reference to a function and an interval is needed.

The cost function is immutable.

Constraints are stored as a Boost.Variant of smart pointers (i.e. more precisely using a boost::shared_ptr) representing all the different possibles constraint types.

It is recommended to add a constraint using the following syntax:

problem.addConstraint<C> (boost::make_shared<MyFunction> (...), ...);

where C is the constraint type and MyFunction the function type.

Unlike other classes which just copy functions, pointers are used here in order to allow sub-classes of constraints to be inserted in the problem. For instance, a twice-differentiable function can be inserted in a problem which expects a differentiable function.

Template Parameters
Ffunction type
CLISTtype list satisfying MPL's sequence concept

Typedef Documentation

◆ argument_t [1/3]

template<typename F, typename CLIST>
typedef function_t::argument_t roboptim::Problem< F, CLIST >::argument_t

Argument type.

◆ argument_t [2/3]

template<typename F>
typedef function_t::argument_t roboptim::Problem< F, boost::mpl::vector<> >::argument_t

Argument type.

◆ argument_t [3/3]

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

Import argument types from problem.

◆ callback_t

template<typename F, typename C>
typedef boost::function<void (const problem_t& problem, solverState_t& state)> roboptim::Solver< F, C >::callback_t

Per-iteration callback type.

Callback parameters:

  • problem is a (constant) reference to the problem
  • state is the current state of the optimization solver. It can be modified by the callback, and updated values can be used by the solver to determine what to do next.

◆ constraint_t

template<typename F, typename CLIST>
typedef detail::shared_ptr_variant<constraintsList_t>::type roboptim::Problem< F, CLIST >::constraint_t

Constraint's type.

Generate a Boost.Variant of shared pointers from the static constraints types list.

◆ constraints_t

template<typename F, typename CLIST>
typedef std::vector<constraint_t> roboptim::Problem< F, CLIST >::constraints_t

Constraints are represented as a vector of constraints.

◆ constraintsList_t [1/2]

template<typename F, typename CLIST>
typedef detail::list_converter<CLIST>::type roboptim::Problem< F, CLIST >::constraintsList_t

Constraints types list.

CLIST is converted to a boost::mpl::vector to ensure a similar behavior for codes using different random access sequences (vector, list, etc.).

◆ constraintsList_t [2/2]

template<typename F>
typedef boost::mpl::vector roboptim::Problem< F, boost::mpl::vector<> >::constraintsList_t

◆ function_t [1/3]

template<typename F, typename CLIST>
typedef F roboptim::Problem< F, CLIST >::function_t

Function type.

This has to be either Function or one of its sub-classes.

◆ function_t [2/3]

template<typename F>
typedef F roboptim::Problem< F, boost::mpl::vector<> >::function_t

Function type.

This has to be either Function or one of its sub-classes.

◆ function_t [3/3]

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

Import function type from problem.

◆ interval_t [1/2]

template<typename F, typename CLIST>
typedef function_t::interval_t roboptim::Problem< F, CLIST >::interval_t

Interval type (e.g. for bounds).

◆ interval_t [2/2]

template<typename F>
typedef function_t::interval_t roboptim::Problem< F, boost::mpl::vector<> >::interval_t

◆ intervals_t [1/2]

template<typename F, typename CLIST>
typedef function_t::intervals_t roboptim::Problem< F, CLIST >::intervals_t

Intervals type.

◆ intervals_t [2/2]

template<typename F>
typedef function_t::intervals_t roboptim::Problem< F, boost::mpl::vector<> >::intervals_t

◆ intervalsVect_t

template<typename F, typename CLIST>
typedef std::vector<intervals_t> roboptim::Problem< F, CLIST >::intervalsVect_t

Vector of interval vectors.

This type is used to take into account the fact that constraints can have output values in $\mathbb{C}^{m}$.

If $m=1$, then the associated interval vector contains only one element of interval_t type.

◆ names_t [1/2]

template<typename F, typename CLIST>
typedef function_t::names_t roboptim::Problem< F, CLIST >::names_t

Vector of names (e.g. for arguments).

◆ names_t [2/2]

template<typename F>
typedef function_t::names_t roboptim::Problem< F, boost::mpl::vector<> >::names_t

Vector of names (e.g. for arguments).

◆ parameters_t [1/2]

template<typename F, typename C>
typedef std::map<std::string, Parameter> roboptim::Solver< F, C >::parameters_t

Map of parameters.

◆ parameters_t [2/2]

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

Map of parameters.

◆ parameterValues_t

typedef boost::variant<value_type, vector_t, int, std::string, bool> roboptim::Parameter::parameterValues_t

Allowed types for solver parameters:

  • value (double)
  • vector (of double)
  • integer
  • string
  • bool

◆ problem_t [1/2]

template<typename F, typename C>
typedef Problem<F, C> roboptim::Solver< F, C >::problem_t

Solver problem type.

The solver can solve problems of this type. If another kind of problem is given, a conversion will be required.

◆ problem_t [2/2]

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

Problem type.

◆ ROBOPTIM_CORE_DEPRECATED [1/3]

template<typename F, typename CLIST>
typedef scalingVect_t scalesVect_t roboptim::Problem< F, CLIST >::ROBOPTIM_CORE_DEPRECATED

Vector of scaling vectors (deprecated typedef).

◆ ROBOPTIM_CORE_DEPRECATED [2/3]

template<typename F, typename CLIST>
typedef scaling_t scales_t roboptim::Problem< F, CLIST >::ROBOPTIM_CORE_DEPRECATED

Scaling vector (deprecated typedef).

◆ ROBOPTIM_CORE_DEPRECATED [3/3]

template<typename F>
typedef scaling_t scales_t roboptim::Problem< F, boost::mpl::vector<> >::ROBOPTIM_CORE_DEPRECATED

Scaling vector (deprecated typedef).

◆ scaling_t [1/2]

template<typename F, typename CLIST>
typedef std::vector<value_type> roboptim::Problem< F, CLIST >::scaling_t

Scaling vector.

◆ scaling_t [2/2]

template<typename F>
typedef std::vector<value_type> roboptim::Problem< F, boost::mpl::vector<> >::scaling_t

Scaling vector.

◆ scalingVect_t

template<typename F, typename CLIST>
typedef std::vector<scaling_t> roboptim::Problem< F, CLIST >::scalingVect_t

Vector of scaling vectors.

This type is used to take into account the fact that constraints can have output values in $\mathbb{R}^m$.

If $m=1$, then the associated scaling vector contains only one element of scaling_t type.

◆ size_type [1/2]

template<typename F, typename CLIST>
typedef function_t::size_type roboptim::Problem< F, CLIST >::size_type

Size type.

◆ size_type [2/2]

template<typename F>
typedef function_t::size_type roboptim::Problem< F, boost::mpl::vector<> >::size_type

Size type.

◆ solverState_t

template<typename F, typename C>
typedef SolverState<problem_t> roboptim::Solver< F, C >::solverState_t

State of the solver.

◆ startingPoint_t [1/2]

template<typename F, typename CLIST>
typedef boost::optional<argument_t> roboptim::Problem< F, CLIST >::startingPoint_t

Optional vector defines a starting point.

◆ startingPoint_t [2/2]

template<typename F>
typedef boost::optional<argument_t> roboptim::Problem< F, boost::mpl::vector<> >::startingPoint_t

Optional vector defines a starting point.

◆ stateParameterValues_t

template<typename F>
typedef boost::variant<value_type, vector_t, int, std::string, bool> roboptim::StateParameter< F >::stateParameterValues_t

Allowed types for parameters:

  • value (e.g. constraint violation)
  • vector (e.g. current x)
  • integer (e.g. current iteration)
  • string (e.g. warning message from the solver)
  • bool (e.g. whether to stop the optimization)

◆ value_type [1/5]

◆ value_type [2/5]

template<typename F, typename CLIST>
typedef function_t::value_type roboptim::Problem< F, CLIST >::value_type

Import function's value_type type.

◆ value_type [3/5]

template<typename F>
typedef function_t::value_type roboptim::Problem< F, boost::mpl::vector<> >::value_type

◆ value_type [4/5]

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

Import value type from problem.

◆ value_type [5/5]

template<typename F>
typedef F::value_type roboptim::StateParameter< F >::value_type

◆ vector_t [1/5]

typedef Function::vector_t roboptim::Parameter::vector_t

◆ vector_t [2/5]

template<typename F, typename CLIST>
typedef function_t::vector_t roboptim::Problem< F, CLIST >::vector_t

Vector type.

◆ vector_t [3/5]

template<typename F>
typedef function_t::vector_t roboptim::Problem< F, boost::mpl::vector<> >::vector_t

Vector type.

◆ vector_t [4/5]

template<typename F, typename C>
typedef F::vector_t roboptim::Solver< F, C >::vector_t

Import vector type from cost function.

◆ vector_t [5/5]

template<typename F>
typedef F::vector_t roboptim::StateParameter< F >::vector_t

Function Documentation

◆ addConstraint() [1/2]

template<typename F, typename CLIST>
template<typename C>
void roboptim::Problem< F, CLIST >::addConstraint ( boost::shared_ptr< C > constraint,
interval_t interval,
value_type scale = 1. )

Add a constraint to the problem.

Useful only when $m=1$, use addConstraint (boost::shared_ptr<C> constraint, intervals_t intervals, scaling_t scaling) instead.

Parameters
constraintthe constraint that will be added
intervalinterval in which the constraint is satisfied
scaleconstraint scale
Template Parameters
Cconstraint type (has to be in CLIST)
Exceptions
std::runtime_error

References ASSERT_CONSTRAINT_TYPE.

◆ addConstraint() [2/2]

template<typename F, typename CLIST>
template<typename C>
void roboptim::Problem< F, CLIST >::addConstraint ( boost::shared_ptr< C > constraint,
intervals_t intervals,
scaling_t scaling )

Add a constraint to the problem.

The constraint can be multidimensional.

Parameters
constraintthe constraint that will be added
intervalsinterval vector in which the constraint is satisfied
scalingconstraint scaling
Template Parameters
Cconstraint type (has to be in CLIST)
Exceptions
std::runtime_error

References ASSERT_CONSTRAINT_TYPE, function(), and ROBOPTIM_DEBUG_ONLY.

◆ argumentBounds() [1/4]

template<typename F, typename CLIST>
Problem< F, CLIST >::intervals_t & roboptim::Problem< F, CLIST >::argumentBounds ( )

Retrieve arguments bounds.

Arguments bounds define in which interval each argument is valid.

Returns
arguments bounds

Referenced by print().

◆ argumentBounds() [2/4]

template<typename F, typename CLIST>
const Problem< F, CLIST >::intervals_t & roboptim::Problem< F, CLIST >::argumentBounds ( ) const

Retrieve arguments bounds.

Arguments bounds define in which interval each argument is valid.

Returns
arguments bounds

◆ argumentBounds() [3/4]

template<typename F>
Problem< F, boost::mpl::vector<> >::intervals_t & roboptim::Problem< F, boost::mpl::vector<> >::argumentBounds ( )

Retrieve arguments bounds.

Arguments bounds define in which interval each argument is valid.

Returns
arguments bounds

References argumentBounds(), and Problem.

Referenced by argumentBounds(), argumentBounds(), and print().

◆ argumentBounds() [4/4]

template<typename F>
const Problem< F, boost::mpl::vector<> >::intervals_t & roboptim::Problem< F, boost::mpl::vector<> >::argumentBounds ( ) const

Retrieve arguments bounds.

Arguments bounds define in which interval each argument is valid.

Returns
arguments bounds

References argumentBounds(), and Problem.

◆ argumentNames() [1/4]

template<typename F, typename CLIST>
Problem< F, CLIST >::names_t & roboptim::Problem< F, CLIST >::argumentNames ( )

Retrieve arguments names.

Arguments names define a name for each argument. This is particularly useful when logging data.

Returns
arguments names

Referenced by print().

◆ argumentNames() [2/4]

template<typename F, typename CLIST>
const Problem< F, CLIST >::names_t & roboptim::Problem< F, CLIST >::argumentNames ( ) const

Retrieve arguments names.

Arguments names define a name for each argument. This is particularly useful when logging data.

Returns
arguments names

◆ argumentNames() [3/4]

template<typename F>
Problem< F, boost::mpl::vector<> >::names_t & roboptim::Problem< F, boost::mpl::vector<> >::argumentNames ( )

Retrieve arguments names.

Arguments names define a name for each argument. This is particularly useful when logging data. Note: memory is not allocated by default since this is optional.

Returns
arguments names

References argumentNames(), and Problem.

Referenced by argumentNames(), argumentNames(), and print().

◆ argumentNames() [4/4]

template<typename F>
const Problem< F, boost::mpl::vector<> >::names_t & roboptim::Problem< F, boost::mpl::vector<> >::argumentNames ( ) const

Retrieve arguments names.

Arguments names define a name for each argument. This is particularly useful when logging data. Note: memory is not allocated by default since this is optional.

Returns
arguments names

References argumentNames(), and Problem.

◆ argumentScales() [1/4]

template<typename F, typename CLIST>
const Problem< F, CLIST >::scales_t & roboptim::Problem< F, CLIST >::argumentScales ( ) const

Retrieve arguments scaling (deprecated version).

References argumentScaling().

◆ argumentScales() [2/4]

template<typename F, typename CLIST>
Problem< F, CLIST >::scales_t & roboptim::Problem< F, CLIST >::argumentScales ( )

Retrieve arguments scaling (deprecated version).

References argumentScaling().

◆ argumentScales() [3/4]

template<typename F>
const Problem< F, boost::mpl::vector<> >::scales_t & roboptim::Problem< F, boost::mpl::vector<> >::argumentScales ( ) const

Retrieve arguments scaling (deprecated version).

References argumentScales(), argumentScaling(), and Problem.

◆ argumentScales() [4/4]

template<typename F>
Problem< F, boost::mpl::vector<> >::scales_t & roboptim::Problem< F, boost::mpl::vector<> >::argumentScales ( )

Retrieve arguments scaling (deprecated version).

References argumentScales(), argumentScaling(), and Problem.

Referenced by argumentScales(), and argumentScales().

◆ argumentScaling() [1/4]

template<typename F, typename CLIST>
Problem< F, CLIST >::scaling_t & roboptim::Problem< F, CLIST >::argumentScaling ( )

Retrieve arguments scaling.

Arguments scaling define which scale factor is applied for each argument.

Returns
arguments scaling

Referenced by argumentScales(), argumentScales(), and print().

◆ argumentScaling() [2/4]

template<typename F, typename CLIST>
const Problem< F, CLIST >::scaling_t & roboptim::Problem< F, CLIST >::argumentScaling ( ) const

Retrieve arguments scaling.

Arguments scaling define which scale factor is applied for each argument.

Returns
arguments scaling

◆ argumentScaling() [3/4]

template<typename F>
Problem< F, boost::mpl::vector<> >::scaling_t & roboptim::Problem< F, boost::mpl::vector<> >::argumentScaling ( )

Retrieve arguments scaling.

Arguments scaling define which scale factor is applied for each argument.

Returns
arguments scaling

References argumentScaling(), and Problem.

Referenced by argumentScales(), argumentScales(), argumentScaling(), argumentScaling(), and print().

◆ argumentScaling() [4/4]

template<typename F>
const Problem< F, boost::mpl::vector<> >::scaling_t & roboptim::Problem< F, boost::mpl::vector<> >::argumentScaling ( ) const

Retrieve arguments scaling.

Arguments scaling define which scale factor is applied for each argument.

Returns
arguments scaling

References argumentScaling(), and Problem.

◆ boundsVector()

template<typename F, typename CLIST>
const Problem< F, CLIST >::intervalsVect_t & roboptim::Problem< F, CLIST >::boundsVector ( ) const

Retrieve constraints bounds vector.

Returns
constraints bounds vector

◆ constraints()

template<typename F, typename CLIST>
const Problem< F, CLIST >::constraints_t & roboptim::Problem< F, CLIST >::constraints ( ) const

Retrieve constraints.

Returns
constraints

Referenced by print().

◆ constraintViolation() [1/2]

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

References constraintViolation_.

◆ constraintViolation() [2/2]

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

References constraintViolation_.

◆ cost() [1/2]

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

References cost_.

◆ cost() [2/2]

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

Retrieve the current cost.

Returns
current cost

References cost_.

◆ function() [1/2]

template<typename F, typename CLIST>
const Problem< F, CLIST >::function_t & roboptim::Problem< F, CLIST >::function ( ) const

Retrieve cost function.

Returns
cost function

Referenced by addConstraint(), and print().

◆ function() [2/2]

template<typename F>
const Problem< F, boost::mpl::vector<> >::function_t & roboptim::Problem< F, boost::mpl::vector<> >::function ( ) const

Retrieve cost function.

Returns
cost function

References function(), and Problem.

Referenced by function(), and print().

◆ getParameter() [1/3]

template<typename F, typename C>
template<typename T>
const T & roboptim::Solver< F, C >::getParameter ( const std::string & key) const

References parameters_.

◆ getParameter() [2/3]

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

References parameters_.

◆ getParameter() [3/3]

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

References parameters_.

◆ operator<<() [1/2]

template<typename F>
std::ostream & roboptim::operator<< ( std::ostream & o,
const Problem< F, boost::mpl::vector<> > & pb )

Override operator<< to handle problem display.

Parameters
ooutput stream used for display
pbproblem to be displayed
Returns
output stream

◆ operator<<() [2/2]

template<typename F, typename CLIST>
std::ostream & roboptim::operator<< ( std::ostream & o,
const Problem< F, CLIST > & pb )

Override operator<< to handle problem display.

Parameters
ooutput stream used for display
pbproblem to be displayed
Returns
output stream

References roboptim::Problem< F, CLIST >::print().

◆ Parameter()

roboptim::Parameter::Parameter ( )

Default constructor.

References description, and value.

◆ parameters() [1/4]

template<typename F, typename C>
Solver< F, C >::parameters_t & roboptim::Solver< F, C >::parameters ( )

References parameters_.

◆ parameters() [2/4]

template<typename F, typename C>
const Solver< F, C >::parameters_t & roboptim::Solver< F, C >::parameters ( ) const

References parameters_.

◆ parameters() [3/4]

template<typename P>
SolverState< P >::parameters_t & roboptim::SolverState< P >::parameters ( )

References parameters_.

◆ parameters() [4/4]

template<typename P>
const SolverState< P >::parameters_t & roboptim::SolverState< P >::parameters ( ) const

References parameters_.

◆ pluginName() [1/2]

template<typename F, typename C>
std::string & roboptim::Solver< F, C >::pluginName ( )

References plugin_name_.

◆ pluginName() [2/2]

template<typename F, typename C>
const std::string & roboptim::Solver< F, C >::pluginName ( ) const

References plugin_name_.

◆ print() [1/5]

template<typename F, typename CLIST>
std::ostream & roboptim::Problem< F, CLIST >::print ( std::ostream & o) const

Display the problem on the specified output stream.

Parameters
ooutput stream used for display
Returns
output stream

References argumentBounds(), argumentNames(), argumentScaling(), constraints(), roboptim::decindent(), roboptim::fg::fail(), function(), roboptim::iendl(), roboptim::incendl(), roboptim::fg::ok(), roboptim::fg::reset(), and roboptim::fg::warn().

Referenced by roboptim::operator<<().

◆ print() [2/5]

template<typename F>
std::ostream & roboptim::Problem< F, boost::mpl::vector<> >::print ( std::ostream & o) const

Display the problem on the specified output stream.

Parameters
ooutput stream used for display
Returns
output stream

References argumentBounds(), argumentNames(), argumentScaling(), roboptim::decindent(), roboptim::fg::fail(), function(), roboptim::iendl(), roboptim::incendl(), roboptim::fg::ok(), Problem, roboptim::fg::reset(), and roboptim::fg::warn().

◆ print() [3/5]

template<typename F, typename C>
std::ostream & roboptim::Solver< F, C >::print ( std::ostream & o) const
virtual

Display the solver on the specified output stream.

Parameters
ooutput stream used for display
Returns
output stream

Reimplemented from roboptim::GenericSolver.

References roboptim::decindent(), roboptim::iendl(), roboptim::incindent(), parameters_, plugin_name_, problem_, roboptim::GenericSolver::result_, and roboptim::GenericSolver::SOLVER_NO_SOLUTION.

◆ print() [4/5]

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 constraintViolation_, cost_, roboptim::decindent(), roboptim::iendl(), roboptim::incindent(), parameters_, and x_.

Referenced by roboptim::operator<<().

◆ print() [5/5]

template<typename F>
std::ostream & roboptim::StateParameter< F >::print ( std::ostream & o) const
virtual

Display the solver parameter on the specified output stream.

Parameters
ooutput stream used for display
Returns
output stream

References description, and value.

Referenced by roboptim::operator<<().

◆ Problem() [1/6]

template<typename F, typename CLIST>
roboptim::Problem< F, CLIST >::Problem ( const function_t & cost)
explicit
Precondition
costfunction $\mathbb{R}^n \rightarrow \mathbb{R}$
Parameters
costcost function.

◆ Problem() [2/6]

template<typename F, typename CLIST>
roboptim::Problem< F, CLIST >::Problem ( const Problem< F, CLIST > & pb)
explicit

Copy constructor.

Parameters
pbproblem to copy.

References Problem.

◆ Problem() [3/6]

template<typename F, typename CLIST>
template<typename F_, typename CLIST_>
roboptim::Problem< F, CLIST >::Problem ( const Problem< F_, CLIST_ > & pb)
explicit

Copy constructor (convert from another class of problem).

Parameters
pbproblem to copy and convert.

References Problem.

◆ Problem() [4/6]

template<typename F>
roboptim::Problem< F, boost::mpl::vector<> >::Problem ( const function_t & f)
explicit
Precondition
costfunction $\mathbb{R}^n \rightarrow \mathbb{R}$

References Problem.

◆ Problem() [5/6]

template<typename F>
roboptim::Problem< F, boost::mpl::vector<> >::Problem ( const Problem< F, boost::mpl::vector<> > & pb)
explicit

Copy constructor.

References Problem.

◆ Problem() [6/6]

template<typename F>
template<typename F_>
roboptim::Problem< F, boost::mpl::vector<> >::Problem ( const Problem< F_, boost::mpl::vector<> > & pb)
explicit

Copy constructor (convert from another class of problem).

References Problem.

◆ problem()

template<typename F, typename C>
const Solver< F, C >::problem_t & roboptim::Solver< F, C >::problem ( ) const

Retrieve the problem.

Returns
problem this solver is solving

References problem_.

◆ scalesVector()

template<typename F, typename CLIST>
const Problem< F, CLIST >::scalesVect_t & roboptim::Problem< F, CLIST >::scalesVector ( ) const

Retrieve constraints scaling vector (deprecated version).

References scalingVector().

◆ scalingVector()

template<typename F, typename CLIST>
const Problem< F, CLIST >::scalingVect_t & roboptim::Problem< F, CLIST >::scalingVector ( ) const

Retrieve constraints scaling vector.

Returns
constraints scaling vector

Referenced by scalesVector().

◆ setIterationCallback()

template<typename F, typename C>
virtual void roboptim::Solver< F, C >::setIterationCallback ( callback_t )
inlinevirtual

Set the per-iteration callback.

The per-iteration callback is a callback called each time one iteration of the optimization process is finished.

Not all the solvers support such a callback so this method may throw a std::runtime_error to let you know this feature is unsupported.

Exceptions
std::runtime_error

Reimplemented in roboptim::GenericDummySolverLastState< F >, roboptim::GenericDummySolverLastState< DifferentiableSparseFunction >, and roboptim::GenericDummySolverLastState< Function >.

◆ Solver() [1/2]

template<typename F, typename C>
template<typename F_, typename C_>
roboptim::Solver< F, C >::Solver ( const Problem< F_, C_ > & problem)
explicit

Instantiate a solver from a problem in a different problem class.

This constructor is called when the problem cost function or/and constraints type does not match solver's types.

This is only possible if the problem provides too much information compared to the solver requirements: if the problem contains twice derivable function and the solver requires only derivable function, it will work however the opposite will fail. Problem compatibility is known at compile-time, so the failure will be at compile-time.

Template Parameters
F_original cost function type
C_original constraints functions type
Parameters
problemproblem that should be solved

References roboptim::GenericSolver::GenericSolver(), plugin_name_, and problem_.

◆ Solver() [2/2]

template<typename F, typename C>
roboptim::Solver< F, C >::Solver ( const problem_t & problem)
explicit

Instantiate a solver from a problem.

Parameters
problemproblem that should be solved

References roboptim::GenericSolver::GenericSolver(), plugin_name_, and problem_.

◆ SolverState()

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 constraintViolation_, cost_, and x_.

◆ startingPoint() [1/4]

template<typename F, typename CLIST>
Problem< F, CLIST >::startingPoint_t & roboptim::Problem< F, CLIST >::startingPoint ( )

Set the initial guess.

Returns
reference on the initial guess
Exceptions
std::runtime_error

◆ startingPoint() [2/4]

template<typename F, typename CLIST>
const Problem< F, CLIST >::startingPoint_t & roboptim::Problem< F, CLIST >::startingPoint ( ) const

Get the initial guess.

Returns
reference on the initial guess
Exceptions
std::runtime_error

◆ startingPoint() [3/4]

template<typename F>
Problem< F, boost::mpl::vector<> >::startingPoint_t & roboptim::Problem< F, boost::mpl::vector<> >::startingPoint ( )

Set the initial guess.

Returns
reference on the initial guess
Exceptions
std::runtime_error

References Problem, and startingPoint().

Referenced by startingPoint(), and startingPoint().

◆ startingPoint() [4/4]

template<typename F>
const Problem< F, boost::mpl::vector<> >::startingPoint_t & roboptim::Problem< F, boost::mpl::vector<> >::startingPoint ( ) const

Get the initial guess.

Returns
reference on the initial guess
Exceptions
std::runtime_error

References Problem, and startingPoint().

◆ x() [1/2]

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

References x_.

◆ x() [2/2]

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_.

◆ ~Problem() [1/2]

template<typename F, typename CLIST>
roboptim::Problem< F, CLIST >::~Problem ( )
virtual

Virtual destructor.

One may want to inherit from Problem to provide extra information to a solver plugin.

◆ ~Problem() [2/2]

template<typename F>
roboptim::Problem< F, boost::mpl::vector<> >::~Problem ( )
virtual

Virtual destructor.

One may want to inherit from Problem to provide extra information to a solver plugin.

References Problem, and ~Problem().

Referenced by ~Problem().

◆ ~Solver()

template<typename F, typename C>
roboptim::Solver< F, C >::~Solver ( )
virtual

◆ ~SolverState()

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

◆ ~StateParameter()

template<typename F>
virtual roboptim::StateParameter< F >::~StateParameter ( )
inlinevirtual

Virtual destructor.

Variable Documentation

◆ constraintViolation_

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.

Referenced by constraintViolation(), constraintViolation(), print(), and SolverState().

◆ cost_

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.

Referenced by cost(), cost(), print(), and SolverState().

◆ description [1/2]

std::string roboptim::Parameter::description

Parameter description (for humans).

Referenced by roboptim::operator<<(), and Parameter().

◆ description [2/2]

template<typename F>
std::string roboptim::StateParameter< F >::description

Parameter description (for humans).

Referenced by print().

◆ logger

template<typename F, typename C>
log4cxx::LoggerPtr roboptim::Solver< F, C >::logger
staticprotected

Pointer to function logger (see log4cxx documentation).

◆ parameters_ [1/2]

template<typename F, typename C>
parameters_t roboptim::Solver< F, C >::parameters_
protected

Solver parameters (run-time configuration).

Referenced by getParameter(), parameters(), parameters(), and print().

◆ parameters_ [2/2]

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

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

Referenced by getParameter(), getParameter(), parameters(), parameters(), and print().

◆ plugin_name_

template<typename F, typename C>
std::string roboptim::Solver< F, C >::plugin_name_
protected

Plugin name.

Referenced by pluginName(), pluginName(), print(), Solver(), and Solver().

◆ problem_

template<typename F, typename C>
const problem_t roboptim::Solver< F, C >::problem_
protected

Problem that will be solved.

Referenced by print(), problem(), Solver(), and Solver().

◆ value [1/2]

parameterValues_t roboptim::Parameter::value

Value.

Referenced by roboptim::operator<<(), and Parameter().

◆ value [2/2]

template<typename F>
stateParameterValues_t roboptim::StateParameter< F >::value

Value.

Referenced by print().

◆ x_

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

Current optimization parameters.

Referenced by print(), SolverState(), x(), and x().

Friends

◆ Problem [1/2]

template<typename F, typename CLIST>
template<typename F_, typename CLIST_>
friend class Problem
friend

Referenced by Problem(), and Problem().

◆ Problem [2/2]

template<typename F>
template<typename F_, typename CLIST_>
friend class Problem
friend