DirectTrajectoryOptimization  v0.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
DirectTrajectoryOptimization::DTOSnoptInterface< DIMENSIONS > Class Template Reference

Class interfacing SNOPT NLP with DTO Problem. More...

#include <snopt.hpp>

Inheritance diagram for DirectTrajectoryOptimization::DTOSnoptInterface< DIMENSIONS >:
DirectTrajectoryOptimization::DTOSolverInterface< DIMENSIONS >

Public Member Functions

 DTOSnoptInterface (std::shared_ptr< DTOMethodInterface< DIMENSIONS > > method, bool snopt_verbose, bool feasible_point_only)
 Constructor. More...
 
virtual void InitializeSolver (const std::string &problem_name, const std::string &output_file, const std::string &param_file="", const bool &computeJacobian=false) override
 DTO initializes the solver using this method. More...
 
virtual void Solve (bool warminit=false) override
 DTO request the solver to proceed with the NLP. More...
 
void SetupSolverParameters () override
 Setting up solver parameters. More...
 
virtual void GetDTOSolution (state_vector_array_t &yTraj, control_vector_array_t &uTraj, Eigen::VectorXd &hTraj) override
 Method to get the current values of the solution. More...
 
virtual void GetDTOSolution (state_vector_array_t &y_trajectory, control_vector_array_t &u_trajectory, Eigen::VectorXd &h_trajectory, std::vector< int > &phaseId) override
 Method to get the current values of the solution. More...
 
virtual void GetDTOSolution (state_vector_array_t &yTraj, state_vector_array_t &ydotTraj, control_vector_array_t &uTraj, Eigen::VectorXd &hTraj, std::vector< int > &phaseId) override
 Method to get the current values of the solution. More...
 
virtual void GetFVector (Eigen::VectorXd &fVec) override
 Returns the vector of NLP-constraints. More...
 
void GetSolverSolutionVariables (Eigen::VectorXi &_x_state, Eigen::VectorXd &_x_mul, Eigen::VectorXi &_f_state, Eigen::VectorXd &_f_mul) override
 Method to get final values of internal solver variables. More...
 
void InitializeDecisionVariablesFromTrajectory (const state_vector_array_t &y_sol, const control_vector_array_t &u_sol, const Eigen::VectorXd &h_sol) override
 Initial solution point for the solver. More...
 
void WarmSolverInitialization (const Eigen::VectorXi &x_state, const Eigen::VectorXd &x_mul, const Eigen::VectorXi &f_state, const Eigen::VectorXd &f_mul) override
 Warm Initialization of NLP Solver. More...
 
- Public Member Functions inherited from DirectTrajectoryOptimization::DTOSolverInterface< DIMENSIONS >
void SetVerbosity (bool verb)
 Set verbosity of the solver. More...
 

Public Attributes

std::shared_ptr
< DTOMethodInterface
< DIMENSIONS > > 
_method
 
std::shared_ptr< snoptProblemA > nlp_solver
 

Static Public Attributes

static std::shared_ptr
< DTOSnoptInterface
< DIMENSIONS > > 
interface_pointer
 

Additional Inherited Members

- Protected Member Functions inherited from DirectTrajectoryOptimization::DTOSolverInterface< DIMENSIONS >
 DTOSolverInterface ()
 Construct an instance of the DTOSolverInterface class. More...
 

Detailed Description

template<class DIMENSIONS>
class DirectTrajectoryOptimization::DTOSnoptInterface< DIMENSIONS >

Class interfacing SNOPT NLP with DTO Problem.

It handles parameter and variables initialization

Constructor & Destructor Documentation

template<class DIMENSIONS >
DirectTrajectoryOptimization::DTOSnoptInterface< DIMENSIONS >::DTOSnoptInterface ( std::shared_ptr< DTOMethodInterface< DIMENSIONS > >  method,
bool  snopt_verbose,
bool  feasible_point_only 
)
inline

Constructor.

Parameters
[in]methodThe pointer to the method
[in]snopt_verboseThe flag indicating verbosity of the solver
[in]feasible_point_onlyThe flag indicating the type of optimization

Member Function Documentation

template<class DIMENSIONS >
void DirectTrajectoryOptimization::DTOSnoptInterface< DIMENSIONS >::GetDTOSolution ( state_vector_array_t &  yTraj,
control_vector_array_t &  uTraj,
Eigen::VectorXd &  hTraj 
)
overridevirtual

Method to get the current values of the solution.

this point is not necessarily feasible or optimal

Parameters
[out]yTrajThe state space trajectory
[out]uTrajThe control trajectory
[out]hTrajThe time increments between the discretization points

Implements DirectTrajectoryOptimization::DTOSolverInterface< DIMENSIONS >.

template<class DIMENSIONS >
void DirectTrajectoryOptimization::DTOSnoptInterface< DIMENSIONS >::GetDTOSolution ( state_vector_array_t &  yTraj,
control_vector_array_t &  uTraj,
Eigen::VectorXd &  hTraj,
std::vector< int > &  phaseId 
)
overridevirtual

Method to get the current values of the solution.

overloaded to also return the phase ID for each node

Parameters
[out]yTrajThe state space trajectory
[out]uTrajThe control trajectory
[out]hTrajThe time increments between the discretization points
[out]phaseIdThe vector of phases ID's of the corresponding nodes

Implements DirectTrajectoryOptimization::DTOSolverInterface< DIMENSIONS >.

template<class DIMENSIONS >
void DirectTrajectoryOptimization::DTOSnoptInterface< DIMENSIONS >::GetDTOSolution ( state_vector_array_t &  yTraj,
state_vector_array_t &  ydotTraj,
control_vector_array_t &  uTraj,
Eigen::VectorXd &  hTraj,
std::vector< int > &  phaseId 
)
overridevirtual

Method to get the current values of the solution.

overloaded to also return the state derivatives

Parameters
[out]yTrajThe state space trajectory
[out]ydotTrajThe state derivative trajectory
[out]uTrajThe control trajectory
[out]hTrajThe time increments between the discretization points
[out]phaseIdThe vector of phases ID's of the corresponding nodes

Reimplemented from DirectTrajectoryOptimization::DTOSolverInterface< DIMENSIONS >.

template<class DIMENSIONS >
virtual void DirectTrajectoryOptimization::DTOSnoptInterface< DIMENSIONS >::GetFVector ( Eigen::VectorXd &  fVec)
inlineoverridevirtual

Returns the vector of NLP-constraints.

Parameters
[out]fVecThe vector of NLP-constraints

Implements DirectTrajectoryOptimization::DTOSolverInterface< DIMENSIONS >.

template<class DIMENSIONS >
void DirectTrajectoryOptimization::DTOSnoptInterface< DIMENSIONS >::GetSolverSolutionVariables ( Eigen::VectorXi &  _x_state,
Eigen::VectorXd &  _x_mul,
Eigen::VectorXi &  _f_state,
Eigen::VectorXd &  _f_mul 
)
overridevirtual

Method to get final values of internal solver variables.

the meaning of the state variables is solver dependent

Parameters
[out]_x_stateThe vector of integers indicating the final state of all decision variables
[out]_x_mulThe vector of Lagrange multipliers corresponding to all decision variables
[out]_f_stateThe vector of integers indicating the final state of the vector of NLP-constraints
[out]_f_mulThe vector of Lagrange multipliers corresponding to the vector of NLP-constraints

Reimplemented from DirectTrajectoryOptimization::DTOSolverInterface< DIMENSIONS >.

template<class DIMENSIONS >
void DirectTrajectoryOptimization::DTOSnoptInterface< DIMENSIONS >::InitializeDecisionVariablesFromTrajectory ( const state_vector_array_t &  y_sol,
const control_vector_array_t &  u_sol,
const Eigen::VectorXd &  h_sol 
)
overridevirtual

Initial solution point for the solver.

Set the decision variables to the values given by a trajectory

Parameters
[in]y_solvector of states describing the trajectory
[in]u_solvector of controls describing the trajectory
[in]h_solvector of time increments between discretization points

Implements DirectTrajectoryOptimization::DTOSolverInterface< DIMENSIONS >.

template<class DIMENSIONS >
void DirectTrajectoryOptimization::DTOSnoptInterface< DIMENSIONS >::InitializeSolver ( const std::string &  problemName,
const std::string &  outputFile,
const std::string &  paramFile = "",
const bool &  computeJacobian = false 
)
overridevirtual

DTO initializes the solver using this method.

Parameters
[in]problemNameThe name of the problem provided by user
[in]outputFileThe name of the outputfile provided by user
[in]paramFileThe name of the parameters file (solver dependent)
[in]computeJacobianThe flag to use solver numerical differentiation

Implements DirectTrajectoryOptimization::DTOSolverInterface< DIMENSIONS >.

template<class DIMENSIONS >
void DirectTrajectoryOptimization::DTOSnoptInterface< DIMENSIONS >::SetupSolverParameters ( )
overridevirtual

Setting up solver parameters.

set solver specific parameters

Implements DirectTrajectoryOptimization::DTOSolverInterface< DIMENSIONS >.

template<class DIMENSIONS >
void DirectTrajectoryOptimization::DTOSnoptInterface< DIMENSIONS >::Solve ( bool  warminit = false)
overridevirtual

DTO request the solver to proceed with the NLP.

Parameters
[in]warminitThe flag indicating the type of optimization

Implements DirectTrajectoryOptimization::DTOSolverInterface< DIMENSIONS >.

template<class DIMENSIONS >
void DirectTrajectoryOptimization::DTOSnoptInterface< DIMENSIONS >::WarmSolverInitialization ( const Eigen::VectorXi &  x_state,
const Eigen::VectorXd &  x_mul,
const Eigen::VectorXi &  f_state,
const Eigen::VectorXd &  f_mul 
)
overridevirtual

Warm Initialization of NLP Solver.

set solver variables given by previous solution

Parameters
[in]x_stateIndex for SNOPT decision variables
[in]x_mulLagrange multipliers of decision variables
[in]f_stateIndex for SNOPT vector of constraints
[in]f_mulLagrange multipliers of the constraints

Reimplemented from DirectTrajectoryOptimization::DTOSolverInterface< DIMENSIONS >.

Member Data Documentation

template<class DIMENSIONS >
std::shared_ptr<DTOMethodInterface<DIMENSIONS> > DirectTrajectoryOptimization::DTOSnoptInterface< DIMENSIONS >::_method

Pointer to the DTOMethodInterface

template<class DIMENSIONS >
std::shared_ptr< DTOSnoptInterface< DIMENSIONS > > DirectTrajectoryOptimization::DTOSnoptInterface< DIMENSIONS >::interface_pointer
static

Pointer to the constraint function

template<class DIMENSIONS >
std::shared_ptr<snoptProblemA> DirectTrajectoryOptimization::DTOSnoptInterface< DIMENSIONS >::nlp_solver

SnoptA problem


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