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 |
Parameters 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_t > | roboptim::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_type > | roboptim::Problem< F, boost::mpl::vector<> >::scales_t |
Scale vector. | |
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_t > | roboptim::Problem< F, CLIST >::constraints_t |
Constraints are represented as a vector of constraints. | |
typedef boost::optional < argument_t > | roboptim::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_type > | roboptim::Problem< F, CLIST >::scales_t |
Scale vector. | |
typedef function_t::names_t | roboptim::Problem< F, CLIST >::names_t |
Vector of names (e.g. for arguments). | |
typedef std::vector< intervals_t > | roboptim::Problem< F, CLIST >::intervalsVect_t |
Vector of interval vectors. | |
typedef std::vector< scales_t > | roboptim::Problem< F, CLIST >::scalesVect_t |
Vector of scale vectors. | |
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. | |
template<typename F > | |
std::ostream & | roboptim::operator<< (std::ostream &o, const StateParameter< F > ¶meter) |
Override operator<< to display ``parameters'' objects. | |
template<typename P > | |
std::ostream & | roboptim::operator<< (std::ostream &o, const SolverState< P > &state) |
Override operator<< to display ``parameters'' objects. | |
ROBOPTIM_DLLAPI std::ostream & | roboptim::operator<< (std::ostream &o, const Parameter ¶meter) |
Override operator<< to display ``parameters'' objects. | |
Friends | |
class | roboptim::Problem< F, boost::mpl::vector<> >::Problem |
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). | |
roboptim::Problem< F, boost::mpl::vector<> >::~Problem () | |
Cost function. | |
const function_t & | roboptim::Problem< F, boost::mpl::vector<> >::function () const |
Retrieve cost function. | |
intervals_t & | roboptim::Problem< F, boost::mpl::vector<> >::argumentBounds () |
Retrieve arguments bounds. | |
const intervals_t & | roboptim::Problem< F, boost::mpl::vector<> >::argumentBounds () const |
Retrieve arguments bounds. | |
scales_t & | roboptim::Problem< F, boost::mpl::vector<> >::argumentScales () |
Retrieve arguments scales. | |
const scales_t & | roboptim::Problem< F, boost::mpl::vector<> >::argumentScales () const |
Retrieve arguments scales. | |
names_t & | roboptim::Problem< F, boost::mpl::vector<> >::argumentNames () |
Retrieve arguments names. | |
const names_t & | roboptim::Problem< F, boost::mpl::vector<> >::argumentNames () const |
Retrieve arguments names. | |
Starting point (initial guess). | |
startingPoint_t & | roboptim::Problem< F, boost::mpl::vector<> >::startingPoint () |
Set the initial guess. | |
const startingPoint_t & | roboptim::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). | |
roboptim::Problem< F, CLIST >::~Problem () | |
Cost function. | |
const function_t & | roboptim::Problem< F, CLIST >::function () const |
Retrieve cost function. | |
intervals_t & | roboptim::Problem< F, CLIST >::argumentBounds () |
Retrieve arguments bounds. | |
const intervals_t & | roboptim::Problem< F, CLIST >::argumentBounds () const |
Retrieve arguments bounds. | |
scales_t & | roboptim::Problem< F, CLIST >::argumentScales () |
Retrieve arguments scales. | |
const scales_t & | roboptim::Problem< F, CLIST >::argumentScales () const |
Retrieve arguments scales. | |
names_t & | roboptim::Problem< F, CLIST >::argumentNames () |
Retrieve arguments names. | |
const names_t & | roboptim::Problem< F, CLIST >::argumentNames () const |
Retrieve arguments names. | |
Constraints. | |
const constraints_t & | roboptim::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, scales_t scales) |
Add a constraint to the problem. | |
const intervalsVect_t & | roboptim::Problem< F, CLIST >::boundsVector () const |
Retrieve constraints bounds vector. | |
const scalesVect_t & | roboptim::Problem< F, CLIST >::scalesVector () const |
Retrieve constraints scales vector. | |
Starting point (initial guess). | |
startingPoint_t & | roboptim::Problem< F, CLIST >::startingPoint () |
Set the initial guess. | |
const startingPoint_t & | roboptim::Problem< F, CLIST >::startingPoint () const |
Get the initial guess. |
Optimization problem without constraints.
Optimization problem.
An optimization problem is defined as:
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.
F | function type |
An optimization problem is defined as:
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.
F | function type |
CLIST | type list satisfying MPL's sequence concept |
typedef function_t::argument_t roboptim::Problem< F, boost::mpl::vector<> >::argument_t |
Argument type.
typedef function_t::argument_t roboptim::Problem< F, CLIST >::argument_t |
Argument type.
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.
typedef std::vector<constraint_t> roboptim::Problem< F, CLIST >::constraints_t |
Constraints are represented as a vector of constraints.
typedef boost::mpl::vector roboptim::Problem< F, boost::mpl::vector<> >::constraintsList_t |
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.).
typedef F roboptim::Problem< F, boost::mpl::vector<> >::function_t |
Function type.
This has to be either Function or one of its sub-classes.
typedef F roboptim::Problem< F, CLIST >::function_t |
Function type.
This has to be either Function or one of its sub-classes.
typedef function_t::interval_t roboptim::Problem< F, boost::mpl::vector<> >::interval_t |
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, boost::mpl::vector<> >::intervals_t |
typedef function_t::intervals_t roboptim::Problem< F, CLIST >::intervals_t |
Intervals type.
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 .
If , then the associated interval vector contains only one element of interval_t type.
typedef function_t::names_t roboptim::Problem< F, boost::mpl::vector<> >::names_t |
Vector of names (e.g. for arguments).
typedef function_t::names_t roboptim::Problem< F, CLIST >::names_t |
Vector of names (e.g. for arguments).
typedef std::vector<value_type> roboptim::Problem< F, boost::mpl::vector<> >::scales_t |
Scale vector.
typedef std::vector<value_type> roboptim::Problem< F, CLIST >::scales_t |
Scale vector.
typedef std::vector<scales_t> roboptim::Problem< F, CLIST >::scalesVect_t |
Vector of scale vectors.
This type is used to take into account the fact that constraints can have output values in .
If , then the associated scale vector contains only one element of scale_t type.
typedef function_t::size_type roboptim::Problem< F, boost::mpl::vector<> >::size_type |
Size type.
typedef function_t::size_type roboptim::Problem< F, CLIST >::size_type |
Size type.
typedef boost::optional<argument_t> roboptim::Problem< F, boost::mpl::vector<> >::startingPoint_t |
Optional vector defines a starting point.
typedef boost::optional<argument_t> roboptim::Problem< F, CLIST >::startingPoint_t |
Optional vector defines a starting point.
typedef function_t::value_type roboptim::Problem< F, boost::mpl::vector<> >::value_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, boost::mpl::vector<> >::vector_t |
Vector type.
typedef function_t::vector_t roboptim::Problem< F, CLIST >::vector_t |
Vector type.
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 , use addConstraint (boost::shared_ptr<C> constraint, intervals_t intervals, scales_t scales) instead.
constraint | the constraint that will be added |
interval | interval in which the constraint is satisfied |
scale | constraint scale |
C | constraint type (has to be in CLIST) |
std::runtime_error |
References ASSERT_CONSTRAINT_TYPE.
void roboptim::Problem< F, CLIST >::addConstraint | ( | boost::shared_ptr< C > | constraint, |
intervals_t | intervals, | ||
scales_t | scales | ||
) |
Add a constraint to the problem.
The constraint can be multidimensional.
constraint | the constraint that will be added |
intervals | interval vector in which the constraint is satisfied |
scale | constraint scale |
C | constraint type (has to be in CLIST) |
std::runtime_error |
References ASSERT_CONSTRAINT_TYPE, and ROBOPTIM_DEBUG_ONLY.
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.
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.
Problem< F, CLIST >::intervals_t & roboptim::Problem< F, CLIST >::argumentBounds | ( | ) |
Retrieve arguments bounds.
Arguments bounds define in which interval each argument is valid.
Referenced by roboptim::Problem< F, CLIST >::print().
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.
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.
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.
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.
Referenced by roboptim::Problem< F, CLIST >::print().
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.
Problem< F, boost::mpl::vector<> >::scales_t & roboptim::Problem< F, boost::mpl::vector<> >::argumentScales | ( | ) |
Retrieve arguments scales.
Arguments scales define which scale is applied for each argument.
const Problem< F, boost::mpl::vector<> >::scales_t & roboptim::Problem< F, boost::mpl::vector<> >::argumentScales | ( | ) | const |
Retrieve arguments scales.
Arguments scales define which scale is applied for each argument.
Problem< F, CLIST >::scales_t & roboptim::Problem< F, CLIST >::argumentScales | ( | ) |
Retrieve arguments scales.
Arguments scales define which scale is applied for each argument.
Referenced by roboptim::Problem< F, CLIST >::print().
const Problem< F, CLIST >::scales_t & roboptim::Problem< F, CLIST >::argumentScales | ( | ) | const |
Retrieve arguments scales.
Arguments scales define which scale is applied for each argument.
const Problem< F, CLIST >::intervalsVect_t & roboptim::Problem< F, CLIST >::boundsVector | ( | ) | const |
Retrieve constraints bounds vector.
const Problem< F, CLIST >::constraints_t & roboptim::Problem< F, CLIST >::constraints | ( | ) | const |
const Problem< F, boost::mpl::vector<> >::function_t & roboptim::Problem< F, boost::mpl::vector<> >::function | ( | ) | const |
Retrieve cost function.
const Problem< F, CLIST >::function_t & roboptim::Problem< F, CLIST >::function | ( | ) | const |
Retrieve cost function.
std::ostream & roboptim::operator<< | ( | std::ostream & | o, |
const StateParameter< F > & | parameter | ||
) |
Override operator<< to display ``parameters'' objects.
o | output stream used for display |
parameter | parameter to display |
F | function type. |
std::ostream & roboptim::operator<< | ( | std::ostream & | o, |
const SolverState< P > & | state | ||
) |
Override operator<< to display ``parameters'' objects.
o | output stream used for display |
state | solver state to display |
P | problem type. |
std::ostream & roboptim::operator<< | ( | std::ostream & | o, |
const Parameter & | parameter | ||
) |
Override operator<< to display ``parameters'' objects.
o | output stream used for display |
ns | NoSolution object, ignored |
References roboptim::Parameter::description, and roboptim::Parameter::value.
std::ostream & roboptim::operator<< | ( | std::ostream & | o, |
const Problem< F, boost::mpl::vector<> > & | pb | ||
) |
Override operator<< to handle problem display.
o | output stream used for display |
pb | problem to be displayed |
std::ostream & roboptim::operator<< | ( | std::ostream & | o, |
const Problem< F, CLIST > & | pb | ||
) |
Override operator<< to handle problem display.
o | output stream used for display |
pb | problem to be displayed |
std::ostream & roboptim::Problem< F, boost::mpl::vector<> >::print | ( | std::ostream & | o | ) | const |
Display the problem on the specified output stream.
o | output stream used for display |
References roboptim::decindent(), roboptim::fg::fail(), roboptim::iendl(), roboptim::incendl(), roboptim::fg::ok(), roboptim::fg::reset(), and roboptim::fg::warn().
std::ostream & roboptim::Problem< F, CLIST >::print | ( | std::ostream & | o | ) | const |
Display the problem on the specified output stream.
o | output stream used for display |
References roboptim::Problem< F, CLIST >::argumentBounds(), roboptim::Problem< F, CLIST >::argumentNames(), roboptim::Problem< F, CLIST >::argumentScales(), roboptim::Problem< F, CLIST >::constraints(), roboptim::decindent(), roboptim::fg::fail(), roboptim::iendl(), roboptim::incendl(), roboptim::fg::ok(), roboptim::fg::reset(), and roboptim::fg::warn().
roboptim::Problem< F, boost::mpl::vector<> >::Problem | ( | const function_t & | f | ) | [explicit] |
roboptim::Problem< F, boost::mpl::vector<> >::Problem | ( | const Problem< F, boost::mpl::vector<> > & | pb | ) | [explicit] |
Copy constructor.
roboptim::Problem< F, boost::mpl::vector<> >::Problem | ( | const Problem< F_, boost::mpl::vector<> > & | pb | ) | [explicit] |
Copy constructor (convert from another class of problem).
roboptim::Problem< F, CLIST >::Problem | ( | const function_t & | cost | ) | [explicit] |
cost | cost function. |
roboptim::Problem< F, CLIST >::Problem | ( | const Problem< F, CLIST > & | pb | ) | [explicit] |
Copy constructor.
pb | problem to copy. |
roboptim::Problem< F, CLIST >::Problem | ( | const Problem< F_, CLIST_ > & | pb | ) | [explicit] |
Copy constructor (convert from another class of problem).
pb | problem to copy and convert. |
const Problem< F, CLIST >::scalesVect_t & roboptim::Problem< F, CLIST >::scalesVector | ( | ) | const |
Retrieve constraints scales vector.
Problem< F, boost::mpl::vector<> >::startingPoint_t & roboptim::Problem< F, boost::mpl::vector<> >::startingPoint | ( | ) |
Set the initial guess.
std::runtime_error |
const Problem< F, boost::mpl::vector<> >::startingPoint_t & roboptim::Problem< F, boost::mpl::vector<> >::startingPoint | ( | ) | const |
Get the initial guess.
std::runtime_error |
Problem< F, CLIST >::startingPoint_t & roboptim::Problem< F, CLIST >::startingPoint | ( | ) |
Set the initial guess.
std::runtime_error |
const Problem< F, CLIST >::startingPoint_t & roboptim::Problem< F, CLIST >::startingPoint | ( | ) | const |
Get the initial guess.
std::runtime_error |
roboptim::Problem< F, boost::mpl::vector<> >::~Problem | ( | ) |
roboptim::Problem< F, CLIST >::~Problem | ( | ) |
friend class Problem [friend] |
friend class Problem [friend] |