Template Class Solver

Class Documentation

template<class Matrix_type, class Vector_type>
class Solver

Public Types

typedef Task<Matrix_type, Vector_type> TaskType
typedef std::shared_ptr<TaskType> TaskPtr
typedef Constraint<Matrix_type, Vector_type> ConstraintType
typedef std::shared_ptr<ConstraintType> ConstraintPtr
typedef Solver<Matrix_type, Vector_type> SolverType
typedef std::shared_ptr<SolverType> SolverPtr
typedef vector<TaskPtr> Stack

Public Functions

inline Solver(vector<TaskPtr> &stack)

Solver an interface for a generic solver.

Parameters

stack – a vector of pointers to tasks

inline Solver(vector<TaskPtr> &stack, ConstraintPtr bounds)

Solver an interface for a generic solver.

Parameters
  • stack – a vector of pointers to tasks

  • bounds – a global bound for the problem

inline Solver(vector<TaskPtr> &stack, ConstraintPtr bounds, ConstraintPtr globalConstraints)

Solver an interface for a generic solver.

Parameters
  • stack – a vector of pointers to tasks

  • bounds – a global bound for the problem

  • globalConstraints – a global constrains for the problem

inline virtual ~Solver()
virtual bool solve(Vector_type &solution) = 0

solve solve an Optimization problem

Parameters

solution – the solution

Returns

true if solved/solvable

inline std::string getSolverID()

getSolverID

Returns

string with the solver id

inline void setSolverID(const std::string &solver_id)

setSolverID set an id to the solver.

This id will be used as prefix in the logs! NOTE: if two solver are used, to avoid loggin errors, at least one of the two solvers should have an id.

Parameters

solver_id – name of the solver

inline virtual void log(XBot::MatLogger2::Ptr logger)

log logs data related to the solver

Parameters
  • logger – a pointer to a MatLogger

  • prefix – used to log variables

Protected Functions

inline virtual void _log(XBot::MatLogger2::Ptr logger, const std::string &prefix)

_log implement this on the solver to log data

Parameters
  • logger – a pointer to a MatLogger

  • prefix – used to log variables

Protected Attributes

vector<TaskPtr> _tasks
ConstraintPtr _bounds
ConstraintPtr _globalConstraints
std::string _solver_id