1 #ifndef GRAIL_UTILITY_REASONER_H
2 #define GRAIL_UTILITY_REASONER_H
4 #include "../GrailSystem/Reasoner.hh"
5 #include "Evaluator.hh"
7 #include "../GrailData/GrailDebugInfo/UtilityReasonerSnapshot.h"
8 #include "../GrailData/UtilityModel/UtilitySelectorModel.h"
29 SelectionMethod selectionMethod = SelectionMethod::MAX,
30 float persistence = 0.1f);
41 std::unique_ptr<ISnapshotGenerator> CreateSnapshotGenerator(
size_t)
override;
43 void SetSnapshotProduction(
bool value);
47 void GenerateOptions(
const AIEntity& entity);
49 void ValidateOperationStack(
const AIEntity& entity);
50 void SelectBehaviorFromStack(
AIEntity& entity);
52 std::map<std::shared_ptr<utility::IEvaluator<EntityBlackboardPair>>,
Prefab<Behavior> > prefabOptions = {};
53 std::stack<std::tuple<Behavior*, std::shared_ptr<utility::IEvaluator<EntityBlackboardPair>>, EntityBlackboardPair>> operationStack{};
54 std::vector< std::pair<EntityBlackboardPair, std::shared_ptr<utility::IEvaluator<EntityBlackboardPair>>>> generatedOptions{};
55 std::shared_ptr<utility::IEvaluator<EntityBlackboardPair>> currentBehaviorEvaluator =
nullptr;
56 EntityBlackboardPair currentBehaviorContext{};
58 SelectionMethod selectionMethod = SelectionMethod::MAX;
60 float persistence = 0.0f;
62 bool produceSnapshot =
false;
64 mutable std::mutex snapshotMutex;
The AIEntity class - Defines a basic object which can execute behaviors.
Definition: AIEntity.hh:39
The Prefab class - responsible for producing contexts and instances of data used by UtilityReasoner.
Definition: Prefab.hh:21
The Reasoner class - Entity's "brain", assigns them behaviors chosen by user-defined algorithms.
Definition: Reasoner.hh:20
Definition: UtilityReasoner.hh:20
void SelectBehavior(AIEntity &entity) override
selectBehavior - Runs reasoner's selection algorithm and assigns chosen behavior to provided entity.
Definition: UtilityReasoner.cpp:25
UtilityReasoner(std::map< std::shared_ptr< utility::IEvaluator< EntityBlackboardPair >>, Prefab< Behavior > > &&prefabOptions, SelectionMethod selectionMethod=SelectionMethod::MAX, float persistence=0.1f)
UtilityReasoner - selects behaviors based on their scores calculated by utility system.
Definition: UtilityReasoner.cpp:9
The Evaluator class - Evaluates object in terms of provided Context.
Definition: IEvaluator.hh:15
Definition: UtilityReasonerSnapshot.h:11