Grail (C++)  1.3.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
grail::planner::PlannerReasoner Class Referencefinal

A reasoner which uses planners to find optimal sequences of behaviors based on goals. More...

#include <PlannerReasoner.hh>

Inheritance diagram for grail::planner::PlannerReasoner:
Collaboration diagram for grail::planner::PlannerReasoner:

Classes

struct  Config
 

Public Member Functions

 PlannerReasoner (std::unique_ptr< MemoryPool > memory)
 
 PlannerReasoner (std::unique_ptr< MemoryPool > memory, std::shared_ptr< planner::GoalSelector > goalSelector, std::unique_ptr< planner::DomainTranslator > domainTranslator, const Config &config)
 
virtual void StageBehavior (AIEntity &entity) override
 selectBehavior - Runs reasoner's selection algorithm and assigns chosen behavior to provided entity. More...
 
virtual void SetNewGoal (std::unique_ptr< planner::Goal > newGoal, AIEntity &entity) override
 
void SetupNewPlanner (std::unique_ptr< planner::DomainTranslator > domainTranslator, const Config &config)
 
void SetFallbackBehavior (std::unique_ptr< Behavior > behavior)
 Sets the behavior that should be performed during plan computation or if no valid plan is found.
 
virtual const planner::GoalGetCurrentGoal () const override
 
void BindPlanningSucceededCallback (PlannerCallback callback)
 BindPlanningSucceededCallback - Binds a function handle to call if a sufficient (all goal conditions and plan restrictions met) plan is found. Found plan will be passed as function argument. More...
 
void BindPartialPlanFoundCallback (PlannerCallback callback)
 BindPartialPlanFoundCallback - Bind a function to call when no sufficient plan could be found, but some plan was formulated, this delegate will be called instead of onPlanningFailed. usePartialPlans needs to be true for this execute Plan with highest score will be passed as a function argument. More...
 
void BindPlanningFailedCallback (std::function< void(const planner::Goal &)> callback)
 BindPlanningFailedCallback - Bind a function to call when no sufficient plan was found. If reasoner uses partial plans this will only be called if no plan was formulated at all. More...
 
void BindPlanExecutedCallback (std::function< void()> callback)
 BindPlanExecutedCallback - Bind a function to call when entity has successfully executed chosen plan. More...
 
void SetSnapshotProduction (bool shouldProduce)
 
bool IsComputing () const
 
data::PlannerReasonerSnapshot ProduceDebugSnapshot ()
 
virtual std::unique_ptr< ISnapshotGeneratorCreateSnapshotGenerator (std::size_t) override
 
void ClearCurrentDebugSnapshot ()
 
void SetDebugSnapshotFirstIteration (std::size_t iterationNumber)
 
void SetDebugSnapshotLastIteration (std::size_t iterationNumber)
 
std::size_t GetDebugSnapshotFirstIteration () const
 
std::size_t GetDebugSnapshotLastIteration () const
 
- Public Member Functions inherited from grail::Reasoner
 Reasoner (const Reasoner &)=default
 
 Reasoner (Reasoner &&)=default
 
Reasoneroperator= (const Reasoner &)=default
 
Reasoneroperator= (Reasoner &&)=default
 
virtual std::unique_ptr< ISnapshotGeneratorCreateSnapshotGenerator (size_t)
 

Detailed Description

A reasoner which uses planners to find optimal sequences of behaviors based on goals.

Member Function Documentation

◆ BindPartialPlanFoundCallback()

void grail::planner::PlannerReasoner::BindPartialPlanFoundCallback ( PlannerCallback  callback)

BindPartialPlanFoundCallback - Bind a function to call when no sufficient plan could be found, but some plan was formulated, this delegate will be called instead of onPlanningFailed. usePartialPlans needs to be true for this execute Plan with highest score will be passed as a function argument.

Parameters
callbackFunction to call if a partial plan is found

◆ BindPlanExecutedCallback()

void grail::planner::PlannerReasoner::BindPlanExecutedCallback ( std::function< void()>  callback)

BindPlanExecutedCallback - Bind a function to call when entity has successfully executed chosen plan.

Parameters
callbackFunction to call when plan goal is achieved

◆ BindPlanningFailedCallback()

void grail::planner::PlannerReasoner::BindPlanningFailedCallback ( std::function< void(const planner::Goal &)>  callback)

BindPlanningFailedCallback - Bind a function to call when no sufficient plan was found. If reasoner uses partial plans this will only be called if no plan was formulated at all.

Parameters
callbackfunction to call if planning failed

◆ BindPlanningSucceededCallback()

void grail::planner::PlannerReasoner::BindPlanningSucceededCallback ( PlannerCallback  callback)

BindPlanningSucceededCallback - Binds a function handle to call if a sufficient (all goal conditions and plan restrictions met) plan is found. Found plan will be passed as function argument.

Parameters
callbackFunction to call if a suitable plan is found

◆ SetupNewPlanner()

void grail::planner::PlannerReasoner::SetupNewPlanner ( std::unique_ptr< planner::DomainTranslator domainTranslator,
const Config config 
)

Resets the planner domain. based on data provided by the new domain translator . This method can be used if you want the agent to start planning an entirely different set of actions and disregard the previously defined domain.

◆ StageBehavior()

void grail::planner::PlannerReasoner::StageBehavior ( AIEntity entity)
overridevirtual

selectBehavior - Runs reasoner's selection algorithm and assigns chosen behavior to provided entity.

Parameters
entity

Implements grail::Reasoner.


The documentation for this class was generated from the following files: