Grail (C#)  1.4.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
Grail.Planners.WorldState Class Reference

A class representing the planner state.
The state consists of WorldObjects. The planner aims to find the most cost-effective path from the initial state to the goal state.
The WorldState also determines action-related aspects such as their legality. WorldStates can be modified through applying actions' effects. More...

Inheritance diagram for Grail.Planners.WorldState:
Collaboration diagram for Grail.Planners.WorldState:

Public Member Functions

 WorldState (WorldState other)
 Constructs a new WorldState object that is a copy of the provided WorldState object.
Apart from the domain, it will perform deep copying. More...
 
 WorldState (Domain domain, List< WorldObject > objects)
 Constructs a new WorldState object based on a domain and initial objects. More...
 
override bool Equals (object obj)
 
override int GetHashCode ()
 
WorldObject GetObjectByIndex (int index)
 Retrieves an existing WorldObject stored at the provided index. The index serves as a unique ID. More...
 
WorldObject AddObject (string typeName)
 Creates a new WorldObject of the provided type and queues it for adding to the WorldState. The addition will be executed at the end of the current planner iteration.
The object will be created with default parameters which you can change later. More...
 
void RemoveObject (int objectIndex)
 Adds the object specified by objectIndex to the set of objects that should be removed at the end of the current planner iteration. More...
 
List< WorldObjectGetObjectsOfType (string typeName)
 
int CountObjectsOfType (string typeName)
 
Returns
The number of objects of given type, including all derived types.

 
override string ToString ()
 
- Public Member Functions inherited from Grail.Planners.ParametrizedObject
void MergeParameters (ParametrizedObject other)
 Adds parameters from the other object to the own one, replacing parameters with those of other in case of conflict. More...
 
int GetParametersSize ()
 
Returns
The number of parameters assigned to this object

 
bool Contains (string name)
 
Returns
true if the object contains a parameter with the given name, false otherwise

 
void SetParameter< ParameterType > (string name, ParameterType value)
 Sets a value of a parameter identified by the given name. More...
 
ParameterType GetParameterValue< ParameterType > (string name)
 Fetches the value of a parameter identified with the given name as a given ParameterType. Make sure to provide the correct ParameterType. More...
 
bool CollectionContains (string collectionName, int objectIndex)
 
void AddCollection (string collectionName)
 Creates a named collection object, which can be used to group many IDs of objects together.
The name should be unique or you will otherwise override an existing collection. More...
 
SortedSet< int > GetCollection (string collectionName)
 
bool HasEqualParams (ParametrizedObject other)
 
Returns
true if the other object contains identical set of parameters (including the contents of collections)

 

Public Attributes

Dictionary< int, WorldObjectObjects => objects
 Returns a dictionary of WorldObjects: the building blocks of the state. More...
 
Domain Domain => domain
 Gets the domain of the same planning problem as this state corresponds to. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Grail.Planners.ParametrizedObject
 ParametrizedObject (ParametrizedObject other)
 

Detailed Description

A class representing the planner state.
The state consists of WorldObjects. The planner aims to find the most cost-effective path from the initial state to the goal state.
The WorldState also determines action-related aspects such as their legality. WorldStates can be modified through applying actions' effects.

Constructor & Destructor Documentation

◆ WorldState() [1/2]

Grail.Planners.WorldState.WorldState ( WorldState  other)
inline

Constructs a new WorldState object that is a copy of the provided WorldState object.
Apart from the domain, it will perform deep copying.

◆ WorldState() [2/2]

Grail.Planners.WorldState.WorldState ( Domain  domain,
List< WorldObject objects 
)
inline

Constructs a new WorldState object based on a domain and initial objects.

Parameters
domainThe planning domain of the space this state belongs to.
objectsThe initial list of world objects building the state.

Member Function Documentation

◆ AddObject()

WorldObject Grail.Planners.WorldState.AddObject ( string  typeName)
inline

Creates a new WorldObject of the provided type and queues it for adding to the WorldState. The addition will be executed at the end of the current planner iteration.
The object will be created with default parameters which you can change later.

Parameters
typeNameThe name of the type of the object to create.
Returns
The created object.

◆ GetObjectByIndex()

WorldObject Grail.Planners.WorldState.GetObjectByIndex ( int  index)
inline

Retrieves an existing WorldObject stored at the provided index. The index serves as a unique ID.

Parameters
indexThe index of the object to return.
Returns
The retrieved object or null if there is no object under the provided index.

◆ RemoveObject()

void Grail.Planners.WorldState.RemoveObject ( int  objectIndex)
inline

Adds the object specified by objectIndex to the set of objects that should be removed at the end of the current planner iteration.

returns>All objects of the given type, including all derived types.

Member Data Documentation

◆ Domain

Domain Grail.Planners.WorldState.Domain => domain

Gets the domain of the same planning problem as this state corresponds to.

◆ Objects

Dictionary<int, WorldObject> Grail.Planners.WorldState.Objects => objects

Returns a dictionary of WorldObjects: the building blocks of the state.


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