roboptim::GenericDummySolverLastState< F > Class Template Reference

Dummy solver which always fails, but returns the last state of the solver. More...

#include <roboptim/core/plugin/dummy-laststate.hh>

Inheritance diagram for roboptim::GenericDummySolverLastState< F >:
roboptim::Solver< F, boost::mpl::vector< F > > roboptim::GenericSolver noncopyable

List of all members.

Public Types

typedef Solver< F,
boost::mpl::vector< F > > 
parent_t
 Define parent's type.
typedef parent_t::problem_t problem_t
 Problem type.
typedef parent_t::callback_t callback_t
 Callback function type.
typedef SolverState< problem_tsolverState_t
 Type of the state of the solver.

Public Member Functions

 GenericDummySolverLastState (const problem_t &problem)
 Build a solver from a problem.
virtual ~GenericDummySolverLastState ()
virtual void solve ()
 Implement the solve algorithm.
virtual void setIterationCallback (callback_t callback)
 Set the per-iteration callback.
const callback_tcallback () const

Public Attributes

callback_t callback_
 Intermediate callback (called at each end of iteration).
solverState_t solverState_
 Current state of the solver (used by the callback function).

Detailed Description

template<typename F>
class roboptim::GenericDummySolverLastState< F >

Dummy solver which always fails, but returns the last state of the solver.

The SolverError generated contains a dummy state of the solver (x, constraints etc.). These values can be obtained thanks to SolverError::lastState.

This solver always fails but is always available as it does not rely on the plug-in mechanism.

It is also a good starting point for users that want to develop their own solver.


Member Typedef Documentation

Callback function type.

Reimplemented from roboptim::Solver< F, boost::mpl::vector< F > >.

template<typename F >
typedef Solver<F, boost::mpl::vector<F> > roboptim::GenericDummySolverLastState< F >::parent_t

Define parent's type.

Type of the state of the solver.

Reimplemented from roboptim::Solver< F, boost::mpl::vector< F > >.


Constructor & Destructor Documentation

template<typename F >
roboptim::GenericDummySolverLastState< F >::GenericDummySolverLastState ( const problem_t problem) [explicit]

Build a solver from a problem.

Parameters:
problemproblem that will be solved
template<typename F >
roboptim::GenericDummySolverLastState< F >::~GenericDummySolverLastState ( ) [virtual]

Member Function Documentation

template<typename F >
virtual void roboptim::GenericDummySolverLastState< F >::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.

Exceptions:
std::runtime_error

Reimplemented from roboptim::Solver< F, boost::mpl::vector< F > >.

References roboptim::GenericDummySolverLastState< F >::callback(), and roboptim::GenericDummySolverLastState< F >::callback_.

template<typename F >
void roboptim::GenericDummySolverLastState< F >::solve ( ) [virtual]

Implement the solve algorithm.

Implement the solve method as required by the GenericSolver class.

Implements roboptim::GenericSolver.

References roboptim::Result::constraints, roboptim::Result::lambda, result_, roboptim::Result::value, and roboptim::Result::x.


Member Data Documentation

Current state of the solver (used by the callback function).

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines