1 #ifndef SEARCHPROBLEM_HPP_INCLUDED
2 #define SEARCHPROBLEM_HPP_INCLUDED
8 template <
class StateType,
class ActionType>
31 if(index < 0 || index >=
states.size())
32 throw "Index out of bounds!";
37 if(index < 0 || index >=
actions.size())
38 throw "Index out of bounds!";
43 if(index < 0 || index >=
states.size())
44 throw "Index out of bounds!";
46 typename std::list<StateType>::iterator iter =
states.begin();
47 std::advance(iter, index);
52 if(index < 0 || index >=
actions.size())
53 throw "Index out of bounds!";
54 typename std::list<ActionType>::iterator iter =
actions.begin();
55 std::advance(iter, index);
80 template <
class StateType,
class ActionType>
86 virtual StateType
getResult(StateType state, ActionType action) = 0;
87 virtual bool isGoal(StateType tate) = 0;
88 virtual double getStepCost(StateType state, ActionType action) { (void)state; (void)action;
return 1; }
103 #endif // SEARCHPROBLEM_HPP_INCLUDED
void addAction(ActionType action)
virtual StateType getStartState()=0
virtual bool isGoal(StateType tate)=0
bool containsState(StateType state)
virtual double getStepCost(StateType state, ActionType action)
void setAction(ActionType action, int index)
virtual StateType getResult(StateType state, ActionType action)=0
Path(const Path< StateType, ActionType > &p)
std::list< ActionType > actions
virtual double getHeuristicCost(StateType state)
std::list< StateType > * getStates()
void addState(StateType state)
ActionType getAction(unsigned int index)
std::list< StateType > states
virtual std::list< ActionType > getActions(StateType state)=0
double getPathCost(Path< StateType, ActionType > *path)
std::list< ActionType > * getActions()
StateType getState(unsigned int index)
void setState(StateType state, int index)