robotoc
robotoc - efficient ROBOT Optimal Control solvers
|
Backward correction for optimal control problems of unconstrained rigid-body systems. More...
#include <unconstr_backward_correction.hpp>
Public Member Functions | |
UnconstrBackwardCorrection (const OCP &ocp, const int nthreads) | |
Construct a backward correction. More... | |
UnconstrBackwardCorrection () | |
Default constructor. More... | |
~UnconstrBackwardCorrection ()=default | |
Destructor. More... | |
UnconstrBackwardCorrection (const UnconstrBackwardCorrection &)=default | |
Default copy constructor. More... | |
UnconstrBackwardCorrection & | operator= (const UnconstrBackwardCorrection &)=default |
Default copy operator. More... | |
UnconstrBackwardCorrection (UnconstrBackwardCorrection &&) noexcept=default | |
Default move constructor. More... | |
UnconstrBackwardCorrection & | operator= (UnconstrBackwardCorrection &&) noexcept=default |
Default move assign operator. More... | |
void | setNumThreads (const int nthreads) |
Sets the number of threads of the parallel computations. More... | |
void | initAuxMat (aligned_vector< Robot > &robots, const std::vector< GridInfo > &time_discretization, const Solution &s, KKTMatrix &kkt_matrix, KKTResidual &kkt_residual) |
Initializes the auxiliary matrices by the terminal cost Hessian computed by the current solution. More... | |
void | initConstraints (aligned_vector< Robot > &robots, const std::vector< GridInfo > &time_discretization, const Solution &s) |
Computes the cost and constraint violations. More... | |
void | evalOCP (aligned_vector< Robot > &robots, const std::vector< GridInfo > &time_discretization, const Eigen::VectorXd &q, const Eigen::VectorXd &v, const Solution &s, KKTResidual &kkt_residual) |
Computes the cost and constraint violations. More... | |
void | evalKKT (aligned_vector< Robot > &robots, const std::vector< GridInfo > &time_discretization, const Eigen::VectorXd &q, const Eigen::VectorXd &v, const Solution &s, KKTMatrix &kkt_matrix, KKTResidual &kkt_residual) |
Computes the KKT residual and matrix. More... | |
void | coarseUpdate (aligned_vector< Robot > &robots, const std::vector< GridInfo > &time_discretization, const Eigen::VectorXd &q, const Eigen::VectorXd &v, const Solution &s, KKTMatrix &kkt_matrix, KKTResidual &kkt_residual) |
Eval KKT and coarse updates the solution leveraging the parallel computation. More... | |
void | backwardCorrection (const std::vector< GridInfo > &time_discretization, const Solution &s, const KKTMatrix &kkt_matrix, const KKTResidual &kkt_residual, Direction &d) |
Performs the backward correction for coarse updated solution and computes the Newton direction. More... | |
double | primalStepSize () const |
Gets the maximum primal step size of the fraction-to-boundary-rule. More... | |
double | dualStepSize () const |
Gets the maximum dual step size of the fraction-to-boundary-rule. More... | |
const PerformanceIndex & | getEval () const |
Gets the performance index of the evaluation. More... | |
void | integrateSolution (const aligned_vector< Robot > &robots, const std::vector< GridInfo > &time_discretization, const double primal_step_size, const double dual_step_size, Direction &d, Solution &s) |
Integrates the solution. More... | |
void | integratePrimalSolution (const aligned_vector< Robot > &robots, const std::vector< GridInfo > &time_discretization, const double primal_step_size, const Direction &d, Solution &s) |
Integrates the solution. More... | |
Backward correction for optimal control problems of unconstrained rigid-body systems.
robotoc::UnconstrBackwardCorrection::UnconstrBackwardCorrection | ( | const OCP & | ocp, |
const int | nthreads | ||
) |
Construct a backward correction.
[in] | ocp | Optimal control problem. |
[in] | nthreads | Number of the threads of the parallel computations. Must be positive. |
robotoc::UnconstrBackwardCorrection::UnconstrBackwardCorrection | ( | ) |
Default constructor.
|
default |
Destructor.
|
default |
Default copy constructor.
|
defaultnoexcept |
Default move constructor.
void robotoc::UnconstrBackwardCorrection::backwardCorrection | ( | const std::vector< GridInfo > & | time_discretization, |
const Solution & | s, | ||
const KKTMatrix & | kkt_matrix, | ||
const KKTResidual & | kkt_residual, | ||
Direction & | d | ||
) |
Performs the backward correction for coarse updated solution and computes the Newton direction.
[in] | time_discretization | Time discretization. |
[in] | s | Solution. |
[in,out] | kkt_matrix | KKT matrix. |
[in,out] | kkt_residual | KKT residual. |
[in,out] | d | Direction. |
void robotoc::UnconstrBackwardCorrection::coarseUpdate | ( | aligned_vector< Robot > & | robots, |
const std::vector< GridInfo > & | time_discretization, | ||
const Eigen::VectorXd & | q, | ||
const Eigen::VectorXd & | v, | ||
const Solution & | s, | ||
KKTMatrix & | kkt_matrix, | ||
KKTResidual & | kkt_residual | ||
) |
Eval KKT and coarse updates the solution leveraging the parallel computation.
[in,out] | robots | aligned_vector of Robot. |
[in] | time_discretization | Time discretization. |
[in] | q | Initial configuration. |
[in] | v | Initial generalized velocity. |
[in] | s | Solution. |
[in,out] | kkt_matrix | KKT matrix. |
[in,out] | kkt_residual | KKT residual. |
double robotoc::UnconstrBackwardCorrection::dualStepSize | ( | ) | const |
Gets the maximum dual step size of the fraction-to-boundary-rule.
void robotoc::UnconstrBackwardCorrection::evalKKT | ( | aligned_vector< Robot > & | robots, |
const std::vector< GridInfo > & | time_discretization, | ||
const Eigen::VectorXd & | q, | ||
const Eigen::VectorXd & | v, | ||
const Solution & | s, | ||
KKTMatrix & | kkt_matrix, | ||
KKTResidual & | kkt_residual | ||
) |
Computes the KKT residual and matrix.
[in,out] | robots | aligned_vector of Robot. |
[in] | time_discretization | Time discretization. |
[in] | q | Initial configuration. |
[in] | v | Initial generalized velocity. |
[in] | s | Solution. |
[in,out] | kkt_matrix | KKT matrix. |
[in,out] | kkt_residual | KKT residual. |
void robotoc::UnconstrBackwardCorrection::evalOCP | ( | aligned_vector< Robot > & | robots, |
const std::vector< GridInfo > & | time_discretization, | ||
const Eigen::VectorXd & | q, | ||
const Eigen::VectorXd & | v, | ||
const Solution & | s, | ||
KKTResidual & | kkt_residual | ||
) |
Computes the cost and constraint violations.
[in,out] | robots | aligned_vector of Robot. |
[in] | time_discretization | Time discretization. |
[in] | q | Initial configuration. |
[in] | v | Initial generalized velocity. |
[in] | s | Solution. |
[in,out] | kkt_residual | KKT residual. |
|
inline |
Gets the performance index of the evaluation.
void robotoc::UnconstrBackwardCorrection::initAuxMat | ( | aligned_vector< Robot > & | robots, |
const std::vector< GridInfo > & | time_discretization, | ||
const Solution & | s, | ||
KKTMatrix & | kkt_matrix, | ||
KKTResidual & | kkt_residual | ||
) |
Initializes the auxiliary matrices by the terminal cost Hessian computed by the current solution.
[in] | robots | aligned_vector of Robot. |
[in] | time_discretization | Time discretization. |
[in] | s | Solution. |
[in,out] | kkt_matrix | KKT matrix. |
[in,out] | kkt_residual | KKT residual. |
void robotoc::UnconstrBackwardCorrection::initConstraints | ( | aligned_vector< Robot > & | robots, |
const std::vector< GridInfo > & | time_discretization, | ||
const Solution & | s | ||
) |
Computes the cost and constraint violations.
[in,out] | robots | aligned_vector of Robot for paralle computing. |
[in] | time_discretization | Time discretization. |
[in] | s | Solution. |
void robotoc::UnconstrBackwardCorrection::integratePrimalSolution | ( | const aligned_vector< Robot > & | robots, |
const std::vector< GridInfo > & | time_discretization, | ||
const double | primal_step_size, | ||
const Direction & | d, | ||
Solution & | s | ||
) |
Integrates the solution.
[in,out] | robots | aligned_vector of Robot for paralle computing. |
[in] | time_discretization | Time discretization. |
[in] | primal_step_size | Primal step size. |
[in] | d | Direction. |
[in,out] | s | Solution. |
void robotoc::UnconstrBackwardCorrection::integrateSolution | ( | const aligned_vector< Robot > & | robots, |
const std::vector< GridInfo > & | time_discretization, | ||
const double | primal_step_size, | ||
const double | dual_step_size, | ||
Direction & | d, | ||
Solution & | s | ||
) |
Integrates the solution.
[in,out] | robots | aligned_vector of Robot for paralle computing. |
[in] | time_discretization | Time discretization. |
[in] | primal_step_size | Primal step size. |
[in] | dual_step_size | Dual step size. |
[in,out] | d | Direction. |
[in,out] | s | Solution. |
|
default |
Default copy operator.
|
defaultnoexcept |
Default move assign operator.
double robotoc::UnconstrBackwardCorrection::primalStepSize | ( | ) | const |
Gets the maximum primal step size of the fraction-to-boundary-rule.
void robotoc::UnconstrBackwardCorrection::setNumThreads | ( | const int | nthreads | ) |
Sets the number of threads of the parallel computations.
[in] | nthreads | Number of the threads of the parallel computations. Must be positive. |