57 #ifndef ILQGAMES_SOLVER_LQ_FEEDBACK_SOLVER_H 58 #define ILQGAMES_SOLVER_LQ_FEEDBACK_SOLVER_H 60 #include <ilqgames/dynamics/multi_player_integrable_system.h> 61 #include <ilqgames/solver/lq_solver.h> 62 #include <ilqgames/utils/linear_dynamics_approximation.h> 63 #include <ilqgames/utils/quadratic_cost_approximation.h> 64 #include <ilqgames/utils/strategy.h> 74 const std::shared_ptr<const MultiPlayerIntegrableSystem>& dynamics,
75 size_t num_time_steps)
76 :
LQSolver(dynamics, num_time_steps) {
79 const Dimension total_udim = dynamics_->TotalUDim();
83 S_.resize(total_udim, total_udim);
84 X_.resize(total_udim, dynamics_->XDim() + 1);
85 Y_.resize(total_udim, dynamics_->XDim() + 1);
87 Dimension cumulative_udim = 0;
88 for (PlayerIndex ii = 0; ii < dynamics_->NumPlayers(); ii++) {
90 X_.block(cumulative_udim, 0, dynamics_->UDim(ii), dynamics_->XDim()));
91 alphas_.push_back(X_.col(dynamics_->XDim())
92 .segment(cumulative_udim, dynamics_->UDim(ii)));
95 cumulative_udim += dynamics_->UDim(ii);
100 Zs_.resize(num_time_steps_);
101 zetas_.resize(num_time_steps_);
102 for (
size_t kk = 0; kk < num_time_steps_; kk++) {
103 Zs_[kk].resize(dynamics_->NumPlayers());
104 zetas_[kk].resize(dynamics_->NumPlayers());
105 for (PlayerIndex ii = 0; ii < dynamics_->NumPlayers(); ii++) {
106 Zs_[kk][ii].resize(dynamics_->XDim(), dynamics_->XDim());
107 zetas_[kk][ii].resize(dynamics_->XDim());
112 F_.resize(dynamics_->XDim(), dynamics_->XDim());
113 beta_.resize(dynamics_->XDim());
118 std::vector<Strategy> Solve(
119 const std::vector<LinearDynamicsApproximation>& linearization,
120 const std::vector<std::vector<QuadraticCostApproximation>>&
122 const VectorXf& x0, std::vector<VectorXf>* delta_xs =
nullptr,
123 std::vector<std::vector<VectorXf>>* costates =
nullptr);
133 std::vector<Eigen::Ref<MatrixXf>> Ps_;
134 std::vector<Eigen::Ref<VectorXf>> alphas_;
137 std::vector<std::vector<MatrixXf>> Zs_;
138 std::vector<std::vector<VectorXf>> zetas_;