Optimization problem without constraints.
More...
|
typedef boost::mpl::vector | roboptim::Problem< F, boost::mpl::vector<> >::constraintsList_t |
|
typedef F | roboptim::Problem< F, boost::mpl::vector<> >::function_t |
| Function type. More...
|
|
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. More...
|
|
typedef function_t::argument_t | roboptim::Problem< F, boost::mpl::vector<> >::argument_t |
| Argument type. More...
|
|
typedef function_t::size_type | roboptim::Problem< F, boost::mpl::vector<> >::size_type |
| Size type. More...
|
|
typedef boost::optional< argument_t > | roboptim::Problem< F, boost::mpl::vector<> >::startingPoint_t |
| Optional vector defines a starting point. More...
|
|
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<> >::scaling_t |
| Scaling vector. More...
|
|
typedef scaling_t scales_t | roboptim::Problem< F, boost::mpl::vector<> >::ROBOPTIM_CORE_DEPRECATED |
| Scaling vector (deprecated typedef). More...
|
|
typedef function_t::names_t | roboptim::Problem< F, boost::mpl::vector<> >::names_t |
| Vector of names (e.g. for arguments). More...
|
|
typedef detail::list_converter< CLIST >::type | roboptim::Problem< F, CLIST >::constraintsList_t |
| Constraints types list. More...
|
|
typedef F | roboptim::Problem< F, CLIST >::function_t |
| Function type. More...
|
|
typedef detail::shared_ptr_variant< constraintsList_t >::type | roboptim::Problem< F, CLIST >::constraint_t |
| Constraint's type. More...
|
|
typedef function_t::value_type | roboptim::Problem< F, CLIST >::value_type |
| Import function's value_type type. More...
|
|
typedef function_t::vector_t | roboptim::Problem< F, CLIST >::vector_t |
| Vector type. More...
|
|
typedef function_t::argument_t | roboptim::Problem< F, CLIST >::argument_t |
| Argument type. More...
|
|
typedef function_t::size_type | roboptim::Problem< F, CLIST >::size_type |
| Size type. More...
|
|
typedef std::vector< constraint_t > | roboptim::Problem< F, CLIST >::constraints_t |
| Constraints are represented as a vector of constraints. More...
|
|
typedef boost::optional< argument_t > | roboptim::Problem< F, CLIST >::startingPoint_t |
| Optional vector defines a starting point. More...
|
|
typedef function_t::interval_t | roboptim::Problem< F, CLIST >::interval_t |
| Interval type (e.g. for bounds). More...
|
|
typedef function_t::intervals_t | roboptim::Problem< F, CLIST >::intervals_t |
| Intervals type. More...
|
|
typedef std::vector< value_type > | roboptim::Problem< F, CLIST >::scaling_t |
| Scaling vector. More...
|
|
typedef scaling_t scales_t | roboptim::Problem< F, CLIST >::ROBOPTIM_CORE_DEPRECATED |
| Scaling vector (deprecated typedef) More...
|
|
typedef function_t::names_t | roboptim::Problem< F, CLIST >::names_t |
| Vector of names (e.g. for arguments). More...
|
|
typedef std::vector< intervals_t > | roboptim::Problem< F, CLIST >::intervalsVect_t |
| Vector of interval vectors. More...
|
|
typedef std::vector< scaling_t > | roboptim::Problem< F, CLIST >::scalingVect_t |
| Vector of scaling vectors. More...
|
|
typedef scalingVect_t scalesVect_t | roboptim::Problem< F, CLIST >::ROBOPTIM_CORE_DEPRECATED |
| Vector of scaling vectors (deprecated typedef). More...
|
|
|
std::ostream & | roboptim::Problem< F, boost::mpl::vector<> >::print (std::ostream &o) const |
| Display the problem on the specified output stream. More...
|
|
std::ostream & | roboptim::Problem< F, CLIST >::print (std::ostream &o) const |
| Display the problem on the specified output stream. More...
|
|
template<typename F > |
std::ostream & | roboptim::operator<< (std::ostream &o, const Problem< F, boost::mpl::vector<> > &pb) |
| Override operator<< to handle problem display. More...
|
|
template<typename F , typename CLIST > |
std::ostream & | roboptim::operator<< (std::ostream &o, const Problem< F, CLIST > &pb) |
| Override operator<< to handle problem display. More...
|
|
template<typename F > |
std::ostream & | roboptim::operator<< (std::ostream &o, const StateParameter< F > ¶meter) |
| Override operator<< to display ``parameters'' objects. More...
|
|
template<typename P > |
std::ostream & | roboptim::operator<< (std::ostream &o, const SolverState< P > &state) |
| Override operator<< to display ``parameters'' objects. More...
|
|
ROBOPTIM_DLLAPI std::ostream & | roboptim::operator<< (std::ostream &o, const Parameter ¶meter) |
| Override operator<< to display ``parameters'' objects. More...
|
|
|
const constraints_t & | roboptim::Problem< F, CLIST >::constraints () const |
| Retrieve constraints. More...
|
|
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. More...
|
|
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. More...
|
|
const intervalsVect_t & | roboptim::Problem< F, CLIST >::boundsVector () const |
| Retrieve constraints bounds vector. More...
|
|
const scalingVect_t & | roboptim::Problem< F, CLIST >::scalingVector () const |
| Retrieve constraints scaling vector. More...
|
|
const scalesVect_t & | roboptim::Problem< F, CLIST >::scalesVector () const ROBOPTIM_CORE_DEPRECATED |
| Retrieve constraints scaling vector (deprecated version). More...
|
|
Optimization problem without constraints.
Optimization problem.
An optimization problem is defined as:
- a cost function (
)
- 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
-
An optimization problem is defined as:
- a cost function (
)
- one or more constraints functions, (
) 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
-
F | function type |
CLIST | type list satisfying MPL's sequence concept |
template<typename F >
typedef function_t::argument_t roboptim::Problem< F, boost::mpl::vector<> >::argument_t |
template<typename F, typename CLIST>
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.
template<typename F, typename CLIST>
Constraints are represented as a vector of constraints.
template<typename F >
typedef boost::mpl::vector roboptim::Problem< F, boost::mpl::vector<> >::constraintsList_t |
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.).
Function type.
This has to be either Function or one of its sub-classes.
template<typename F, typename CLIST>
Function type.
This has to be either Function or one of its sub-classes.
template<typename F >
typedef function_t::interval_t roboptim::Problem< F, boost::mpl::vector<> >::interval_t |
template<typename F, typename CLIST>
Interval type (e.g. for bounds).
template<typename F >
typedef function_t::intervals_t roboptim::Problem< F, boost::mpl::vector<> >::intervals_t |
template<typename F, typename CLIST>
template<typename F, typename CLIST>
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.
Vector of names (e.g. for arguments).
template<typename F, typename CLIST>
Vector of names (e.g. for arguments).
template<typename F >
typedef scaling_t scales_t roboptim::Problem< F, boost::mpl::vector<> >::ROBOPTIM_CORE_DEPRECATED |
Scaling vector (deprecated typedef).
template<typename F, typename CLIST>
Scaling vector (deprecated typedef)
template<typename F, typename CLIST>
typedef scalingVect_t scalesVect_t roboptim::Problem< F, CLIST >::ROBOPTIM_CORE_DEPRECATED |
Vector of scaling vectors (deprecated typedef).
template<typename F >
typedef std::vector<value_type> roboptim::Problem< F, boost::mpl::vector<> >::scaling_t |
template<typename F, typename CLIST>
template<typename F, typename CLIST>
Vector of scaling vectors.
This type is used to take into account the fact that constraints can have output values in
.
If
, then the associated scaling vector contains only one element of scaling_t type.
template<typename F >
typedef function_t::size_type roboptim::Problem< F, boost::mpl::vector<> >::size_type |
template<typename F, typename CLIST>
template<typename F >
typedef boost::optional<argument_t> roboptim::Problem< F, boost::mpl::vector<> >::startingPoint_t |
Optional vector defines a starting point.
template<typename F, typename CLIST>
Optional vector defines a starting point.
template<typename F >
typedef function_t::value_type roboptim::Problem< F, boost::mpl::vector<> >::value_type |
template<typename F, typename CLIST>
Import function's value_type type.
template<typename F, typename CLIST>
template<typename F , typename CLIST >
template<typename C >
Add a constraint to the problem.
Useful only when
, use addConstraint (boost::shared_ptr<C> constraint, intervals_t intervals, scaling_t scaling) instead.
- Parameters
-
constraint | the constraint that will be added |
interval | interval in which the constraint is satisfied |
scale | constraint scale |
- Template Parameters
-
C | constraint type (has to be in CLIST) |
- Exceptions
-
References ASSERT_CONSTRAINT_TYPE.
template<typename F , typename CLIST >
template<typename C >
Add a constraint to the problem.
The constraint can be multidimensional.
- Parameters
-
constraint | the constraint that will be added |
intervals | interval vector in which the constraint is satisfied |
scaling | constraint scaling |
- Template Parameters
-
C | constraint type (has to be in CLIST) |
- Exceptions
-
References ASSERT_CONSTRAINT_TYPE, and ROBOPTIM_DEBUG_ONLY.
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
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
template<typename F , typename CLIST >
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
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
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
template<typename F , typename CLIST >
Retrieve arguments names.
Arguments names define a name for each argument. This is particularly useful when logging data.
- Returns
- arguments names
Referenced by roboptim::Problem< F, CLIST >::print().
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
template<typename F >
Problem< F, boost::mpl::vector<> >::scales_t & roboptim::Problem< F, boost::mpl::vector<> >::argumentScales |
( |
| ) |
|
Retrieve arguments scaling (deprecated version).
template<typename F >
const Problem< F, boost::mpl::vector<> >::scales_t & roboptim::Problem< F, boost::mpl::vector<> >::argumentScales |
( |
| ) |
const |
Retrieve arguments scaling (deprecated version).
template<typename F , typename CLIST >
template<typename F , typename CLIST >
const Problem< F, CLIST >::scales_t & roboptim::Problem< F, CLIST >::argumentScales |
( |
| ) |
const |
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
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
template<typename F , typename CLIST >
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
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
template<typename F , typename CLIST >
const Problem< F, CLIST >::constraints_t & roboptim::Problem< F, CLIST >::constraints |
( |
| ) |
const |
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
template<typename F , typename CLIST >
const Problem< F, CLIST >::function_t & roboptim::Problem< F, CLIST >::function |
( |
| ) |
const |
Retrieve cost function.
- Returns
- cost function
template<typename F >
std::ostream & roboptim::operator<< |
( |
std::ostream & |
o, |
|
|
const StateParameter< F > & |
parameter |
|
) |
| |
Override operator<< to display ``parameters'' objects.
- Parameters
-
o | output stream used for display |
parameter | parameter to display |
- Template Parameters
-
- Returns
- output stream
template<typename P >
std::ostream & roboptim::operator<< |
( |
std::ostream & |
o, |
|
|
const SolverState< P > & |
state |
|
) |
| |
Override operator<< to display ``parameters'' objects.
- Parameters
-
o | output stream used for display |
state | solver state to display |
- Template Parameters
-
- Returns
- output stream
std::ostream & roboptim::operator<< |
( |
std::ostream & |
o, |
|
|
const Parameter & |
parameter |
|
) |
| |
template<typename F >
std::ostream & roboptim::operator<< |
( |
std::ostream & |
o, |
|
|
const Problem< F, boost::mpl::vector<> > & |
pb |
|
) |
| |
Override operator<< to handle problem display.
- Parameters
-
o | output stream used for display |
pb | problem to be displayed |
- Returns
- output stream
template<typename F , typename CLIST >
std::ostream & roboptim::operator<< |
( |
std::ostream & |
o, |
|
|
const Problem< F, CLIST > & |
pb |
|
) |
| |
Override operator<< to handle problem display.
- Parameters
-
o | output stream used for display |
pb | problem to be displayed |
- Returns
- output stream
template<typename F >
std::ostream & roboptim::Problem< F, boost::mpl::vector<> >::print |
( |
std::ostream & |
o | ) |
const |
template<typename F , typename CLIST >
Display the problem on the specified output stream.
- Parameters
-
o | output stream used for display |
- Returns
- output stream
References roboptim::Problem< F, CLIST >::argumentBounds(), roboptim::Problem< F, CLIST >::argumentNames(), roboptim::Problem< F, CLIST >::argumentScaling(), roboptim::Problem< F, CLIST >::constraints(), roboptim::decindent(), roboptim::fg::fail(), roboptim::iendl(), roboptim::incendl(), roboptim::fg::ok(), roboptim::fg::reset(), and roboptim::fg::warn().
- Precondition
- costfunction
template<typename F >
template<typename F_ >
Copy constructor (convert from another class of problem).
template<typename F , typename CLIST >
- Precondition
- costfunction
- Parameters
-
template<typename F , typename CLIST >
Copy constructor.
- Parameters
-
template<typename F , typename CLIST >
template<typename F_ , typename CLIST_ >
Copy constructor (convert from another class of problem).
- Parameters
-
pb | problem to copy and convert. |
template<typename F , typename CLIST >
const Problem< F, CLIST >::scalesVect_t & roboptim::Problem< F, CLIST >::scalesVector |
( |
| ) |
const |
template<typename F , typename CLIST >
const Problem< F, CLIST >::scalingVect_t & roboptim::Problem< F, CLIST >::scalingVector |
( |
| ) |
const |
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
-
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
-
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
-
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
-
Virtual destructor.
One may want to inherit from Problem to provide extra information to a solver plugin.
template<typename F , typename CLIST >
Virtual destructor.
One may want to inherit from Problem to provide extra information to a solver plugin.
template<typename F >
template<typename F_ , typename CLIST_ >
template<typename F, typename CLIST>
template<typename F_ , typename CLIST_ >