44 #ifndef ILQGAMES_SOLVER_PROBLEM_H 45 #define ILQGAMES_SOLVER_PROBLEM_H 47 #include <ilqgames/cost/player_cost.h> 48 #include <ilqgames/dynamics/multi_player_dynamical_system.h> 49 #include <ilqgames/dynamics/multi_player_flat_system.h> 50 #include <ilqgames/dynamics/multi_player_integrable_system.h> 51 #include <ilqgames/utils/solver_log.h> 52 #include <ilqgames/utils/strategy.h> 53 #include <ilqgames/utils/types.h> 66 virtual void Initialize() {
68 ConstructPlayerCosts();
69 ConstructInitialState();
70 ConstructInitialOperatingPoint();
71 ConstructInitialStrategies();
76 void ResetInitialTime(Time t0) {
78 operating_point_->t0 = t0;
81 void ResetInitialState(
const VectorXf& x0) {
96 virtual void SetUpNextRecedingHorizon(
const VectorXf& x0, Time t0,
97 Time planner_runtime = 0.1);
101 virtual void OverwriteSolution(
const OperatingPoint& operating_point,
102 const std::vector<Strategy>& strategies);
105 bool IsConstrained()
const;
106 virtual Time InitialTime()
const {
return operating_point_->t0; }
107 const VectorXf& InitialState()
const {
return x0_; }
111 std::vector<PlayerCost>& PlayerCosts() {
return player_costs_; }
112 const std::vector<PlayerCost>& PlayerCosts()
const {
return player_costs_; }
113 const std::shared_ptr<const MultiPlayerIntegrableSystem>& Dynamics()
const {
117 CHECK(!dynamics_->TreatAsLinear());
121 CHECK(dynamics_->TreatAsLinear());
125 return *operating_point_;
127 virtual const std::vector<Strategy>& CurrentStrategies()
const {
136 virtual void ConstructDynamics() = 0;
137 virtual void ConstructPlayerCosts() = 0;
138 virtual void ConstructInitialState() = 0;
139 virtual void ConstructInitialOperatingPoint() {
140 operating_point_.reset(
143 virtual void ConstructInitialStrategies() {
144 strategies_.reset(
new std::vector<Strategy>());
145 for (PlayerIndex ii = 0; ii < dynamics_->NumPlayers(); ii++)
146 strategies_->emplace_back(time::kNumTimeSteps, dynamics_->XDim(),
147 dynamics_->UDim(ii));
153 size_t SyncToExistingProblem(
const VectorXf& x0, Time t0,
162 std::shared_ptr<const MultiPlayerIntegrableSystem> dynamics_;
165 std::vector<PlayerCost> player_costs_;
171 std::unique_ptr<OperatingPoint> operating_point_;
172 std::unique_ptr<std::vector<Strategy>> strategies_;