Solver for a specific problem class. More...
#include <roboptim/core/solver.hh>
Public Types | |
| typedef Problem< F, C > | problem_t |
| Solver problem type. | |
| typedef F::vector_t | vector_t |
| Import vector type from cost function. | |
| typedef std::map< std::string, Parameter > | parameters_t |
| Map of parameters. | |
| typedef SolverState< problem_t > | solverState_t |
| State of the solver. | |
| typedef boost::function< void(const problem_t &problem, solverState_t &state)> | callback_t |
| Per-iteration callback type. | |
Public Member Functions | |
| Solver (const problem_t &problem) | |
| Instantiate a solver from a problem. | |
| template<typename F_ , typename C_ > | |
| Solver (const Problem< F_, C_ > &problem) | |
| Instantiate a solver from a problem in a different problem class. | |
| virtual | ~Solver () |
| const problem_t & | problem () const |
| Retrieve the problem. | |
| virtual void | setIterationCallback (callback_t) |
| Set the per-iteration callback. | |
| virtual std::ostream & | print (std::ostream &) const |
| Display the solver on the specified output stream. | |
Parameters | |
| const parameters_t & | parameters () const |
| parameters_t & | parameters () |
| template<typename T > | |
| const T & | getParameter (const std::string &key) const |
Plugin name | |
| const std::string & | pluginName () const |
| std::string & | pluginName () |
Protected Attributes | |
| const problem_t | problem_ |
| Problem that will be solved. | |
| parameters_t | parameters_ |
| Solver parameters (run-time configuration). | |
| std::string | plugin_name_ |
| Plugin name. | |
Static Protected Attributes | |
| static log4cxx::LoggerPtr | logger |
| Pointer to function logger (see log4cxx documentation). | |
Solver for a specific problem class.
This class is parametrized by two types: the cost function type and the constraints type.
Solver classes are immutable, the problem can not be changed after the class instantiation.
| F | cost function type |
| C | constraints functions type |
| typedef boost::function<void (const problem_t& problem, solverState_t& state)> roboptim::Solver< F, C >::callback_t |
Per-iteration callback type.
Callback parameters:
Reimplemented in roboptim::GenericDummySolverLastState< F >.
| typedef std::map<std::string, Parameter> roboptim::Solver< F, C >::parameters_t |
Map of parameters.
| 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.
Reimplemented in roboptim::GenericDummySolverLastState< F >.
| typedef SolverState<problem_t> roboptim::Solver< F, C >::solverState_t |
State of the solver.
Reimplemented in roboptim::GenericDummySolverLastState< F >.
| typedef F::vector_t roboptim::Solver< F, C >::vector_t |
Import vector type from cost function.
| roboptim::Solver< F, C >::Solver | ( | const problem_t & | problem | ) | [explicit] |
Instantiate a solver from a problem.
| problem | problem that should be solved |
| 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.
| F_ | original cost function type |
| C_ | original constraints functions type |
| problem | problem that should be solved |
| roboptim::Solver< F, C >::~Solver | ( | ) | [virtual] |
| const T & roboptim::Solver< F, C >::getParameter | ( | const std::string & | key | ) | const |
| const Solver< F, C >::parameters_t & roboptim::Solver< F, C >::parameters | ( | ) | const |
| Solver< F, C >::parameters_t & roboptim::Solver< F, C >::parameters | ( | ) |
| const std::string & roboptim::Solver< F, C >::pluginName | ( | ) | const |
| std::string & roboptim::Solver< F, C >::pluginName | ( | ) |
| std::ostream & roboptim::Solver< F, C >::print | ( | std::ostream & | o | ) | const [virtual] |
Display the solver on the specified output stream.
| o | output stream used for display |
Reimplemented from roboptim::GenericSolver.
References roboptim::decindent(), roboptim::iendl(), roboptim::incindent(), and result_.
| const Solver< F, C >::problem_t & roboptim::Solver< F, C >::problem | ( | ) | const |
Retrieve the problem.
| virtual void roboptim::Solver< F, C >::setIterationCallback | ( | callback_t | ) | [inline, virtual] |
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.
| std::runtime_error |
Reimplemented in roboptim::GenericDummySolverLastState< F >.
log4cxx::LoggerPtr roboptim::Solver< F, C >::logger [static, protected] |
Pointer to function logger (see log4cxx documentation).
Reimplemented from roboptim::GenericSolver.
parameters_t roboptim::Solver< F, C >::parameters_ [protected] |
Solver parameters (run-time configuration).
std::string roboptim::Solver< F, C >::plugin_name_ [protected] |
Plugin name.
const problem_t roboptim::Solver< F, C >::problem_ [protected] |
Problem that will be solved.