43 #ifndef ILQGAMES_UTILS_PLAYER_COST_CACHE_H 44 #define ILQGAMES_UTILS_PLAYER_COST_CACHE_H 46 #include <ilqgames/cost/player_cost.h> 47 #include <ilqgames/dynamics/multi_player_flat_system.h> 48 #include <ilqgames/utils/operating_point.h> 49 #include <ilqgames/utils/solver_log.h> 50 #include <ilqgames/utils/types.h> 52 #include <glog/logging.h> 54 #include <unordered_map> 63 const std::vector<PlayerCost>& player_costs);
66 float Interpolate(
size_t iterate, Time t, PlayerIndex player,
67 const std::string& name)
const;
70 const SolverLog& Log()
const {
return *log_; }
71 size_t NumPlayers()
const {
return evaluated_player_costs_.size(); }
72 size_t NumCosts(PlayerIndex player)
const {
73 return evaluated_player_costs_[player].size();
75 bool PlayerHasCost(PlayerIndex player,
const std::string& name)
const {
76 return evaluated_player_costs_[player].count(name) > 0;
78 const std::unordered_map<std::string, std::vector<std::vector<float>>>&
79 EvaluatedCosts(PlayerIndex player)
const {
80 return evaluated_player_costs_[player];
82 const std::vector<float>& EvaluatedCost(
size_t iterate, PlayerIndex player,
83 const std::string& name)
const {
84 CHECK(PlayerHasCost(player, name));
85 CHECK_LT(iterate, evaluated_player_costs_[player].at(name).size());
87 return evaluated_player_costs_[player].at(name)[iterate];
92 const std::shared_ptr<const SolverLog> log_;
96 std::vector<std::unordered_map<std::string, std::vector<std::vector<float>>>>
97 evaluated_player_costs_;