roboptim::GenericSolver Class Reference

Abstract interface satisfied by all solvers. More...

#include <roboptim/core/generic-solver.hh>

Inheritance diagram for roboptim::GenericSolver:
noncopyable roboptim::Solver< F, C > roboptim::Solver< F, boost::mpl::vector< F > > roboptim::Solver< Function, boost::mpl::vector< Function > > roboptim::Solver< TwiceDifferentiableFunction, boost::mpl::vector< TwiceDifferentiableFunction > > roboptim::GenericDummySolverLastState< F > roboptim::DummySolver roboptim::DummySolverTd

List of all members.

Public Types

enum  solutions {
  SOLVER_NO_SOLUTION,
  SOLVER_VALUE,
  SOLVER_VALUE_WARNINGS,
  SOLVER_ERROR
}
 Define the kind of solution which has been found. More...
typedef boost::variant
< NoSolution, Result,
ResultWithWarnings,
SolverError
result_t
 Result type.

Public Member Functions

void reset ()
 Force to restart the optimization.
virtual void solve ()=0
 Solve the problem.
const result_tminimum ()
 Returns the function minimum This solves the problem automatically, if it has not yet been solved.
virtual std::ostream & print (std::ostream &) const
 Display the solver on the specified output stream.
solutions minimumType ()
 Determine real minimum type.
template<typename T >
const T & getMinimum ()
 Get real result.
Constructors and destructors.
 GenericSolver ()
 GenericSolver (const GenericSolver &)
virtual ~GenericSolver ()

Protected Attributes

result_t result_
 Optimization result.

Static Protected Attributes

static log4cxx::LoggerPtr logger
 Pointer to function logger (see log4cxx documentation).

Detailed Description

Abstract interface satisfied by all solvers.


Member Typedef Documentation

Result type.

Uses a Boost.Variant to represent the different possible results:

  • no solution (problem not yet solved),
  • result (problem has been solved successfully),
  • result and warnings (problem solved but some errors happened),
  • solver error (optimization has failed).

Member Enumeration Documentation

Define the kind of solution which has been found.

Enumerator:
SOLVER_NO_SOLUTION 

Solution has yet to be found.

SOLVER_VALUE 

Solution has been found.

SOLVER_VALUE_WARNINGS 

Solution has been found but some problems happened.

SOLVER_ERROR 

The solver failed to found a solution.


Constructor & Destructor Documentation

roboptim::GenericSolver::GenericSolver ( const GenericSolver solver) [explicit]

Member Function Documentation

template<typename T >
const T& roboptim::GenericSolver::getMinimum ( ) [inline]

Get real result.

Optimization results is wrapped in a Boost.Variant class, this method has to be used to retrieve the real result type.

Returns:
real result
Exceptions:
boost::bad_getif a wrong type is used.

Returns the function minimum This solves the problem automatically, if it has not yet been solved.

See also:
minimumType()
getMinimum()

References result_, solve(), and SOLVER_NO_SOLUTION.

Determine real minimum type.

Returns:
value representing result type
std::ostream & roboptim::GenericSolver::print ( std::ostream &  o) const [virtual]

Force to restart the optimization.

Reset the internal mechanism to force the solution to be re-computed next time getMinimum is called.

References logger, and result_.

virtual void roboptim::GenericSolver::solve ( ) [pure virtual]

Solve the problem.

Called automatically by getMinimum if required.

Implemented in roboptim::GenericDummySolverLastState< F >, roboptim::DummySolverTd, and roboptim::DummySolver.

Referenced by minimum().


Member Data Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines