60 #ifndef ILQGAMES_SOLVER_LQ_OPEN_LOOP_SOLVER_H 61 #define ILQGAMES_SOLVER_LQ_OPEN_LOOP_SOLVER_H 63 #include <ilqgames/dynamics/multi_player_integrable_system.h> 64 #include <ilqgames/solver/lq_solver.h> 65 #include <ilqgames/utils/linear_dynamics_approximation.h> 66 #include <ilqgames/utils/quadratic_cost_approximation.h> 67 #include <ilqgames/utils/strategy.h> 76 const std::shared_ptr<const MultiPlayerIntegrableSystem>& dynamics,
77 size_t num_time_steps)
78 :
LQSolver(dynamics, num_time_steps) {
80 Ms_.resize(num_time_steps_);
81 ms_.resize(num_time_steps_);
82 for (
size_t kk = 0; kk < num_time_steps_; kk++) {
83 Ms_[kk].resize(dynamics_->NumPlayers(),
84 MatrixXf::Zero(dynamics_->XDim(), dynamics_->XDim()));
85 ms_[kk].resize(dynamics_->NumPlayers(),
86 VectorXf::Zero(dynamics_->XDim()));
90 intermediate_terms_.resize(num_time_steps_ - 1,
91 VectorXf::Zero(dynamics_->XDim()));
92 capital_lambdas_.resize(
94 MatrixXf::Zero(dynamics_->XDim(), dynamics_->XDim()));
95 qr_capital_lambdas_.resize(
97 Eigen::HouseholderQR<MatrixXf>(dynamics_->XDim(), dynamics_->XDim()));
99 std::vector<Eigen::LDLT<MatrixXf>> chol_Rs_element;
100 std::vector<MatrixXf> warped_Bs_element;
101 std::vector<VectorXf> warped_rs_element;
102 for (PlayerIndex ii = 0; ii < dynamics_->NumPlayers(); ii++) {
103 chol_Rs_element.emplace_back(dynamics_->UDim(ii));
104 warped_Bs_element.emplace_back(dynamics_->UDim(ii), dynamics_->XDim());
105 warped_rs_element.emplace_back(dynamics_->UDim(ii));
108 chol_Rs_.resize(num_time_steps_ - 1, chol_Rs_element);
109 warped_Bs_.resize(num_time_steps_ - 1, warped_Bs_element);
110 warped_rs_.resize(num_time_steps_ - 1, warped_rs_element);
115 std::vector<Strategy> Solve(
116 const std::vector<LinearDynamicsApproximation>& linearization,
117 const std::vector<std::vector<QuadraticCostApproximation>>&
119 const VectorXf& x0, std::vector<VectorXf>* delta_xs =
nullptr,
120 std::vector<std::vector<VectorXf>>* costates =
nullptr);
124 std::vector<std::vector<VectorXf>> ms_;
125 std::vector<std::vector<MatrixXf>> Ms_;
128 std::vector<VectorXf> intermediate_terms_;
129 std::vector<MatrixXf> capital_lambdas_;
130 std::vector<Eigen::HouseholderQR<MatrixXf>> qr_capital_lambdas_;
131 std::vector<std::vector<Eigen::LDLT<MatrixXf>>> chol_Rs_;
132 std::vector<std::vector<MatrixXf>> warped_Bs_;
133 std::vector<std::vector<VectorXf>> warped_rs_;