|
| typedef Base::OptConProblem_t | OptConProblem_t |
| |
| typedef NLOptConSettings | Settings_t |
| |
| typedef ct::core::StateFeedbackController< STATE_DIM, CONTROL_DIM, SCALAR > | Policy_t |
| |
| typedef std::conditional< CONTINUOUS, ContinuousOptConProblem< STATE_DIM, CONTROL_DIM, SCALAR >, DiscreteOptConProblem< STATE_DIM, CONTROL_DIM, SCALAR > >::type | OptConProblem_t |
| |
| typedef LQOCProblem< STATE_DIM, CONTROL_DIM, SCALAR > | LQOCProblem_t |
| |
| typedef LQOCSolver< STATE_DIM, CONTROL_DIM, SCALAR > | LQOCSolver_t |
| |
| typedef ct::core::StateVectorArray< STATE_DIM, SCALAR > | StateVectorArray |
| |
| typedef std::shared_ptr< StateVectorArray > | StateVectorArrayPtr |
| |
| typedef ct::core::ControlVectorArray< CONTROL_DIM, SCALAR > | ControlVectorArray |
| |
| typedef std::shared_ptr< ControlVectorArray > | ControlVectorArrayPtr |
| |
| typedef std::vector< StateVectorArrayPtr, Eigen::aligned_allocator< StateVectorArrayPtr > > | StateSubsteps |
| |
| typedef std::shared_ptr< StateSubsteps > | StateSubstepsPtr |
| |
| typedef std::vector< ControlVectorArrayPtr, Eigen::aligned_allocator< ControlVectorArrayPtr > > | ControlSubsteps |
| |
| typedef std::shared_ptr< ControlSubsteps > | ControlSubstepsPtr |
| |
| typedef OptconSystemInterface< STATE_DIM, CONTROL_DIM, OptConProblem_t, SCALAR > | systemInterface_t |
| |
| typedef std::shared_ptr< systemInterface_t > | systemInterfacePtr_t |
| |
| using | ControlMatrix = ct::core::ControlMatrix< CONTROL_DIM, SCALAR > |
| |
| using | ControlMatrixArray = ct::core::ControlMatrixArray< CONTROL_DIM, SCALAR > |
| |
| using | StateMatrixArray = ct::core::StateMatrixArray< STATE_DIM, SCALAR > |
| |
| using | StateControlMatrixArray = ct::core::StateControlMatrixArray< STATE_DIM, CONTROL_DIM, SCALAR > |
| |
| using | FeedbackArray = ct::core::FeedbackArray< STATE_DIM, CONTROL_DIM, SCALAR > |
| |
| using | TimeArray = ct::core::tpl::TimeArray< SCALAR > |
| |
| using | state_matrix_t = Eigen::Matrix< SCALAR, STATE_DIM, STATE_DIM > |
| |
| using | control_matrix_t = Eigen::Matrix< SCALAR, CONTROL_DIM, CONTROL_DIM > |
| |
| using | control_state_matrix_t = Eigen::Matrix< SCALAR, CONTROL_DIM, STATE_DIM > |
| |
| using | state_control_matrix_t = Eigen::Matrix< SCALAR, STATE_DIM, CONTROL_DIM > |
| |
| using | state_vector_t = core::StateVector< STATE_DIM, SCALAR > |
| |
| using | control_vector_t = core::ControlVector< CONTROL_DIM, SCALAR > |
| |
| using | feedback_matrix_t = core::FeedbackMatrix< STATE_DIM, CONTROL_DIM, SCALAR > |
| |
| using | scalar_t = SCALAR |
| |
| using | scalar_array_t = std::vector< SCALAR, Eigen::aligned_allocator< SCALAR > > |
| |
|
| | NLOCBackendMP (const OptConProblem_t &optConProblem, const NLOptConSettings &settings) |
| |
| | NLOCBackendMP (const OptConProblem_t &optConProblem, const std::string &settingsFile, bool verbose=true, const std::string &ns="alg") |
| |
| virtual | ~NLOCBackendMP () |
| | destructor More...
|
| |
| | NLOCBackendBase (const OptConProblem_t &optConProblem, const Settings_t &settings) |
| |
| | NLOCBackendBase (const OptConProblem_t &optConProblem, const std::string &settingsFile, bool verbose=true, const std::string &ns="alg") |
| |
| | NLOCBackendBase (const systemInterfacePtr_t &systemInterface, const Settings_t &settings) |
| |
| | NLOCBackendBase (const systemInterfacePtr_t &systemInterface, const std::string &settingsFile, bool verbose=true, const std::string &ns="alg") |
| |
| virtual | ~NLOCBackendBase () |
| |
| template<typename T = OptConProblem_t> |
| std::enable_if< std::is_same< T, ContinuousOptConProblem< STATE_DIM, CONTROL_DIM, SCALAR > >::value, systemInterfacePtr_t >::type | createSystemInterface (const OptConProblem_t &optConProblem, const Settings_t &settings) |
| |
| template<typename T = OptConProblem_t> |
| std::enable_if< std::is_same< T, DiscreteOptConProblem< STATE_DIM, CONTROL_DIM, SCALAR > >::value, systemInterfacePtr_t >::type | createSystemInterface (const OptConProblem_t &optConProblem, const Settings_t &settings) |
| |
| virtual void | configure (const Settings_t &settings) |
| | configure the solver More...
|
| |
| const Settings_t & | getSettings () const |
| | get the current SLQsolver settings More...
|
| |
| void | setInitialGuess (const Policy_t &initialGuess) |
| |
| void | changeTimeHorizon (const SCALAR &tf) |
| | Change the time horizon the solver operates on. More...
|
| |
| void | changeTimeHorizon (int numStages) |
| |
| SCALAR | getTimeHorizon () |
| |
| int | getNumSteps () |
| |
| int | getNumStepsPerShot () const |
| |
| void | changeInitialState (const core::StateVector< STATE_DIM, SCALAR > &x0) |
| | Change the initial state for the optimal control problem. More...
|
| |
| void | changeCostFunction (const typename OptConProblem_t::CostFunctionPtr_t &cf) |
| | Change the cost function. More...
|
| |
| void | changeNonlinearSystem (const typename OptConProblem_t::DynamicsPtr_t &dyn) |
| | Change the nonlinear system. More...
|
| |
| void | changeLinearSystem (const typename OptConProblem_t::LinearPtr_t &lin) |
| | Change the linear system. More...
|
| |
| void | changeInputBoxConstraints (const typename OptConProblem_t::ConstraintPtr_t &con) |
| | Change the input box constraints. More...
|
| |
| void | changeStateBoxConstraints (const typename OptConProblem_t::ConstraintPtr_t &con) |
| | Change the state box constraints. More...
|
| |
| void | changeGeneralConstraints (const typename OptConProblem_t::ConstraintPtr_t &con) |
| | Change the general constraints. More...
|
| |
| std::vector< typename OptConProblem_t::DynamicsPtr_t > & | getNonlinearSystemsInstances () |
| | Direct accessor to the system instances. More...
|
| |
| const std::vector< typename OptConProblem_t::DynamicsPtr_t > & | getNonlinearSystemsInstances () const |
| |
| std::vector< typename OptConProblem_t::LinearPtr_t > & | getLinearSystemsInstances () |
| | Direct accessor to the linear system instances. More...
|
| |
| const std::vector< typename OptConProblem_t::LinearPtr_t > & | getLinearSystemsInstances () const |
| |
| std::vector< typename OptConProblem_t::CostFunctionPtr_t > & | getCostFunctionInstances () |
| | Direct accessor to the cost function instances. More...
|
| |
| const std::vector< typename OptConProblem_t::CostFunctionPtr_t > & | getCostFunctionInstances () const |
| |
| std::vector< typename OptConProblem_t::ConstraintPtr_t > & | getInputBoxConstraintsInstances () |
| | Direct accessor to the box constraint instances. More...
|
| |
| std::vector< typename OptConProblem_t::ConstraintPtr_t > & | getStateBoxConstraintsInstances () |
| |
| const std::vector< typename OptConProblem_t::ConstraintPtr_t > & | getInputBoxConstraintsInstances () const |
| |
| const std::vector< typename OptConProblem_t::ConstraintPtr_t > & | getStateBoxConstraintsInstances () const |
| |
| std::vector< typename OptConProblem_t::ConstraintPtr_t > & | getGeneralConstraintsInstances () |
| | Direct accessor to the general constraints. More...
|
| |
| const std::vector< typename OptConProblem_t::ConstraintPtr_t > & | getGeneralConstraintsInstances () const |
| |
| bool | testConsistency () |
| |
| void | logToMatlab (const size_t &iteration) |
| | Export all functions to matlab workspace. More...
|
| |
| void | logInitToMatlab () |
| | log the initial guess to Matlab More...
|
| |
| SCALAR | getCost () const |
| | return the cost of the solution of the current iteration More...
|
| |
| SCALAR | getTotalDefect () const |
| | return the sum of the L2-norm of the defects along the solution candidate More...
|
| |
| void | reset () |
| |
| const core::StateTrajectory< STATE_DIM, SCALAR > | getStateTrajectory () const |
| |
| const core::ControlTrajectory< CONTROL_DIM, SCALAR > | getControlTrajectory () const |
| |
| const Policy_t & | getSolution () |
| |
| const TimeArray & | getTimeArray () |
| |
| bool | isConfigured () |
| |
| bool | isInitialized () |
| |
| void | retrieveLastAffineModel (StateMatrixArray &A, StateControlMatrixArray &B, StateVectorArray &b) |
| | Retrieve Last Linearized Model. More...
|
| |
| virtual void | prepareSolveLQProblem (size_t startIndex) |
| |
| virtual void | finishSolveLQProblem (size_t endIndex) |
| |
| virtual void | solveFullLQProblem () |
| |
| void | extractSolution () |
| | extract relevant quantities for the following rollout/solution update step from the LQ solver More...
|
| |
| void | updateCosts () |
| | compute costs of solution candidate More...
|
| |
| bool | nominalRollout () |
| | nominal rollout using default thread and member variables for the results. // todo maybe rename (initial rollout?) More...
|
| |
| void | checkProblem () |
| | check problem for consistency More...
|
| |
| size_t & | iteration () |
| | return the current iteration number More...
|
| |
| void | printSummary () |
| | Print iteration summary. More...
|
| |
| bool | lineSearch () |
| | perform line-search and update controller More...
|
| |
| void | setInputBoxConstraintsForLQOCProblem () |
| | sets the box constraints for the entire time horizon including terminal stage More...
|
| |
| void | setStateBoxConstraintsForLQOCProblem () |
| |
| void | resetDefects () |
| | reset all defects to zero More...
|
| |
| void | computeDefectsNorm () |
| | update the nominal defects More...
|
| |
| bool | rolloutShotsSingleThreaded (size_t threadId, size_t firstIndex, size_t lastIndex, ControlVectorArray &u_ff_local, StateVectorArray &x_local, const StateVectorArray &x_ref_lqr, StateVectorArray &xShot, StateVectorArray &d, StateSubsteps &substepsX, ControlSubsteps &substepsU, std::atomic_bool *terminationFlag=nullptr) const |
| | do a single threaded rollout and defect computation of the shots - useful for line-search More...
|
| |
| void | doFullStepUpdate () |
| | simple full-step update for state and feedforward control (used for MPC-mode!) More...
|
| |
| void | logSummaryToMatlab (const std::string &fileName) |
| |
| const SummaryAllIterations< SCALAR > & | getSummary () const |
| |
|
| virtual void | computeLQApproximation (size_t firstIndex, size_t lastIndex) override |
| | build LQ approximation around trajectory (linearize dynamics and general constraints, quadratize cost, etc) More...
|
| |
| virtual void | rolloutShots (size_t firstIndex, size_t lastIndex) override |
| | integrates the specified shots and computes the corresponding defects More...
|
| |
| SCALAR | performLineSearch () override |
| | performLineSearch: execute the line search, possibly with different threading schemes More...
|
| |
| bool | rolloutSingleShot (const size_t threadId, const size_t k, ControlVectorArray &u_ff_local, StateVectorArray &x_local, const StateVectorArray &x_ref_lqr, StateVectorArray &xShot, StateSubsteps &substepsX, ControlSubsteps &substepsU, std::atomic_bool *terminationFlag=nullptr) const |
| | integrate the individual shots More...
|
| |
| void | computeSingleDefect (size_t k, const StateVectorArray &x_local, const StateVectorArray &xShot, StateVectorArray &d) const |
| | computes the defect between shot and trajectory More...
|
| |
| void | executeLQApproximation (size_t threadId, size_t k) |
| | Computes the linearized Dynamics and quadratic cost approximation at a specific point of the trajectory. More...
|
| |
| void | computeLinearizedConstraints (size_t threadId, size_t k) |
| | Computes the linearized general constraints at a specific point of the trajectory. More...
|
| |
| void | initializeCostToGo () |
| | Initializes cost to go. More...
|
| |
| void | computeCostToGo (size_t k) |
| | Computes cost to go. More...
|
| |
| void | designController (size_t k) |
| | Design controller. More...
|
| |
| void | computeCostsOfTrajectory (size_t threadId, const core::StateVectorArray< STATE_DIM, SCALAR > &x_local, const core::ControlVectorArray< CONTROL_DIM, SCALAR > &u_local, scalar_t &intermediateCost, scalar_t &finalCost) const |
| | Compute cost for a given set of state and input trajectory. More...
|
| |
| void | computeBoxConstraintErrorOfTrajectory (size_t threadId, const ct::core::StateVectorArray< STATE_DIM, SCALAR > &x_local, const ct::core::ControlVectorArray< CONTROL_DIM, SCALAR > &u_local, scalar_t &e_tot) const |
| | Compute box constraint violations for a given set of state and input trajectory. More...
|
| |
| void | computeGeneralConstraintErrorOfTrajectory (size_t threadId, const ct::core::StateVectorArray< STATE_DIM, SCALAR > &x_local, const ct::core::ControlVectorArray< CONTROL_DIM, SCALAR > &u_local, scalar_t &e_tot) const |
| | Compute general constraint violations for a given set of state and input trajectory. More...
|
| |
| void | executeLineSearch (const size_t threadId, const scalar_t alpha, ct::core::StateVectorArray< STATE_DIM, SCALAR > &x_recorded, ct::core::StateVectorArray< STATE_DIM, SCALAR > &x_shot_recorded, ct::core::StateVectorArray< STATE_DIM, SCALAR > &defects_recorded, ct::core::ControlVectorArray< CONTROL_DIM, SCALAR > &u_recorded, scalar_t &intermediateCost, scalar_t &finalCost, scalar_t &defectNorm, scalar_t &e_box_norm, scalar_t &e_gen_norm, StateSubsteps &substepsX, ControlSubsteps &substepsU, std::atomic_bool *terminationFlag=nullptr) const |
| | Check if controller with particular alpha is better. More...
|
| |
| bool | acceptStep (const SCALAR alpha, const SCALAR intermediateCost, const SCALAR finalCost, const SCALAR defectNorm, const SCALAR e_box_norm, const SCALAR e_gen_norm, const SCALAR lowestMeritPrevious, SCALAR &new_merit) |
| | in case of line-search compute new merit and check if to accept step. Returns true if accept step More...
|
| |
| void | updateFFController (size_t k) |
| | Update feedforward controller. More...
|
| |
| template<typename ARRAY_TYPE , size_t ORDER = 1> |
| SCALAR | computeDiscreteArrayNorm (const ARRAY_TYPE &d) const |
| | compute norm of a discrete array (todo move to core) More...
|
| |
| template<typename ARRAY_TYPE , size_t ORDER = 1> |
| SCALAR | computeDiscreteArrayNorm (const ARRAY_TYPE &a, const ARRAY_TYPE &b) const |
| | compute norm of difference between two discrete arrays (todo move to core) More...
|
| |
| template<size_t ORDER = 1> |
| SCALAR | computeDefectsNorm (const StateVectorArray &d) const |
| | compute the norm of the defects trajectory More...
|
| |
template<size_t STATE_DIM, size_t CONTROL_DIM, size_t P_DIM, size_t V_DIM, typename SCALAR = double, bool CONTINUOUS = true>
class ct::optcon::NLOCBackendMP< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR, CONTINUOUS >
NLOC Backend for the multi-threaded case
template<size_t STATE_DIM, size_t CONTROL_DIM, size_t P_DIM, size_t V_DIM, typename SCALAR , bool CONTINUOUS>
integrates the specified shots and computes the corresponding defects
In special cases, this function may be called for a single index, e.g. for the unconstrained GNMS real-time iteration scheme. Then, don't wake up workers, but do single-threaded computation for that single index, and return.
In case of multiple points to be linearized, start multi-threading:
Implements ct::optcon::NLOCBackendBase< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR, CONTINUOUS >.
References ct::optcon::NLOCBackendBase< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR, CONTINUOUS >::computeSingleDefect(), ct::optcon::NLOCBackendBase< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR, CONTINUOUS >::d_, ct::optcon::NLOCBackendBase< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR, CONTINUOUS >::getNumStepsPerShot(), ct::optcon::NLOptConSettings::nThreads, ct::optcon::NLOptConSettings::nThreadsEigen, ct::optcon::NLOCBackendBase< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR, CONTINUOUS >::rolloutSingleShot(), ct::optcon::NLOCBackendBase< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR, CONTINUOUS >::settings_, ct::optcon::NLOCBackendBase< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR, CONTINUOUS >::substepsU_, ct::optcon::NLOCBackendBase< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR, CONTINUOUS >::substepsX_, ct::optcon::NLOCBackendBase< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR, CONTINUOUS >::u_ff_, ct::optcon::NLOCBackendBase< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR, CONTINUOUS >::x_, ct::optcon::NLOCBackendBase< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR, CONTINUOUS >::x_ref_lqr_, and ct::optcon::NLOCBackendBase< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR, CONTINUOUS >::xShot_.