![]() |
Grail (C++)
1.3.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
|
The main class responsible for finding paths in plan space. More...
#include <Planner.hh>
Classes | |
| struct | AbstractPlan |
| struct | Config |
Public Member Functions | |
| Planner (std::unique_ptr< WorldState > initialState, const Config &config=Config{}) | |
| void | SetIterationLimit (std::size_t iterationLimit) |
| SetIterationLimit - sets maximum number of plans that can be generated during calculations. More... | |
| void | SetMaxPlanLength (int maxLength) |
| SetMaxPlanLength - Limits generated plans to not exceed given number of steps to achieve goal conditions. More... | |
| void | SetMaxPlanCost (double maxCost) |
| SetMaxPlanCost - Limits generated plans cost needed to achieve goal conditions. More... | |
| void | SetHeuristic (PlannerHeuristic heuristic) |
| SetHeuristic - Gives planner a way to evaluate calculated plans. More... | |
| void | ResetConfig (const Config &config) |
| ResetConfig - Sets planner config: max iteration, cost, length, plan heuristic, and node count. More... | |
| void | PushCondition (ConditionFunction condition) |
| AbstractPlan | GetPartialPlan () const |
| GetPartialPlan - returns currently best plan, regardless if goal conditions are met. Will return an empty plan if no calculations were finished. More... | |
| data::PlannerIterationSnapshot | GetPlanSnapshot (std::size_t goalNodeIndex, std::size_t iteration) const |
| GetPlanSnapshot - Get debug data on a single iteration of a plan. More... | |
| void | Iterate (std::size_t iterationCount) noexcept |
| Iterate - Formulate a plan trying to meet goalConditions from initialState. Evaluates plan using nodes dijkstraScore and aStarScore. More... | |
| void | IterateWithSnapshot (std::size_t iterationCount, data::PlannerReasonerSnapshot &snapshot, std::size_t minDebugSnapshotIteration=0, std::size_t maxDebugSnapshotIteration=std::numeric_limits< std::size_t >::max()) noexcept |
| IterateWithSnapshot - Formulates a plan trying to meet goalConditions from initialState. Outputs debug data during every iteration if not limited by min or max snapshot iteration parameters. More... | |
| void | SetPlanFoundCallback (const std::function< void(const AbstractPlan &)> callbackFunction) |
| SetPlanFoundCallback - Binds a function handle to call if a sufficient plan is found. Best plan will be passed as function argument. More... | |
| void | SetPlanningFailedCallback (const std::function< void()> callbackFunction) |
| SetPlanningFailedCallback - Binds a function handle to call if no sufficient plan was found. More... | |
| void | Reset (std::unique_ptr< WorldState > initialState) |
| Reset - Resets planner to given world state. Any existing plans and goal conditions will be cleared. More... | |
| bool | IsComputing () const |
| IsComputing - Returns true if no suitable plan was found and planning hasn't failed. This does not mean that planner is currently formulating a plan. More... | |
The main class responsible for finding paths in plan space.
| Planner::AbstractPlan grail::planner::Planner::GetPartialPlan | ( | ) | const |
GetPartialPlan - returns currently best plan, regardless if goal conditions are met. Will return an empty plan if no calculations were finished.
| data::PlannerIterationSnapshot grail::planner::Planner::GetPlanSnapshot | ( | std::size_t | goalNodeIndex, |
| std::size_t | iteration | ||
| ) | const |
| bool grail::planner::Planner::IsComputing | ( | ) | const |
IsComputing - Returns true if no suitable plan was found and planning hasn't failed. This does not mean that planner is currently formulating a plan.
|
noexcept |
Iterate - Formulate a plan trying to meet goalConditions from initialState. Evaluates plan using nodes dijkstraScore and aStarScore.
| iterationCount | Max number of plan iterations to calculate |
|
noexcept |
IterateWithSnapshot - Formulates a plan trying to meet goalConditions from initialState. Outputs debug data during every iteration if not limited by min or max snapshot iteration parameters.
| iterationCount | Max number of plan iterations to calculate |
| snapshot | Plan debug data |
| minDebugSnapshotIteration | Min number of plan iterations to include in debug data from |
| maxDebugSnapshotIteration | Max number of plan iteration to include in debug data |
| void grail::planner::Planner::PushCondition | ( | ConditionFunction | condition | ) |
Adds a single goal condition to the planner
| condition | - a boolean function representing a single goal condition |
| void grail::planner::Planner::Reset | ( | std::unique_ptr< WorldState > | initialState | ) |
Reset - Resets planner to given world state. Any existing plans and goal conditions will be cleared.
| initialState | New WorldState planner will start formulating plans from |
| void grail::planner::Planner::ResetConfig | ( | const Config & | config | ) |
ResetConfig - Sets planner config: max iteration, cost, length, plan heuristic, and node count.
TODO rename?
| config | New planner config |
| void grail::planner::Planner::SetHeuristic | ( | PlannerHeuristic | heuristic | ) |
SetHeuristic - Gives planner a way to evaluate calculated plans.
| heuristic | Plan evaluation heuristic |
| void grail::planner::Planner::SetIterationLimit | ( | std::size_t | iterationLimit | ) |
SetIterationLimit - sets maximum number of plans that can be generated during calculations.
| iterationLimit | Iteration limit |
| void grail::planner::Planner::SetMaxPlanCost | ( | double | maxCost | ) |
SetMaxPlanCost - Limits generated plans cost needed to achieve goal conditions.
| maxCost | Maximum plan cost |
| void grail::planner::Planner::SetMaxPlanLength | ( | int | maxLength | ) |
SetMaxPlanLength - Limits generated plans to not exceed given number of steps to achieve goal conditions.
TODO unsigned or size_t ? can negative depth be useful?
| maxLength | Maximum number of plan steps |
| void grail::planner::Planner::SetPlanFoundCallback | ( | const std::function< void(const AbstractPlan &)> | callbackFunction | ) |
SetPlanFoundCallback - Binds a function handle to call if a sufficient plan is found. Best plan will be passed as function argument.
| callbackFunction | Function to call if plan is found |
| void grail::planner::Planner::SetPlanningFailedCallback | ( | const std::function< void()> | callbackFunction | ) |
SetPlanningFailedCallback - Binds a function handle to call if no sufficient plan was found.
| callbackFunction | Function to call if planning failed |