ocra-recipes
Doxygen documentation for the ocra-recipes repository
Public Types | Public Member Functions | Protected Member Functions | List of all members
ocra::FSQPSolver Class Reference

FSQPSolver class. More...

#include <FSQPSolver.h>

Inheritance diagram for ocra::FSQPSolver:
[legend]
Collaboration diagram for ocra::FSQPSolver:
[legend]

Public Types

enum  eFsqpProblemType { NORMAL_PB =0, INFINITE_PB }
 
enum  eFsqpAlgo { AL =0, NL }
 
enum  eFsqpEvaluationDomainPolicy { LOOSE =1, STRICT }
 
enum  eFsqpPrintOption { NONE, FINAL, EACH, FULL }
 
typedef Map< VectorXd > VectorMap
 
typedef Map< MatrixXd > MatrixMap
 

Public Member Functions

 FSQPSolver ()
 
void set_x0 (const VectorXd &x0, const Variable &ref)
 
eFsqpProblemType getA () const
 
eFsqpAlgo getB () const
 
eFsqpEvaluationDomainPolicy getC () const
 
int getMode () const
 
eFsqpPrintOption getPrintMode () const
 
int getPrintStep () const
 
int getPrintOption () const
 
int getMaxIter () const
 
double getInfinity () const
 
double setEps () const
 
double setEqnViol () const
 
double setUDelta () const
 
void printValuesAtSolution ()
 
std::string toString ()
 
void obj (int nparam, int j, double *x, double *fj, void *cd)
 
void constr (int nparam, int j, double *x, double *gj, void *cd)
 
void gradob (int nparam, int j, double *x, double *gradfj, void *cd)
 
void gradcn (int nparam, int j, double *x, double *gradgj, void *cd)
 
void addObjective (GenericObjective &obj)
 
void removeObjective (Function &obj)
 
void removeObjective (GenericObjective &obj)
 
void addConstraint (LinearConstraint &constraint)
 
void addConstraint (GenericConstraint &constraint)
 
void removeConstraint (LinearConstraint &constraint)
 
void removeConstraint (GenericConstraint &constraint)
 
void addBounds (BoundConstraint &constraint)
 
void addBounds (IdentityConstraint &constraint)
 
void removeBounds (BoundConstraint &constraint)
 
void removeBounds (IdentityConstraint &constraint)
 
void clearObjectives ()
 
void clearConstraints ()
 
void clearEqualityConstraints ()
 
void clearNonLinearEqualityConstraints ()
 
void clearLinearEqualityConstraints ()
 
void clearInequalityConstraints ()
 
void clearNonLinearInequalityConstraints ()
 
void clearLinearInequalityConstraints ()
 
void clearBounds ()
 
void setA (eFsqpProblemType type)
 
void setB (eFsqpAlgo type)
 
void setC (eFsqpEvaluationDomainPolicy type)
 
void setMode (int m)
 
void setPrintMode (eFsqpPrintOption m)
 
void setPrintStep (int N)
 
void setPrintOption (int option)
 
void setMaxIter (int n)
 
void setInfinity (double infinity)
 
void setEps (double eps)
 
void setEqnViol (double eps)
 
void setUDelta (double udelta)
 
- Public Member Functions inherited from ocra::Solver
const std::vector< int > & findMapping (Variable &var)
 
virtual ~Solver ()
 
const OptimizationResultsolve ()
 
const OptimizationResultgetLastResult () const
 
void printStatus (std::ostream &os)
 
virtual const std::string & getMoreInfo () const
 
void setMemoryLevel (int level)
 
void setAutoDumpFile (const std::string &file)
 
void activateAutoDump ()
 
void deactivateAutoDump ()
 
void dump (const std::string &file="") const
 
int n ()
 
VariablegetProblemVariable ()
 
void setVariableValue (const VectorXd &value)
 
- Public Member Functions inherited from ocra::ObserverSubject
 ObserverSubject ()
 
virtual ~ObserverSubject ()
 
- Public Member Functions inherited from ocra::Observer
virtual ~Observer ()
 
template<int EVT>
void bind (SubjectBase< EVT > &subject)
 Call this method to automatically propagate observed events to observers connected to the subject given in argument. More...
 
template<int EVT>
void stopPropagation ()
 
- Public Member Functions inherited from ocra::ObserverBase< EVT_RESIZE >
void bind (subject_type &subject)
 Call this method to automatically propagate observed events to observers connected to the subject given in argument. More...
 
- Public Member Functions inherited from ocra::ObserverBase< EVT_CHANGE_DEPENDENCIES >
void bind (subject_type &subject)
 Call this method to automatically propagate observed events to observers connected to the subject given in argument. More...
 
- Public Member Functions inherited from ocra::ObserverBase< EVT_CHANGE_VALUE >
void bind (subject_type &subject)
 Call this method to automatically propagate observed events to observers connected to the subject given in argument. More...
 
- Public Member Functions inherited from ocra::Subject
virtual ~Subject ()
 
template<int EVT, class Derived , class Base >
void connect (Derived &object, void(Base::*newCallback)(int)) const
 Call this method to register a non-static method as a callback. More...
 
template<int EVT>
void connect (void(*newCallback)(int)) const
 Call this method to register a free function as a callback. More...
 
template<int EVT, class Derived , class Base >
void disconnect (Derived &object, void(Base::*callbackToErase)(int)) const
 Disconnect non-static method. More...
 
template<int EVT>
void disconnect (void(*callbackToErase)(int)) const
 Disconnect free function. More...
 
template<int EVT>
void propagate () const
 
template<int EVT>
void propagate (int timestamp) const
 
- Public Member Functions inherited from ocra::SubjectBase< EVT_RESIZE >
void connect (T &object, typename SubjectBaseTraits< EVT, T >::callback_type newCallback) const
 Call this method to register a non-static method as a callback. More...
 
void connect (typename SubjectBaseTraits< EVT, void >::callback_type newCallback) const
 Call this method to register a free function as a callback. More...
 
void disconnect (T &object, typename SubjectBaseTraits< EVT, T >::callback_type callback) const
 Disconnect non-static method. More...
 
void disconnect (typename SubjectBaseTraits< EVT, void >::callback_type callbackToErase) const
 Disconnect free function. More...
 
void propagate (int timestamp) const
 
void propagate () const
 
- Public Member Functions inherited from ocra::SubjectBase< EVT_CHANGE_DEPENDENCIES >
void connect (T &object, typename SubjectBaseTraits< EVT, T >::callback_type newCallback) const
 Call this method to register a non-static method as a callback. More...
 
void connect (typename SubjectBaseTraits< EVT, void >::callback_type newCallback) const
 Call this method to register a free function as a callback. More...
 
void disconnect (T &object, typename SubjectBaseTraits< EVT, T >::callback_type callback) const
 Disconnect non-static method. More...
 
void disconnect (typename SubjectBaseTraits< EVT, void >::callback_type callbackToErase) const
 Disconnect free function. More...
 
void propagate (int timestamp) const
 
void propagate () const
 
- Public Member Functions inherited from ocra::SubjectBase< EVT_CHANGE_VALUE >
void connect (T &object, typename SubjectBaseTraits< EVT, T >::callback_type newCallback) const
 Call this method to register a non-static method as a callback. More...
 
void connect (typename SubjectBaseTraits< EVT, void >::callback_type newCallback) const
 Call this method to register a free function as a callback. More...
 
void disconnect (T &object, typename SubjectBaseTraits< EVT, T >::callback_type callback) const
 Disconnect non-static method. More...
 
void disconnect (typename SubjectBaseTraits< EVT, void >::callback_type callbackToErase) const
 Disconnect free function. More...
 
void propagate (int timestamp) const
 
void propagate () const
 
- Public Member Functions inherited from ocra::NamedInstance
 NamedInstance (const std::string &name)
 
const std::string & getName () const
 
virtual ~NamedInstance ()
 
- Public Member Functions inherited from ocra::OFSQPProblem
 OFSQPProblem ()
 
void invalidateX ()
 
void validateX ()
 
bool isXNew ()
 
void setFSQPstruct (fsqpDetails::Grd &grd, fsqpDetails::Prnt &prnt)
 
void resetFSQPstruct ()
 

Protected Member Functions

void doPrepare ()
 
void doSolve ()
 
void doConclude ()
 
virtual void onConstraintResize (int timestamp)
 
virtual void onObjectiveResize (int timestamp)
 
- Protected Member Functions inherited from ocra::Solver
 Solver ()
 
void internalAddObjective (const GenericObjective &objective)
 
void internalAddConstraint (const GenericConstraint &constraint)
 
void internalRemoveObjective (const GenericObjective &objective)
 
void internalRemoveConstraint (const GenericConstraint &constraint)
 
- Protected Member Functions inherited from ocra::ObserverBase< EVT_RESIZE >
void stopPropagation ()
 Call this method from your callbacks to avoid propagation to the bound subject (if any). More...
 
 ObserverBase ()
 
 ~ObserverBase ()
 
- Protected Member Functions inherited from ocra::ObserverBase< EVT_CHANGE_DEPENDENCIES >
void stopPropagation ()
 Call this method from your callbacks to avoid propagation to the bound subject (if any). More...
 
 ObserverBase ()
 
 ~ObserverBase ()
 
- Protected Member Functions inherited from ocra::ObserverBase< EVT_CHANGE_VALUE >
void stopPropagation ()
 Call this method from your callbacks to avoid propagation to the bound subject (if any). More...
 
 ObserverBase ()
 
 ~ObserverBase ()
 
- Protected Member Functions inherited from ocra::SubjectBase< EVT_RESIZE >
 SubjectBase ()
 
 ~SubjectBase ()
 
- Protected Member Functions inherited from ocra::SubjectBase< EVT_CHANGE_DEPENDENCIES >
 SubjectBase ()
 
 ~SubjectBase ()
 
- Protected Member Functions inherited from ocra::SubjectBase< EVT_CHANGE_VALUE >
 SubjectBase ()
 
 ~SubjectBase ()
 

Additional Inherited Members

- Protected Types inherited from ocra::ObserverBase< EVT_RESIZE >
typedef SubjectBase< EVT > subject_type
 
typedef InvokerBase< EVT > invoker_type
 
- Protected Types inherited from ocra::ObserverBase< EVT_CHANGE_DEPENDENCIES >
typedef SubjectBase< EVT > subject_type
 
typedef InvokerBase< EVT > invoker_type
 
- Protected Types inherited from ocra::ObserverBase< EVT_CHANGE_VALUE >
typedef SubjectBase< EVT > subject_type
 
typedef InvokerBase< EVT > invoker_type
 
- Protected Attributes inherited from ocra::Solver
OptimizationResult _result
 

Detailed Description

FSQPSolver class.

Warning
None

This class offers an OCRA interface for a simple subset of the FSQP solver possiblities. The problem solved here is: min. sum f_i s.t. g_j<=0 h_k=0 l<=x<=u where the function f_i are real-valued functions while the functions g_j and h_k can have an output space of dimension greater than one. The sets of indices for i, j and k might be empty. In particular, having an objective function is not mandatory. All functions need to be at least C^1 (at least close to the optimum), but they do not need to provide their gradient. In case they don't, the gradient will be evaluate by finite differences. This approximation can however be costly and poor, so it is advised that each function provides its gradient.

Compared to all the possibilities described in fsqp manual, this implementation does not handle:

Definition at line 45 of file FSQPSolver.h.

Member Typedef Documentation

typedef Map<MatrixXd> ocra::FSQPSolver::MatrixMap

Definition at line 50 of file FSQPSolver.h.

typedef Map<VectorXd> ocra::FSQPSolver::VectorMap

Definition at line 49 of file FSQPSolver.h.

Member Enumeration Documentation

Enumerator
AL 
NL 

Definition at line 59 of file FSQPSolver.h.

Enumerator
LOOSE 
STRICT 

Definition at line 65 of file FSQPSolver.h.

Enumerator
NONE 
FINAL 
EACH 
FULL 

Definition at line 71 of file FSQPSolver.h.

Enumerator
NORMAL_PB 
INFINITE_PB 

Definition at line 53 of file FSQPSolver.h.

Constructor & Destructor Documentation

ocra::FSQPSolver::FSQPSolver ( )

Definition at line 5 of file FSQPSolver.cpp.

Member Function Documentation

void ocra::FSQPSolver::addBounds ( BoundConstraint constraint)

Add/remove a bound. Will throw a runtime_error for similar reasons as add/removeObjective.

Definition at line 86 of file FSQPSolver.cpp.

void ocra::FSQPSolver::addBounds ( IdentityConstraint constraint)

Definition at line 91 of file FSQPSolver.cpp.

void ocra::FSQPSolver::addConstraint ( LinearConstraint constraint)

Add/remove a constraint. Will throw a runtime_error for similar reasons as add/removeObjective.

Definition at line 61 of file FSQPSolver.cpp.

void ocra::FSQPSolver::addConstraint ( GenericConstraint constraint)

Definition at line 67 of file FSQPSolver.cpp.

void ocra::FSQPSolver::addObjective ( GenericObjective obj)

Add/remove an objective. Will throw a runtime_error in case obj already exist and is added again, or if one tries to remove obj and obj does not appear in the problem.

Definition at line 29 of file FSQPSolver.cpp.

void ocra::FSQPSolver::clearBounds ( )

Definition at line 163 of file FSQPSolver.cpp.

void ocra::FSQPSolver::clearConstraints ( )

Definition at line 125 of file FSQPSolver.cpp.

void ocra::FSQPSolver::clearEqualityConstraints ( )

Definition at line 131 of file FSQPSolver.cpp.

void ocra::FSQPSolver::clearInequalityConstraints ( )

Definition at line 147 of file FSQPSolver.cpp.

void ocra::FSQPSolver::clearLinearEqualityConstraints ( )

Definition at line 142 of file FSQPSolver.cpp.

void ocra::FSQPSolver::clearLinearInequalityConstraints ( )

Definition at line 158 of file FSQPSolver.cpp.

void ocra::FSQPSolver::clearNonLinearEqualityConstraints ( )

Definition at line 137 of file FSQPSolver.cpp.

void ocra::FSQPSolver::clearNonLinearInequalityConstraints ( )

Definition at line 153 of file FSQPSolver.cpp.

void ocra::FSQPSolver::clearObjectives ( )

Clear all the corresponding data of the problem. Equivalent to call remove() one by one for each of them

Definition at line 120 of file FSQPSolver.cpp.

void ocra::FSQPSolver::constr ( int  nparam,
int  j,
double *  x,
double *  gj,
void *  cd 
)
virtual

Implements ocra::OFSQPProblem.

Definition at line 341 of file FSQPSolver.cpp.

void ocra::FSQPSolver::doConclude ( )
protectedvirtual

Implements ocra::Solver.

Definition at line 416 of file FSQPSolver.cpp.

void ocra::FSQPSolver::doPrepare ( void  )
protectedvirtual

Implements ocra::Solver.

Definition at line 376 of file FSQPSolver.cpp.

void ocra::FSQPSolver::doSolve ( void  )
protectedvirtual

Implements ocra::Solver.

Definition at line 386 of file FSQPSolver.cpp.

FSQPSolver::eFsqpProblemType ocra::FSQPSolver::getA ( void  ) const

Definition at line 261 of file FSQPSolver.cpp.

FSQPSolver::eFsqpAlgo ocra::FSQPSolver::getB ( ) const

Definition at line 266 of file FSQPSolver.cpp.

FSQPSolver::eFsqpEvaluationDomainPolicy ocra::FSQPSolver::getC ( void  ) const

Definition at line 271 of file FSQPSolver.cpp.

double ocra::FSQPSolver::getInfinity ( ) const

Definition at line 301 of file FSQPSolver.cpp.

int ocra::FSQPSolver::getMaxIter ( ) const

Definition at line 296 of file FSQPSolver.cpp.

int ocra::FSQPSolver::getMode ( ) const

Definition at line 276 of file FSQPSolver.cpp.

FSQPSolver::eFsqpPrintOption ocra::FSQPSolver::getPrintMode ( ) const

Definition at line 281 of file FSQPSolver.cpp.

int ocra::FSQPSolver::getPrintOption ( ) const

Definition at line 291 of file FSQPSolver.cpp.

int ocra::FSQPSolver::getPrintStep ( ) const

Definition at line 286 of file FSQPSolver.cpp.

void ocra::FSQPSolver::gradcn ( int  nparam,
int  j,
double *  x,
double *  gradgj,
void *  cd 
)
virtual

Reimplemented from ocra::OFSQPProblem.

Definition at line 362 of file FSQPSolver.cpp.

void ocra::FSQPSolver::gradob ( int  nparam,
int  j,
double *  x,
double *  gradfj,
void *  cd 
)
virtual

Reimplemented from ocra::OFSQPProblem.

Definition at line 347 of file FSQPSolver.cpp.

void ocra::FSQPSolver::obj ( int  nparam,
int  j,
double *  x,
double *  fj,
void *  cd 
)
virtual

Implements ocra::OFSQPProblem.

Definition at line 332 of file FSQPSolver.cpp.

void ocra::FSQPSolver::onConstraintResize ( int  timestamp)
protectedvirtual

Callback method to be invoked when the function of a constraint indicates an EVT_RESIZE, or the constraint itself triggers an EVT_CHANGE_BOUNDS_NUMBER event.

Parameters
timestampTime stamp.

Reimplemented from ocra::Solver.

Definition at line 422 of file FSQPSolver.cpp.

void ocra::FSQPSolver::onObjectiveResize ( int  timestamp)
protectedvirtual

Callback method to be invoked when the function of an objective triggers a EVT_RESIZE event

Parameters
timestampTime stamp.

Reimplemented from ocra::Solver.

Definition at line 427 of file FSQPSolver.cpp.

void ocra::FSQPSolver::printValuesAtSolution ( void  )
virtual

Implements ocra::Solver.

Definition at line 321 of file FSQPSolver.cpp.

void ocra::FSQPSolver::removeBounds ( BoundConstraint constraint)

Definition at line 103 of file FSQPSolver.cpp.

void ocra::FSQPSolver::removeBounds ( IdentityConstraint constraint)

Definition at line 108 of file FSQPSolver.cpp.

void ocra::FSQPSolver::removeConstraint ( LinearConstraint constraint)

Definition at line 73 of file FSQPSolver.cpp.

void ocra::FSQPSolver::removeConstraint ( GenericConstraint constraint)

Definition at line 79 of file FSQPSolver.cpp.

void ocra::FSQPSolver::removeObjective ( Function obj)

Definition at line 38 of file FSQPSolver.cpp.

void ocra::FSQPSolver::removeObjective ( GenericObjective obj)

Definition at line 50 of file FSQPSolver.cpp.

void ocra::FSQPSolver::set_x0 ( const VectorXd &  x0,
const Variable ref 
)

Set the initial guess. The order of x0 is done w.r.t. to the order of the Variable ref

Definition at line 169 of file FSQPSolver.cpp.

void ocra::FSQPSolver::setA ( eFsqpProblemType  type)

Set options

Definition at line 186 of file FSQPSolver.cpp.

void ocra::FSQPSolver::setB ( eFsqpAlgo  type)

Definition at line 191 of file FSQPSolver.cpp.

void ocra::FSQPSolver::setC ( eFsqpEvaluationDomainPolicy  type)

Definition at line 197 of file FSQPSolver.cpp.

void ocra::FSQPSolver::setEps ( double  eps)

Definition at line 243 of file FSQPSolver.cpp.

double ocra::FSQPSolver::setEps ( ) const

Definition at line 306 of file FSQPSolver.cpp.

void ocra::FSQPSolver::setEqnViol ( double  eps)

Definition at line 249 of file FSQPSolver.cpp.

double ocra::FSQPSolver::setEqnViol ( ) const

Definition at line 311 of file FSQPSolver.cpp.

void ocra::FSQPSolver::setInfinity ( double  infinity)

Definition at line 237 of file FSQPSolver.cpp.

void ocra::FSQPSolver::setMaxIter ( int  n)

Definition at line 231 of file FSQPSolver.cpp.

void ocra::FSQPSolver::setMode ( int  m)

Definition at line 203 of file FSQPSolver.cpp.

void ocra::FSQPSolver::setPrintMode ( eFsqpPrintOption  m)

Definition at line 209 of file FSQPSolver.cpp.

void ocra::FSQPSolver::setPrintOption ( int  option)

Definition at line 224 of file FSQPSolver.cpp.

void ocra::FSQPSolver::setPrintStep ( int  N)

Definition at line 217 of file FSQPSolver.cpp.

void ocra::FSQPSolver::setUDelta ( double  udelta)

Definition at line 255 of file FSQPSolver.cpp.

double ocra::FSQPSolver::setUDelta ( ) const

Definition at line 316 of file FSQPSolver.cpp.

std::string ocra::FSQPSolver::toString ( )
virtual

Returns the state of the solver (e.g. matrices) as a string.

Implements ocra::Solver.

Definition at line 326 of file FSQPSolver.cpp.


The documentation for this class was generated from the following files: