15 #include <unordered_map>
18 template <
class state,
class action>
24 std::vector<state> &thePath);
26 std::vector<action> &thePath);
34 state parent, state currState,
35 std::vector<state> &thePath,
double bound,
double g);
37 action forbiddenAction, state &currState,
38 std::vector<action> &thePath,
double bound,
double g);
47 template <
class state,
class action>
50 std::vector<state> &thePath)
53 nodesExpanded = nodesTouched = 0;
56 DoIteration(env, from, from, thePath, nextBound, 0);
59 template <
class state,
class action>
62 std::vector<action> &thePath)
65 nodesExpanded = nodesTouched = 0;
68 std::vector<action> act;
70 DoIteration(env, act[0], from, thePath, nextBound, 0);
73 template <
class state,
class action>
75 state parent, state currState,
76 std::vector<state> &thePath,
double bound,
double g)
80 std::vector<state> neighbors;
82 nodesTouched += neighbors.size();
84 for (
unsigned int x = 0; x < neighbors.size(); x++)
86 if (neighbors[x] == parent)
91 thePath.push_back(neighbors[x]);
92 double edgeCost = env->
GCost(currState, neighbors[x]);
94 DoIteration(env, currState, neighbors[x], thePath, bound, g+edgeCost);
102 template <
class state,
class action>
104 action forbiddenAction, state &currState,
105 std::vector<action> &thePath,
double bound,
double g)
112 std::vector<action> actions;
114 nodesTouched += actions.size();
115 int depth = thePath.size();
117 for (
unsigned int x = 0; x < actions.size(); x++)
119 if ((depth != 0) && (actions[x] == forbiddenAction))
122 thePath.push_back(actions[x]);
124 double edgeCost = env->
GCost(currState, actions[x]);
131 DoIteration(env, actions[x], currState, thePath, bound, g+edgeCost);