 |
Grail (C++)
1.1.1
A multi-platform, modular, universal engine for embedding advanced AI in games.
|
1 #ifndef GRAIL_DECISION_TREE_H
2 #define GRAIL_DECISION_TREE_H
4 #include <initializer_list>
5 #include <unordered_map>
6 #include <unordered_set>
7 #include "DecisionNode.h"
8 #include "../ISimulatedGameHeuristic.hh"
14 class ISimulatedGameAction;
43 virtual std::unique_ptr<ISimulatedGameAction>
GetAction()
const override;
52 void SetColumnNames(
const std::initializer_list<std::string>& consecutiveNames);
62 void ConstructDefaultColumnNames();
64 std::unique_ptr<DecisionNode<ISimulatedGameAction>> root;
65 std::unique_ptr<IVectorizer> vectorizer;
66 std::unordered_set<int> usedConsiderationIndices;
67 std::unordered_map<int, std::string> columnNames;
72 #endif //GRAIL_DECISION_TREE_H
void Deserialize(IDecisionTreeSerializer< ISimulatedGameAction > &serializer)
Populates the tree based on the given serializer.
Definition: DecisionTree.cpp:35
void Print()
Prints the decision tree in a very diagnostic fashion onto standard output (cout).
Definition: DecisionTree.cpp:19
void SetVectorizer(std::unique_ptr< IVectorizer > vectorizer)
Moves the vectorizer passed as parameter to the DecisionTree. The DecisionTree uses it to provide act...
Definition: DecisionTree.cpp:88
Definition: Dataset.hh:19
virtual std::unique_ptr< ISimulatedGameAction > GetAction() const override
Inherited via SimulatedGameHeuristic.
Definition: DecisionTree.cpp:53
IVectorizer & GetVectorizer() const
Returns the reference to the currently used vectorizer by the DecisionTree. Do not use this method,...
Definition: DecisionTree.cpp:83
void SetColumnName(int columnIndex, const std::string &name)
This will make the Print() function output the name instead of Column[columnIndex]....
Definition: DecisionTree.cpp:69
The main class encapsulating the decision tree algorithm.
Definition: DecisionTree.hh:24
A base class for an object that is passed to Serialize() and Deserialize() methods of DecisionTree....
Definition: DecisionTree.hh:19
Interface that encapsulates an algorithm responsible for action-selection inside SimulatedGame (MCTS)...
Definition: ISimulatedGameHeuristic.hh:18
DecisionTree(std::unique_ptr< IVectorizer > vectorizer)
Constructs a new decision tree object. You have to specify a proper vectorizer object that will be us...
Definition: DecisionTree.cpp:13
Classes implementing this interface provide training data in the offline learning process.
Definition: IVectorizer.hh:15
void Construct(Dataset &dataset, int maxDepth=decisionTreeMaxDepth)
Runs the decision tree construction algorithm (C45). @dataset contains the training data....
Definition: DecisionTree.cpp:41
void Serialize(IDecisionTreeSerializer< ISimulatedGameAction > &serializer) const
Serializes the content of the tree into the passed serializer object.
Definition: DecisionTree.cpp:27
virtual bool IsHeuristicSituation(const ISimulatedGameUnit &unit) const override final
Inherited via SimulatedGameHeuristic.
Definition: DecisionTree.cpp:64
void SetColumnNames(const std::initializer_list< std::string > &consecutiveNames)
This will make the Print() function output the names instead of Column[columnIndex]....
Definition: DecisionTree.cpp:74
Base class of a unit in the SimulatedGame framework. A unit represents part of the game-state and pef...
Definition: ISimulatedGameUnit.hh:26