- 3.0.2 optimal control module.
|
Class to solve a specfic DMS problem. More...
#include <DmsSolver.h>
Public Types | |
typedef DmsDimensions< STATE_DIM, CONTROL_DIM, SCALAR > | DIMENSIONS |
typedef DIMENSIONS::state_vector_t | state_vector_t |
typedef DIMENSIONS::control_vector_array_t | control_vector_array_t |
typedef DIMENSIONS::control_vector_t | control_vector_t |
typedef DIMENSIONS::state_vector_array_t | state_vector_array_t |
typedef DIMENSIONS::time_array_t | time_array_t |
typedef DmsPolicy< STATE_DIM, CONTROL_DIM, SCALAR > | Policy_t |
typedef ContinuousOptConProblem< STATE_DIM, CONTROL_DIM, SCALAR > | OptConProblem_t |
Public Types inherited from ct::optcon::OptConSolver< DmsSolver< STATE_DIM, CONTROL_DIM, SCALAR >, DmsPolicy< STATE_DIM, CONTROL_DIM, SCALAR >, DmsSettings, STATE_DIM, CONTROL_DIM, SCALAR > | |
typedef DmsPolicy< STATE_DIM, CONTROL_DIM, SCALAR > | Policy_t |
typedef DmsSettings | Settings_t |
typedef DmsSolver< STATE_DIM, CONTROL_DIM, SCALAR > | Derived |
typedef SCALAR | Scalar_t |
Public Member Functions | |
DmsSolver (const ContinuousOptConProblem< STATE_DIM, CONTROL_DIM, SCALAR > problem, DmsSettings settingsDms) | |
Custom constructor, converts the optcon problem to a DMS problem. More... | |
~DmsSolver () override=default | |
Destructor. More... | |
void | configure (const DmsSettings &settings) override |
bool | solve () override |
const Policy_t & | getSolution () override |
const core::StateTrajectory< STATE_DIM, SCALAR > | getStateTrajectory () const override |
const core::ControlTrajectory< CONTROL_DIM, SCALAR > | getControlTrajectory () const override |
const core::tpl::TimeArray< SCALAR > & | getTimeArray () const override |
void | setInitialGuess (const Policy_t &initialGuess) override |
SCALAR | getTimeHorizon () const override |
Get the time horizon the solver currently operates on. More... | |
void | changeTimeHorizon (const SCALAR &tf) override |
Change the time horizon the solver operates on. More... | |
void | changeInitialState (const core::StateVector< STATE_DIM, SCALAR > &x0) override |
Change the initial state for the optimal control problem. More... | |
void | changeCostFunction (const typename Base::OptConProblem_t::CostFunctionPtr_t &cf) override |
void | changeNonlinearSystem (const typename Base::OptConProblem_t::DynamicsPtr_t &dyn) override |
void | changeLinearSystem (const typename Base::OptConProblem_t::LinearPtr_t &lin) override |
void | changeInputBoxConstraints (const typename Base::OptConProblem_t::ConstraintPtr_t con) override |
void | changeStateBoxConstraints (const typename Base::OptConProblem_t::ConstraintPtr_t con) override |
void | changeGeneralConstraints (const typename Base::OptConProblem_t::ConstraintPtr_t con) override |
void | printSolution () |
Prints out the solution trajectories of the DMS problem. More... | |
std::vector< typename OptConProblem_t::DynamicsPtr_t > & | getNonlinearSystemsInstances () override |
Direct accessor to the system instances. More... | |
const std::vector< typename OptConProblem_t::DynamicsPtr_t > & | getNonlinearSystemsInstances () const override |
std::vector< typename OptConProblem_t::LinearPtr_t > & | getLinearSystemsInstances () override |
Direct accessor to the linear system instances. More... | |
const std::vector< typename OptConProblem_t::LinearPtr_t > & | getLinearSystemsInstances () const override |
std::vector< typename OptConProblem_t::CostFunctionPtr_t > & | getCostFunctionInstances () override |
Direct accessor to the cost function instances. More... | |
const std::vector< typename OptConProblem_t::CostFunctionPtr_t > & | getCostFunctionInstances () const override |
std::vector< typename OptConProblem_t::ConstraintPtr_t > & | getInputBoxConstraintsInstances () override |
Direct accessor to the box constraint instances. More... | |
const std::vector< typename OptConProblem_t::ConstraintPtr_t > & | getInputBoxConstraintsInstances () const override |
std::vector< typename OptConProblem_t::ConstraintPtr_t > & | getStateBoxConstraintsInstances () override |
const std::vector< typename OptConProblem_t::ConstraintPtr_t > & | getStateBoxConstraintsInstances () const override |
std::vector< typename OptConProblem_t::ConstraintPtr_t > & | getGeneralConstraintsInstances () override |
Direct accessor to the general constraints. More... | |
const std::vector< typename OptConProblem_t::ConstraintPtr_t > & | getGeneralConstraintsInstances () const override |
Public Member Functions inherited from ct::optcon::OptConSolver< DmsSolver< STATE_DIM, CONTROL_DIM, SCALAR >, DmsPolicy< STATE_DIM, CONTROL_DIM, SCALAR >, DmsSettings, STATE_DIM, CONTROL_DIM, SCALAR > | |
OptConSolver () | |
virtual | ~OptConSolver () |
virtual void | setProblem (const OptConProblem_t &optConProblem) |
Assigns the optimal control problem to the solver. More... | |
void | configureFromFile (const std::string &filename, bool verbose=true, const std::string &ns=DmsSolver< STATE_DIM, CONTROL_DIM, SCALAR > ::SolverName) |
virtual bool | runIteration () |
virtual void | changeCostFunction (const typename OptConProblem_t::CostFunctionPtr_t &cf)=0 |
Change the cost function. More... | |
virtual void | changeNonlinearSystem (const typename OptConProblem_t::DynamicsPtr_t &dyn)=0 |
Change the nonlinear system. More... | |
virtual void | changeLinearSystem (const typename OptConProblem_t::LinearPtr_t &lin)=0 |
Change the linear system. More... | |
virtual void | changeInputBoxConstraints (const typename OptConProblem_t::ConstraintPtr_t con) |
Change the box constraints. More... | |
virtual void | changeStateBoxConstraints (const typename OptConProblem_t::ConstraintPtr_t con) |
virtual void | changeGeneralConstraints (const typename OptConProblem_t::ConstraintPtr_t con) |
Change the general constraints. More... | |
virtual SCALAR | getCost () const |
virtual void | generateCode (const ct::core::DerivativesCppadSettings &settings) |
Generates source AD source code which can be used in the solver. This method needs to be called ahead of actually solving the problem (e.g. from a different executable) More... | |
Public Attributes | |
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef OptConSolver< DmsSolver< STATE_DIM, CONTROL_DIM, SCALAR >, DmsPolicy< STATE_DIM, CONTROL_DIM, SCALAR >, DmsSettings, STATE_DIM, CONTROL_DIM > | Base |
Public Attributes inherited from ct::optcon::OptConSolver< DmsSolver< STATE_DIM, CONTROL_DIM, SCALAR >, DmsPolicy< STATE_DIM, CONTROL_DIM, SCALAR >, DmsSettings, STATE_DIM, CONTROL_DIM, SCALAR > | |
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef std::conditional< true, ContinuousOptConProblem< STATE_DIM, CONTROL_DIM, SCALAR >, DiscreteOptConProblem< STATE_DIM, CONTROL_DIM, SCALAR > >::type | OptConProblem_t |
Additional Inherited Members | |
Static Public Attributes inherited from ct::optcon::OptConSolver< DmsSolver< STATE_DIM, CONTROL_DIM, SCALAR >, DmsPolicy< STATE_DIM, CONTROL_DIM, SCALAR >, DmsSettings, STATE_DIM, CONTROL_DIM, SCALAR > | |
static const size_t | STATE_D |
static const size_t | CONTROL_D |
Class to solve a specfic DMS problem.
An example employing different DMS solvers is given in unit test oscDMSTest.cpp
STATE_DIM | The state dimension |
CONTROL_DIM | The control dimension |
typedef DmsDimensions<STATE_DIM, CONTROL_DIM, SCALAR> ct::optcon::DmsSolver< STATE_DIM, CONTROL_DIM, SCALAR >::DIMENSIONS |
typedef DIMENSIONS::state_vector_t ct::optcon::DmsSolver< STATE_DIM, CONTROL_DIM, SCALAR >::state_vector_t |
typedef DIMENSIONS::control_vector_array_t ct::optcon::DmsSolver< STATE_DIM, CONTROL_DIM, SCALAR >::control_vector_array_t |
typedef DIMENSIONS::control_vector_t ct::optcon::DmsSolver< STATE_DIM, CONTROL_DIM, SCALAR >::control_vector_t |
typedef DIMENSIONS::state_vector_array_t ct::optcon::DmsSolver< STATE_DIM, CONTROL_DIM, SCALAR >::state_vector_array_t |
typedef DIMENSIONS::time_array_t ct::optcon::DmsSolver< STATE_DIM, CONTROL_DIM, SCALAR >::time_array_t |
typedef DmsPolicy<STATE_DIM, CONTROL_DIM, SCALAR> ct::optcon::DmsSolver< STATE_DIM, CONTROL_DIM, SCALAR >::Policy_t |
typedef ContinuousOptConProblem<STATE_DIM, CONTROL_DIM, SCALAR> ct::optcon::DmsSolver< STATE_DIM, CONTROL_DIM, SCALAR >::OptConProblem_t |
|
inline |
Custom constructor, converts the optcon problem to a DMS problem.
[in] | problem | The optimal control problem |
[in] | settingsDms | The dms settings |
References ct::optcon::IPOPT, and ct::optcon::SNOPT.
|
overridedefault |
Destructor.
|
inlineoverridevirtual |
|
inlineoverridevirtual |
solve the optimal control problem
|
inlineoverridevirtual |
Get the optimized control policy to the optimal control problem
References ct::optcon::DmsPolicy< STATE_DIM, CONTROL_DIM, SCALAR >::xSolution_.
|
inlineoverridevirtual |
Get the optimized trajectory to the optimal control problem
|
inlineoverridevirtual |
Get the optimal feedforward control input corresponding to the optimal trajectory
|
inlineoverridevirtual |
Get the time indices corresponding to the solution
|
inlineoverridevirtual |
Set the initial guess used by the solver (not all solvers might support initial guesses)
References ct::optcon::DmsPolicy< STATE_DIM, CONTROL_DIM, SCALAR >::uSolution_, and ct::optcon::DmsPolicy< STATE_DIM, CONTROL_DIM, SCALAR >::xSolution_.
|
inlineoverridevirtual |
Get the time horizon the solver currently operates on.
|
inlineoverridevirtual |
Change the time horizon the solver operates on.
This function does not need to be called if setProblem() has been called with an OptConProblem that had the correct time horizon set.
|
inlineoverridevirtual |
Change the initial state for the optimal control problem.
This function does not need to be called if setProblem() has been called with an OptConProblem that had the correct initial state set
References x0.
|
inlineoverride |
References i.
|
inlineoverride |
References i.
|
inlineoverride |
References i.
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
|
inline |
Prints out the solution trajectories of the DMS problem.
|
inlineoverridevirtual |
Direct accessor to the system instances.
|
inlineoverridevirtual |
|
inlineoverridevirtual |
Direct accessor to the linear system instances.
|
inlineoverridevirtual |
|
inlineoverridevirtual |
Direct accessor to the cost function instances.
|
inlineoverridevirtual |
|
inlineoverridevirtual |
Direct accessor to the box constraint instances.
Reimplemented from ct::optcon::OptConSolver< DmsSolver< STATE_DIM, CONTROL_DIM, SCALAR >, DmsPolicy< STATE_DIM, CONTROL_DIM, SCALAR >, DmsSettings, STATE_DIM, CONTROL_DIM, SCALAR >.
|
inlineoverridevirtual |
|
inlineoverridevirtual |
|
inlineoverridevirtual |
|
inlineoverridevirtual |
Direct accessor to the general constraints.
Reimplemented from ct::optcon::OptConSolver< DmsSolver< STATE_DIM, CONTROL_DIM, SCALAR >, DmsPolicy< STATE_DIM, CONTROL_DIM, SCALAR >, DmsSettings, STATE_DIM, CONTROL_DIM, SCALAR >.
|
inlineoverridevirtual |
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef OptConSolver<DmsSolver<STATE_DIM, CONTROL_DIM, SCALAR>, DmsPolicy<STATE_DIM, CONTROL_DIM, SCALAR>, DmsSettings, STATE_DIM, CONTROL_DIM> ct::optcon::DmsSolver< STATE_DIM, CONTROL_DIM, SCALAR >::Base |