A pool of functions that will be processed together. More...
#include <roboptim/core/function-pool.hh>
Public Types | |
typedef F | pool_t |
Function type of the pool. | |
typedef detail::list_converter < FLIST >::type | functionTypeList_t |
typedef detail::shared_ptr_variant < functionTypeList_t >::type | function_t |
Type of the functions in the pool. | |
typedef std::vector< function_t > | functionList_t |
List of functions that will populate the pool. | |
typedef boost::shared_ptr< F > | callback_t |
Type of the callback function (where the computation happens). | |
Public Member Functions | |
ROBOPTIM_DIFFERENTIABLE_FUNCTION_FWD_TYPEDEFS_ (pool_t) | |
FunctionPool (const callback_t callback, const functionList_t &functions, const std::string &name="") | |
FunctionPool constructor. | |
virtual | ~FunctionPool () |
Virtual destructor. | |
virtual void | impl_compute (result_ref result, const_argument_ref x) const |
virtual void | impl_gradient (gradient_ref gradient, const_argument_ref argument, size_type functionId=0) const |
virtual void | impl_jacobian (jacobian_ref jacobian, const_argument_ref arg) const |
virtual std::ostream & | print (std::ostream &) const |
Overriden print function for pools. |
A pool of functions that will be processed together.
This class provides a way to regroup functions that depend on the same "computation engine", for instance a simulator that generates some data, then each function of the pool can simply read the computed data (which could be done in parallel).
TODO: the actual type of the FunctionPool should depend on the list of constraints that are supported. We could imagine using a metaprogramming version of LCA (lowest common ancestor) to find the Function type that will best match the list. In hybrid scenarios where we have both differentiable and non-differentiable functions, two pools sharing the same callback should probably be used. For now, we will rely on a user-provided function type.
F | type of the pool. |
FLIST | list of valid function types. |
typedef boost::shared_ptr<F> roboptim::FunctionPool< F, FLIST >::callback_t |
Type of the callback function (where the computation happens).
typedef detail::shared_ptr_variant<functionTypeList_t>::type roboptim::FunctionPool< F, FLIST >::function_t |
Type of the functions in the pool.
typedef std::vector<function_t> roboptim::FunctionPool< F, FLIST >::functionList_t |
List of functions that will populate the pool.
typedef detail::list_converter<FLIST>::type roboptim::FunctionPool< F, FLIST >::functionTypeList_t |
typedef F roboptim::FunctionPool< F, FLIST >::pool_t |
Function type of the pool.
Note: this will be set by LCA called on the function type list.
roboptim::FunctionPool< F, FLIST >::FunctionPool | ( | const callback_t | callback, |
const functionList_t & | functions, | ||
const std::string & | name = "" |
||
) | [explicit] |
FunctionPool constructor.
callback | callback function for the engine. |
functions | functions of the pool. |
name | name of the pool. |
roboptim::FunctionPool< F, FLIST >::~FunctionPool | ( | ) | [virtual] |
Virtual destructor.
void roboptim::FunctionPool< F, FLIST >::impl_compute | ( | result_ref | result, |
const_argument_ref | x | ||
) | const [virtual] |
void roboptim::FunctionPool< F, FLIST >::impl_gradient | ( | gradient_ref | gradient, |
const_argument_ref | argument, | ||
size_type | functionId = 0 |
||
) | const [virtual] |
void roboptim::FunctionPool< F, FLIST >::impl_jacobian | ( | jacobian_ref | jacobian, |
const_argument_ref | arg | ||
) | const [virtual] |
std::ostream & roboptim::FunctionPool< F, FLIST >::print | ( | std::ostream & | o | ) | const [virtual] |
Overriden print function for pools.
References roboptim::decindent(), and roboptim::incindent().
roboptim::FunctionPool< F, FLIST >::ROBOPTIM_DIFFERENTIABLE_FUNCTION_FWD_TYPEDEFS_ | ( | pool_t | ) |