Grail (C++)
1.4.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
|
#include <WorldState.hh>
Public Member Functions | |
WorldState (MemoryPool *memory, const std::shared_ptr< Domain > &domain, const std::vector< WorldObject > &worldObjects) | |
WorldState (const WorldState &other) | |
WorldState (WorldState &&other)=default | |
WorldState & | operator= (const WorldState &other) |
WorldState & | operator= (WorldState &&other)=default |
bool | operator== (const WorldState &other) const |
std::vector< class Action > | GetLegalActions () const |
std::vector< std::vector< unsigned int > > | GenerateParameterLists (const std::vector< std::vector< unsigned int >> &precedingParameterLists, unsigned int searchedTypeIndex) const |
For internal use only. | |
const WorldObject * | GetObjectByIndex (unsigned int index) const |
WorldObject * | GetObjectByIndex (unsigned int index) |
const std::map< unsigned int, WorldObject > & | GetObjectMap () const |
std::shared_ptr< Domain > | GetDomain () const |
WorldObject & | AddObject (const std::string &typeName) |
void | RemoveObject (unsigned int objectIndex) |
void | AddQueuedObjects () |
void | RemoveQueuedObjects () |
std::vector< const WorldObject * > | GetObjectsOfType (const std::string &typeName) const |
std::vector< WorldObject * > | GetObjectsOfType (const std::string &typeName) |
int | CountObjectsOfType (const std::string &typeName) const |
Public Member Functions inherited from grail::planner::ParametrizedObject | |
void | MergeParameters (const ParametrizedObject &other) |
MergeParameters - Adds other parameters to the own one, replacing parameter with those of other in case of conflict. More... | |
std::size_t | GetParametersSize () const |
bool | Contains (const std::string ¶mName) const |
template<typename ParameterType > | |
void | SetParameter (const std::string ¶mName, const ParameterType ¶mValue) |
template<typename ParameterType > | |
ParameterType | GetParameterValue (const std::string ¶mName) const |
bool | CollectionContains (const std::string &collectionName, unsigned int objectIndex) const |
void | AddCollection (const std::string &collectionName) |
std::set< unsigned int > * | GetCollection (const std::string &name) |
const std::set< unsigned int > * | GetCollection (const std::string &name) const |
bool | HasEqualParams (const ParametrizedObject &other) const |
void | SetSerializeSnapshotFunction (std::function< void(const ParametrizedObject &object, std::map< std::string, std::string > &nameValues)> function) |
SetSerializeSnapshotFunction - Sets a function serializing a snapshot of parameter values to string. More... | |
ParametrizedObject & | operator= (const ParametrizedObject &other) |
ParametrizedObject & | operator= (ParametrizedObject &&other)=default |
Additional Inherited Members | |
Protected Member Functions inherited from grail::planner::ParametrizedObject | |
ParametrizedObject (MemoryPool *memory) | |
ParametrizedObject (const ParametrizedObject &other) | |
ParametrizedObject (ParametrizedObject &&other)=default | |
Protected Attributes inherited from grail::planner::ParametrizedObject | |
std::map< std::string, ObjectParameter * > | parameters {} |
std::map< std::string, std::set< unsigned int > > | indexCollections {} |
MemoryPool * | memory |
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.
grail::planner::WorldState::WorldState | ( | MemoryPool * | memory, |
const std::shared_ptr< Domain > & | domain, | ||
const std::vector< WorldObject > & | worldObjects | ||
) |
Constructs a new WorldState object based on a domain and initial objects.
memory | - the MemoryPool object for memory optimization. |
domain | - the planning domain of the space this state belongs to. |
objects | - the initial list of world objects building the state. |
WorldObject & grail::planner::WorldState::AddObject | ( | const std::string & | typeName | ) |
Creates a new "WorldObject" of the provided type and queues it for addition 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.
typeName | - the name of the type of the object to create. |
int grail::planner::WorldState::CountObjectsOfType | ( | const std::string & | typeName | ) | const |
std::shared_ptr< Domain > grail::planner::WorldState::GetDomain | ( | ) | const |
std::vector< Action > grail::planner::WorldState::GetLegalActions | ( | ) | const |
WorldObject * grail::planner::WorldState::GetObjectByIndex | ( | unsigned int | index | ) |
Retrieves an existing "WorldObject" stored at the provided index. The index serves as a unique ID.
index | - the index of the object to return. |
const WorldObject * grail::planner::WorldState::GetObjectByIndex | ( | unsigned int | index | ) | const |
Retrieves an existing "WorldObject" stored at the provided index. The index serves as a unique ID.
index | - the index of the object to return. |
const std::map< unsigned int, WorldObject > & grail::planner::WorldState::GetObjectMap | ( | ) | const |
std::vector< WorldObject * > grail::planner::WorldState::GetObjectsOfType | ( | const std::string & | typeName | ) |
std::vector< const WorldObject * > grail::planner::WorldState::GetObjectsOfType | ( | const std::string & | typeName | ) | const |
void grail::planner::WorldState::RemoveObject | ( | unsigned int | objectIndex | ) |
Adds the object specified by objectIndex to a set of objects that should be removed at the end of the current planner iteration