Grail (C++)  1.2.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
UniqueTreeDataset.hh
1 // Copyright QED Software 2023.
2 
3 #ifndef GRAIL_UNIQUE_TREE_DATASET_H
4 #define GRAIL_UNIQUE_TREE_DATASET_H
5 
6 #include <initializer_list>
7 #include <memory>
8 #include <unordered_set>
9 #include "../ISimulatedGameAction.hh"
10 #include "../DecisionTree/DTConsiderationType.hh"
11 
12 namespace grail
13 {
14 namespace simgames
15 {
16  class ISimulatedGameAction;
17 
18 namespace learn
19 {
20  class TreeDataSample;
21  class Dataset;
22 
24  {
25  public:
26  virtual ~UniqueTreeDataset();
27 
29  void Add(std::unique_ptr<TreeDataSample> sample);
30 
32  void Add(std::vector<float>& data, const ISimulatedGameAction* action);
33 
35  std::unique_ptr<Dataset> ConvertToDataset(
36  const std::initializer_list<dt::DTConsiderationType>& considerationTypes);
37 
39  std::unique_ptr<Dataset> ConvertToDataset(const std::vector<dt::DTConsiderationType>& considerationTypes);
40 
43  std::unique_ptr<Dataset> ConvertToDataset(dt::DTConsiderationType considerationType, int count);
44  private:
45  std::unordered_set<std::unique_ptr<TreeDataSample>, HashForOfflineLearning, EqualsForOfflineLearning>
46  samples;
47  };
48 }
49 }
50 }
51 
52 #endif //GRAIL_UNIQUE_TREE_DATASET_H
grail::simgames::learn::UniqueTreeDataset::Add
void Add(std::unique_ptr< TreeDataSample > sample)
Adds a new sample.
Definition: UniqueTreeDataset.cpp:13
grail::simgames::ISimulatedGameAction
Base class for all actions in SimulatedGame. Derive from it for your actions.
Definition: ISimulatedGameAction.hh:41
grail::simgames::learn::UniqueTreeDataset::ConvertToDataset
std::unique_ptr< Dataset > ConvertToDataset(const std::initializer_list< dt::DTConsiderationType > &considerationTypes)
Converts to a flat dataset - with the chosen decision - that is suitable for constructing the Decisio...
Definition: UniqueTreeDataset.cpp:31
grail::simgames::HashForOfflineLearning
Helper that provides a HashForLearning() method. Used with ISimulatedGameAction only by OfflineLearni...
Definition: ISimulatedGameAction.hh:16
grail::simgames::EqualsForOfflineLearning
Helper that provides a EqualsForLearning() method. Used with ISimulatedGameAction only by OfflineLear...
Definition: ISimulatedGameAction.hh:26
grail::simgames::learn::UniqueTreeDataset
Definition: UniqueTreeDataset.hh:23