Grail (C++)  1.2.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
PlannerSnapshots.h
1 // Copyright QED Software 2023.
2 
3 #ifndef GRAIL_PLANNER_SNAPSHOT_H
4 #define GRAIL_PLANNER_SNAPSHOT_H
5 
6 #include <limits>
7 #include <map>
8 #include <string>
9 #include <utility>
10 #include <vector>
11 
12 namespace grail
13 {
14  namespace planner
15  {
16  class WorldState;
17  class Action;
18  class ParametrizedObject;
19  }
20 
21 namespace data
22 {
26  {
27  std::string typeName;
28  unsigned int objectId = 0;
29 
31  std::map<std::string, std::string> objectData{};
32  };
33 
37  {
38  std::string name{};
39  std::vector<std::string> parametrization{};
40  std::vector<PlannerWorldObjectSnapshot> resultingWorldState{};
41 
42  PlannerActionSnapshot(const planner::Action& action, const planner::WorldState& worldState);
43  PlannerActionSnapshot() = default;
44 
45  private:
46  void AddParametrizedObjectSnapshot(const planner::ParametrizedObject& parametrizedObject,
47  unsigned int objectId,
48  const std::string& objectName);
49  };
50 
54  {
56  std::size_t iterationNumber = 0;
57 
59  std::vector<PlannerActionSnapshot> planActions = {};
60 
61  bool goalReached = false;
62 
64  double score = 0;
65  double totalCost = std::numeric_limits<double>::max();
66  PlannerIterationSnapshot(std::size_t keyIterationIndex);
67  PlannerIterationSnapshot() = default;
68  };
69 
72 
74  {
75  std::vector<PlannerIterationSnapshot> iterations = {};
76 
77  float absoluteTime = 0;
78  float relativeTime = 0;
79  size_t entityId = 0;
80  };
81 }
82 }
83 
84 #endif
grail::planner::Action
Definition: Action.hh:12
grail::data::PlannerWorldObjectSnapshot
Definition: PlannerSnapshots.h:25
grail::planner::WorldState
A class representing planner world state.
Definition: WorldState.hh:16
grail::data::PlannerIterationSnapshot
Definition: PlannerSnapshots.h:53
grail::data::PlannerIterationSnapshot::iterationNumber
std::size_t iterationNumber
The object contains info about iteration with number = IterationNumber.
Definition: PlannerSnapshots.h:56
grail::data::PlannerReasonerSnapshot
Definition: PlannerSnapshots.h:73
grail::data::PlannerIterationSnapshot::score
double score
Heuristic score of the plan.
Definition: PlannerSnapshots.h:64
grail::data::PlannerWorldObjectSnapshot::objectData
std::map< std::string, std::string > objectData
Internal state of the WorldObject.
Definition: PlannerSnapshots.h:31
grail::planner::ParametrizedObject
Definition: ParametrizedObject.hh:22
grail::data::PlannerIterationSnapshot::planActions
std::vector< PlannerActionSnapshot > planActions
In the serialized iteration, the plan consists of planActions.
Definition: PlannerSnapshots.h:59
grail::data::PlannerActionSnapshot
Definition: PlannerSnapshots.h:36