robotoc
robotoc - efficient ROBOT Optimal Control solvers
Loading...
Searching...
No Matches
line_search.hpp
Go to the documentation of this file.
1#ifndef ROBOTOC_LINE_SEARCH_HPP_
2#define ROBOTOC_LINE_SEARCH_HPP_
3
4#include <memory>
5
6#include "Eigen/Core"
7
13#include "robotoc/ocp/ocp.hpp"
17
18
19namespace robotoc {
20
26public:
32 LineSearch(const OCP& ocp,
33 const LineSearchSettings& settings=LineSearchSettings());
34
39
43 ~LineSearch() = default;
44
48 LineSearch(const LineSearch&) = default;
49
53 LineSearch& operator=(const LineSearch&) = default;
54
58 LineSearch(LineSearch&&) noexcept = default;
59
63 LineSearch& operator=(LineSearch&&) noexcept = default;
64
77 const DirectMultipleShooting& dms, aligned_vector<Robot>& robots,
78 const TimeDiscretization& time_discretization,
79 const Eigen::VectorXd& q, const Eigen::VectorXd& v, const Solution& s,
80 const Direction& d, const double max_primal_step_size);
81
86
91 void set(const LineSearchSettings& settings);
92
97 void resizeData(const TimeDiscretization& time_discretization);
98
99private:
100 LineSearchFilter filter_;
101 LineSearchSettings settings_;
102 DirectMultipleShooting dms_trial_;
103 Solution s_trial_;
104 KKTResidual kkt_residual_;
105
106 double lineSearchFilterMethod(
107 const DirectMultipleShooting& dms, aligned_vector<Robot>& robots,
108 const TimeDiscretization& time_discretization,
109 const Eigen::VectorXd& q, const Eigen::VectorXd& v, const Solution& s,
110 const Direction& d, const double max_primal_step_size);
111
112 double meritBacktrackingLineSearch(
113 const DirectMultipleShooting& dms, aligned_vector<Robot>& robots,
114 const TimeDiscretization& time_discretization,
115 const Eigen::VectorXd& q, const Eigen::VectorXd& v, const Solution& s,
116 const Direction& d, const double max_primal_step_size);
117
118 bool armijoCondition(const double merit, const double merit_trial,
119 const double merit_directional_derivative,
120 const double step_size) const;
121
122 double penaltyParam(const TimeDiscretization time_discretization,
123 const Solution& s) const;
124
125};
126
127} // namespace robotoc
128
129#endif // ROBOTOC_LINE_SEARCH_HPP_
Direct multiple shooting method of the optimal control problems.
Definition: direct_multiple_shooting.hpp:32
Filter of the line search.
Definition: line_search_filter.hpp:14
Line search for optimal control problems.
Definition: line_search.hpp:25
LineSearch(const LineSearch &)=default
Default copy constructor.
void clearHistory()
Clear the line search filter.
LineSearch(const OCP &ocp, const LineSearchSettings &settings=LineSearchSettings())
Construct a line search.
~LineSearch()=default
Default destructor.
void resizeData(const TimeDiscretization &time_discretization)
Resizes the internal data.
LineSearch()
Default constructor.
void set(const LineSearchSettings &settings)
Set line search settings.
LineSearch(LineSearch &&) noexcept=default
Default move constructor.
double computeStepSize(const DirectMultipleShooting &dms, aligned_vector< Robot > &robots, const TimeDiscretization &time_discretization, const Eigen::VectorXd &q, const Eigen::VectorXd &v, const Solution &s, const Direction &d, const double max_primal_step_size)
Compute primal step size by fliter line search method.
LineSearch & operator=(const LineSearch &)=default
Default copy assign operator.
Dynamics and kinematics model of robots. Wraps pinocchio::Model and pinocchio::Data....
Definition: robot.hpp:32
Time discretization of the optimal control problem.
Definition: time_discretization.hpp:20
Definition: constraint_component_base.hpp:17
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
Settings for the line search.
Definition: line_search_settings.hpp:22
The optimal control problem.
Definition: ocp.hpp:22