AI Toolkit
Loading...
Searching...
No Matches
aitoolkit::goap::plan< T > Class Template Reference

A plan is a sequence of actions that will lead to a goal state. More...

#include <goap.hpp>

Public Member Functions

size_t size () const
 Get the number of actions in the plan.
 
 operator bool () const
 Check if the plan is empty.
 
void run_next (T &blackboard)
 Execute the next planned action.
 

Friends

plan< T > planner (std::vector< action_ptr< T > > actions, T initital_blackboard, T goal_blackboard, size_t max_iterations)
 Create a plan.
 

Detailed Description

template<blackboard_trait T>
class aitoolkit::goap::plan< T >

A plan is a sequence of actions that will lead to a goal state.

Friends And Related Symbol Documentation

◆ planner

template<blackboard_trait T>
plan< T > planner ( std::vector< action_ptr< T > > actions,
T initital_blackboard,
T goal_blackboard,
size_t max_iterations = 0 )
friend

Create a plan.

The plan is created by providing a list of actions, an initial blackboard state, and a goal blackboard state. The plan will then find a sequence of actions that will lead to the goal state.

Parameters
actionsThe list of actions that can be performed.
initital_blackboardThe initial state of the blackboard.
goal_blackboardThe goal state of the blackboard.
max_iterationsThe maximum number of iterations to perform before giving up. If 0, the plan will run until it finds a solution.
Returns
A plan that can be executed.