robotoc
robotoc - efficient ROBOT Optimal Control solvers
Loading...
Searching...
No Matches
unconstr_direct_multiple_shooting.hpp
Go to the documentation of this file.
1#ifndef ROBOTOC_UNCONSTR_DIRECT_MULTIPLE_SHOOTING_HPP_
2#define ROBOTOC_UNCONSTR_DIRECT_MULTIPLE_SHOOTING_HPP_
3
4#include <vector>
5#include <memory>
6
7#include "Eigen/Core"
8
17#include "robotoc/ocp/ocp.hpp"
22
23
24namespace robotoc {
25
32public:
39 UnconstrDirectMultipleShooting(const OCP& ocp, const int nthreads=1);
40
45
50
55 const UnconstrDirectMultipleShooting&) = default;
56
61 const UnconstrDirectMultipleShooting&) = default;
62
67 UnconstrDirectMultipleShooting&&) noexcept = default;
68
73 UnconstrDirectMultipleShooting&&) noexcept = default;
74
80 void setNumThreads(const int nthreads);
81
90 const std::vector<GridInfo>& time_discretization,
91 const Solution& s);
92
100 const std::vector<GridInfo>& time_discretization,
101 const Solution& s);
102
113 const std::vector<GridInfo>& time_discretization,
114 const Eigen::VectorXd& q, const Eigen::VectorXd& v,
115 const Solution& s, KKTResidual& kkt_residual);
116
128 const std::vector<GridInfo>& time_discretization,
129 const Eigen::VectorXd& q, const Eigen::VectorXd& v,
130 const Solution& s, KKTMatrix& kkt_matrix,
131 KKTResidual& kkt_residual);
132
140 static void computeInitialStateDirection(const Eigen::VectorXd& q,
141 const Eigen::VectorXd& v,
142 const Solution& s, Direction& d);
143
148 const PerformanceIndex& getEval() const;
149
157 void computeStepSizes(const std::vector<GridInfo>& time_discretization,
158 KKTMatrix& kkt_matrix, KKTResidual& kkt_residual,
159 Direction& d);
160
165 double maxPrimalStepSize() const;
166
171 double maxDualStepSize() const;
172
183 const std::vector<GridInfo>& time_discretization,
184 const double primal_step_size,
185 const double dual_step_size, Direction& d, Solution& s);
186
196 const std::vector<GridInfo>& time_discretization,
197 const double primal_step_size,
198 const Direction& d, Solution& s);
199
200private:
201 int nthreads_;
202 UnconstrIntermediateStage intermediate_stage_;
203 UnconstrTerminalStage terminal_stage_;
205 PerformanceIndex performance_index_;
206 Eigen::VectorXd max_primal_step_sizes_, max_dual_step_sizes_;
207};
208
209} // namespace robotoc
210
211#endif // ROBOTOC_UNCONSTR_DIRECT_MULTIPLE_SHOOTING_HPP_
Dynamics and kinematics model of robots. Wraps pinocchio::Model and pinocchio::Data....
Definition: robot.hpp:32
Direct multiple shooting method of optimal control problems of unconstrained rigid-body systems.
Definition: unconstr_direct_multiple_shooting.hpp:31
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 primal solution.
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.
UnconstrDirectMultipleShooting(const UnconstrDirectMultipleShooting &)=default
Default copy constructor.
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.
double maxDualStepSize() const
Gets the maximum dual step size of the fraction-to-boundary-rule.
const PerformanceIndex & getEval() const
Gets the performance index of the evaluation.
static void computeInitialStateDirection(const Eigen::VectorXd &q, const Eigen::VectorXd &v, const Solution &s, Direction &d)
Computes the initial state direction.
UnconstrDirectMultipleShooting(const OCP &ocp, const int nthreads=1)
Construct the direct multiple shooting method.
void computeStepSizes(const std::vector< GridInfo > &time_discretization, KKTMatrix &kkt_matrix, KKTResidual &kkt_residual, Direction &d)
Computes the step sizes via the fraction-to-boundary-rule.
~UnconstrDirectMultipleShooting()=default
Destructor.
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.
UnconstrDirectMultipleShooting & operator=(const UnconstrDirectMultipleShooting &)=default
Default copy assign operator.
bool isFeasible(aligned_vector< Robot > &robots, const std::vector< GridInfo > &time_discretization, const Solution &s)
Checks whether the solution is feasible under inequality constraints.
void setNumThreads(const int nthreads)
Sets the number of threads of the parallel computations.
double maxPrimalStepSize() const
Gets the maximum primal step size of the fraction-to-boundary-rule.
void initConstraints(aligned_vector< Robot > &robots, const std::vector< GridInfo > &time_discretization, const Solution &s)
Initializes the priaml-dual interior point method for inequality constraints.
UnconstrDirectMultipleShooting(UnconstrDirectMultipleShooting &&) noexcept=default
Default move constructor.
UnconstrDirectMultipleShooting()
Default constructor.
The intermediate stage of OCP computation for unconstrained rigid-body systems.
Definition: unconstr_intermediate_stage.hpp:31
Definition: unconstr_terminal_stage.hpp:31
Definition: constraint_component_base.hpp:17
aligned_vector< SplitKKTMatrix > KKTMatrix
The KKT matrix of the optimal control problem.
Definition: kkt_matrix.hpp:16
aligned_vector< SplitSolution > Solution
Solution to the optimal control problem.
Definition: solution.hpp:16
aligned_vector< SplitDirection > Direction
Newton direction of the solution to the optimal control problem.
Definition: direction.hpp:16
std::vector< T, Eigen::aligned_allocator< T > > aligned_vector
std vector with Eigen::aligned_allocator.
Definition: aligned_vector.hpp:14
aligned_vector< SplitKKTResidual > KKTResidual
The KKT residual of the optimal control problem.
Definition: kkt_residual.hpp:16
Grid information.
Definition: grid_info.hpp:24
The optimal control problem.
Definition: ocp.hpp:22
Performance index of optimal control problems.
Definition: performance_index.hpp:13
Data structure for the optimal control problem of unconstrained rigid-body systems.
Definition: unconstr_ocp_data.hpp:17