Fawkes API Fawkes Development Version
fawkes::stn::StnAction Class Reference

An action representation within an STN. More...

#include "stn_action.h"

Public Member Functions

 StnAction (const std::string &name, const std::vector< Predicate > &preconds, const std::vector< Predicate > &effects, const std::string &opts, size_t duration=0, const std::vector< std::string > &cond_breakups={}, const std::vector< std::string > &temp_breakups={})
 Constructor. More...
 
bool operator== (const StnAction &o)
 Compare two StnActions. More...
 
bool operator!= (const StnAction &o)
 Compare two StnActions. More...
 
size_t id () const
 Get the ID of the action. More...
 
bool checkForBreakup (EdgeType t, const Predicate &p) const
 Check if the given predicate is a breakup. More...
 
std::vector< size_t > condActionIds () const
 Get all IDs of this StnAction's conditional actions. More...
 
std::string genGraphNodeName () const
 Get a string representation of the StnAction for the graph representation. More...
 
std::string genConditionEdgeLabel (size_t cond_action) const
 Generate an edge label for the graph representation. More...
 
std::string genTemporalEdgeLabel () const
 Generate a temporal edge for the graph representation. More...
 
void genConditionalActions (std::vector< StnAction > candidate_actions)
 Generate the conditional actions of this StnAction. More...
 
const std::vector< Predicate > & effects () const
 Get the effects of the StnAction. More...
 
std::string name () const
 Get the name of the StnAction. More...
 
size_t duration () const
 Get the duration of the StnAction. More...
 
std::string opts () const
 Get the action parameters. More...
 

Friends

std::ostream & operator<< (std::ostream &, const StnAction &)
 Print relevant information about the StnAction. More...
 

Detailed Description

An action representation within an STN.

Definition at line 40 of file stn_action.h.

Constructor & Destructor Documentation

◆ StnAction() [1/2]

fawkes::stn::StnAction::StnAction ( const std::string &  name,
const std::vector< Predicate > &  preconds,
const std::vector< Predicate > &  effects,
const std::string &  opts,
size_t  duration = 0,
const std::vector< std::string > &  cond_breakups = {},
const std::vector< std::string > &  temp_breakups = {} 
)

Constructor.

Parameters
nameThe name of the new action.
precondsA Vector of Predicates that must be satisfied to execute the action.
effectsA vector of Predicates that are applied after the action is executed.
optsThe action parameters.
durationThe duration of the action.
cond_breakupsA vector of conditional breakups as strings.
temp_breakupsA vector of temporal breakups as strings.

Definition at line 44 of file stn_action.cpp.

◆ StnAction() [2/2]

fawkes::stn::StnAction::StnAction ( )
inline

Definition at line 50 of file stn_action.h.

◆ ~StnAction()

virtual fawkes::stn::StnAction::~StnAction ( )
inlinevirtual

Definition at line 51 of file stn_action.h.

Member Function Documentation

◆ checkForBreakup()

bool fawkes::stn::StnAction::checkForBreakup ( EdgeType  t,
const Predicate p 
) const

Check if the given predicate is a breakup.

Parameters
tThe type of of breakup to check.
pThe Predicate to check.
Returns
True iff a breakup by the given predicate is possible.

Definition at line 150 of file stn_action.cpp.

References fawkes::stn::Predicate::name().

Referenced by genConditionalActions().

◆ condActionIds()

std::vector< size_t > fawkes::stn::StnAction::condActionIds ( ) const

Get all IDs of this StnAction's conditional actions.

Returns
A vector of IDs.

Definition at line 135 of file stn_action.cpp.

◆ duration()

size_t fawkes::stn::StnAction::duration ( ) const

Get the duration of the StnAction.

Returns
The duration.

Definition at line 286 of file stn_action.cpp.

◆ effects()

const std::vector< Predicate > & fawkes::stn::StnAction::effects ( ) const

Get the effects of the StnAction.

Returns
A vector of Predicates that are part of the effect.

Definition at line 268 of file stn_action.cpp.

◆ genConditionalActions()

void fawkes::stn::StnAction::genConditionalActions ( std::vector< StnAction candidate_actions)

Generate the conditional actions of this StnAction.

Parameters
candidate_actionsThe actions to be considered as conditional actions.

Definition at line 224 of file stn_action.cpp.

References checkForBreakup().

◆ genConditionEdgeLabel()

std::string fawkes::stn::StnAction::genConditionEdgeLabel ( size_t  cond_action) const

Generate an edge label for the graph representation.

Parameters
cond_actionThe ID of the conditional action to represent.
Returns
The string describing the conditional action.

Definition at line 186 of file stn_action.cpp.

References fawkes::stn::Predicate::attrs(), fawkes::stn::Predicate::condition(), and fawkes::stn::Predicate::name().

◆ genGraphNodeName()

std::string fawkes::stn::StnAction::genGraphNodeName ( ) const

Get a string representation of the StnAction for the graph representation.

Returns
The string describing the StnAction.

Definition at line 176 of file stn_action.cpp.

◆ genTemporalEdgeLabel()

std::string fawkes::stn::StnAction::genTemporalEdgeLabel ( ) const

Generate a temporal edge for the graph representation.

Returns
The string label for the temporal edge.

Definition at line 212 of file stn_action.cpp.

◆ id()

size_t fawkes::stn::StnAction::id ( ) const

Get the ID of the action.

Returns
The unique ID.

Definition at line 126 of file stn_action.cpp.

◆ name()

std::string fawkes::stn::StnAction::name ( ) const

Get the name of the StnAction.

Returns
The name as string.

Definition at line 277 of file stn_action.cpp.

◆ operator!=()

bool fawkes::stn::StnAction::operator!= ( const StnAction o)

Compare two StnActions.

Parameters
oThe other StnAction.
Returns
True iff the two actions have different IDs.

Definition at line 117 of file stn_action.cpp.

◆ operator==()

bool fawkes::stn::StnAction::operator== ( const StnAction o)

Compare two StnActions.

Parameters
oThe other StnAction.
Returns
True iff the two actions have the same ID.

Definition at line 107 of file stn_action.cpp.

◆ opts()

std::string fawkes::stn::StnAction::opts ( ) const

Get the action parameters.

Returns
The parameters as string.

Definition at line 295 of file stn_action.cpp.

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  strm,
const StnAction a 
)
friend

Print relevant information about the StnAction.

Parameters
strmThe stream to print the information to.
aThe action to show the information about.

Definition at line 66 of file stn_action.cpp.


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