robotoc
robotoc - efficient ROBOT Optimal Control solvers
Loading...
Searching...
No Matches
direct_multiple_shooting.hpp
Go to the documentation of this file.
1#ifndef ROBOTOC_DIRECT_MULTIPLE_SHOOTING_HPP_
2#define ROBOTOC_DIRECT_MULTIPLE_SHOOTING_HPP_
3
4#include <vector>
5#include <memory>
6
7#include "Eigen/Core"
8
11#include "robotoc/ocp/ocp.hpp"
17#include "robotoc/ocp/ocp.hpp"
23
24
25namespace robotoc {
26
33public:
40 DirectMultipleShooting(const OCP& ocp, const int nthreads);
41
46
51
56
61
66
70 DirectMultipleShooting& operator=(DirectMultipleShooting&&) noexcept = default;
71
77 void setNumThreads(const int nthreads);
78
87 const TimeDiscretization& time_discretization,
88 const Solution& s);
89
97 const TimeDiscretization& time_discretization,
98 const Solution& s);
99
110 const TimeDiscretization& time_discretization,
111 const Eigen::VectorXd& q, const Eigen::VectorXd& v,
112 const Solution& s, KKTResidual& kkt_residual);
113
125 const TimeDiscretization& time_discretization,
126 const Eigen::VectorXd& q, const Eigen::VectorXd& v,
127 const Solution& s, KKTMatrix& kkt_matrix,
128 KKTResidual& kkt_residual);
129
139 const Eigen::VectorXd& q,
140 const Eigen::VectorXd& v,
141 const Solution& s, Direction& d) const;
142
147 const PerformanceIndex& getEval() const;
148
154 void computeStepSizes(const TimeDiscretization& time_discretization,
155 Direction& d);
156
161 double maxPrimalStepSize() const;
162
167 double maxDualStepSize() const;
168
179 const TimeDiscretization& time_discretization,
180 const double primal_step_size,
181 const double dual_step_size, Direction& d, Solution& s);
182
192 const TimeDiscretization& time_discretization,
193 const double primal_step_size,
194 const Direction& d, Solution& s);
195
200 void resizeData(const TimeDiscretization& time_discretization);
201
202private:
203 int nthreads_;
204 aligned_vector<OCPData> ocp_data_;
205 IntermediateStage intermediate_stage_;
206 ImpactStage impact_stage_;
207 TerminalStage terminal_stage_;
208 PerformanceIndex performance_index_;
209 Eigen::VectorXd max_primal_step_sizes_, max_dual_step_sizes_;
210};
211
212} // namespace robotoc
213
214#endif // ROBOTOC_DIRECT_MULTIPLE_SHOOTING_HPP_
Direct multiple shooting method of the optimal control problems.
Definition: direct_multiple_shooting.hpp:32
void initConstraints(aligned_vector< Robot > &robots, const TimeDiscretization &time_discretization, const Solution &s)
Initializes the priaml-dual interior point method for inequality constraints.
void computeInitialStateDirection(const Robot &robot, const Eigen::VectorXd &q, const Eigen::VectorXd &v, const Solution &s, Direction &d) const
Computes the initial state direction.
bool isFeasible(aligned_vector< Robot > &robots, const TimeDiscretization &time_discretization, const Solution &s)
Checks whether the solution is feasible under inequality constraints.
void evalOCP(aligned_vector< Robot > &robots, const TimeDiscretization &time_discretization, const Eigen::VectorXd &q, const Eigen::VectorXd &v, const Solution &s, KKTResidual &kkt_residual)
Computes the cost and constraint violations.
DirectMultipleShooting(DirectMultipleShooting &&) noexcept=default
Default move constructor.
void evalKKT(aligned_vector< Robot > &robots, const TimeDiscretization &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.
void resizeData(const TimeDiscretization &time_discretization)
Resizes the internal data.
DirectMultipleShooting(const DirectMultipleShooting &)=default
Default copy constructor.
DirectMultipleShooting & operator=(const DirectMultipleShooting &)=default
Default copy assign operator.
const PerformanceIndex & getEval() const
Gets the performance index of the evaluation.
void integrateSolution(const aligned_vector< Robot > &robots, const TimeDiscretization &time_discretization, const double primal_step_size, const double dual_step_size, Direction &d, Solution &s)
Integrates the solution.
DirectMultipleShooting(const OCP &ocp, const int nthreads)
Construct the direct multiple shooting method.
DirectMultipleShooting()
Default constructor.
void computeStepSizes(const TimeDiscretization &time_discretization, Direction &d)
Computes the step sizes via the fraction-to-boundary-rule.
void integratePrimalSolution(const aligned_vector< Robot > &robots, const TimeDiscretization &time_discretization, const double primal_step_size, const Direction &d, Solution &s)
Integrates the primal solution.
~DirectMultipleShooting()=default
Default destructor.
double maxDualStepSize() const
Gets the maximum dual step size of the fraction-to-boundary-rule.
double maxPrimalStepSize() const
Gets the maximum primal step size of the fraction-to-boundary-rule.
void setNumThreads(const int nthreads)
Sets the number of threads of the parallel computations.
Impact stage computations for optimal control problems.
Definition: impact_stage.hpp:27
Intermediate stage computations for optimal control problems.
Definition: intermediate_stage.hpp:27
Dynamics and kinematics model of robots. Wraps pinocchio::Model and pinocchio::Data....
Definition: robot.hpp:32
Terminal stage computations for optimal control problems.
Definition: terminal_stage.hpp:26
Time discretization of the optimal control problem.
Definition: time_discretization.hpp:20
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
A data structure for an optimal control problem.
Definition: ocp_data.hpp:18
The optimal control problem.
Definition: ocp.hpp:22
Performance index of optimal control problems.
Definition: performance_index.hpp:13