3 #ifndef GRAIL_PLANNER_REASONER_H
4 #define GRAIL_PLANNER_REASONER_H
6 #include "../GoalSelector.hh"
7 #include "../../GrailCore/Behavior.hh"
8 #include "../../GrailCore/Plan.hh"
9 #include "../../GrailCore/Reasoner.hh"
10 #include "../../GrailData/DebugInfo/PlannerSnapshots.h"
16 using PlannerCallback = std::function<void(
const Plan&,
const planner::Goal&)>;
17 class DomainTranslator;
29 std::size_t maxIterations = 1000;
30 int maxPlanLength = -1;
31 std::size_t iterationsPerFrame = 10;
32 double maxPlanCost = -1;
33 bool usePartialPlans =
true;
38 std::shared_ptr<planner::GoalSelector> goalSelector,
39 std::unique_ptr<planner::DomainTranslator> domainTranslator,
42 virtual void SetNewGoal(std::unique_ptr<planner::Goal> newGoal,
AIEntity& entity)
override;
47 void SetupNewPlanner(std::unique_ptr<planner::DomainTranslator> domainTranslator,
const Config& config);
83 void SetSnapshotProduction(
bool shouldProduce);
84 bool IsComputing()
const;
87 virtual std::unique_ptr<ISnapshotGenerator> CreateSnapshotGenerator(std::size_t)
override;
88 void ClearCurrentDebugSnapshot();
90 void SetDebugSnapshotFirstIteration(std::size_t iterationNumber);
91 void SetDebugSnapshotLastIteration(std::size_t iterationNumber);
92 std::size_t GetDebugSnapshotFirstIteration()
const;
93 std::size_t GetDebugSnapshotLastIteration()
const;
99 std::shared_ptr<planner::GoalSelector> goalSelector;
100 std::unique_ptr<planner::DomainTranslator> domainTranslator;
101 std::unique_ptr<MemoryPool> memory;
104 std::size_t iterationsPerFrame = 0;
105 bool usePartialPlans =
false;
107 std::unique_ptr<planner::Goal> chosenGoal =
nullptr;
108 std::unique_ptr<Behavior> fallbackBehavior =
nullptr;
110 PlannerCallback onPlanningSucceeded;
111 PlannerCallback onPartialPlanFound;
113 std::function<void()> onPlanExecuted;
117 bool produceSnapshot =
false;
120 std::size_t debugSnapshotFirstIteration = 0;
121 std::size_t debugSnapshotLastIteration = std::numeric_limits<std::size_t>::max();
126 #endif //GRAIL_PLANNER_REASONER_H