Loading...
Searching...
No Matches
roboptim::SolverFactory< T > Class Template Reference

Define a solver factory that instanciate the plug-ins. More...

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

Public Types

typedef T solver_t
 Solver type.
typedef T::problem_t problem_t
 Problem type.

Public Member Functions

solver_toperator() ()
 Instantiate a factory and load the plug-in.

Detailed Description

template<typename T>
class roboptim::SolverFactory< T >

Define a solver factory that instanciate the plug-ins.

The solver factory has to be used to instantiate solvers which are packaged as roboptim-core plug-ins.

This class uses libltdl to handle plug-ins. This lightweight library is provided with GNU Libtool and wraps OS specific behavior into a uniform interface.

Warning
The solver lifetime is bound to the factory lifetime, when the factory goes out of scope, the solver is destroyed too.
Template Parameters
Tsolver type
Precondition
T has to be a subtype of Solver<F,C>.

Member Typedef Documentation

◆ problem_t

template<typename T>
typedef T::problem_t roboptim::SolverFactory< T >::problem_t

Problem type.

◆ solver_t

template<typename T>
typedef T roboptim::SolverFactory< T >::solver_t

Solver type.

Member Function Documentation

◆ operator()()

template<typename T>
SolverFactory< T >::solver_t & roboptim::SolverFactory< T >::operator() ( )

Instantiate a factory and load the plug-in.

The constructor search for the plug-in and load it. If the wanted plug-in can not be found, an exception is thrown.

Parameters
solversolver name (for instance ``cfsqp'')
problemproblem that will be solved
Exceptions
std::runtime_error*/ explicit SolverFactory (std::string solver, const problem_t& problem);

/ Unload the plug-in and free the instantiated solver. ~SolverFactory ();

/** Retrieve a reference on the solver.

Returns
reference on a solver