25 #include <utils/search/astar.h>
65 while (!open_list.empty()) {
66 best = open_list.top();
78 std::vector<AStarState *>
82 while (open_list.size() > 0) {
83 best = open_list.top();
89 open_list.push(initialState);
90 return solution_sequence(
search());
99 std::vector<AStarState *> children;
102 while (open_list.size() > 0) {
105 if (open_list.size() > 0) {
106 best = open_list.top();
111 }
while (closed_list.find(key) != closed_list.end());
114 closed_list[key] = best;
122 for (
unsigned int i = 0; i < children.size(); i++)
123 open_list.push(children[i]);
133 std::vector<AStarState *>
134 AStar::solution_sequence(AStarState *node)
137 AStarState *state = node;
140 closed_list.erase(state->key());
141 solution.insert(solution.begin(), state);
142 state = state->parent;
146 while (closed_list.size() > 0) {
147 state = closed_list.begin()->second;
148 closed_list.erase(state->key());
This is the abstract(!) class for an A* State.
virtual std::vector< AStarState * > children()=0
Generate all successors and put them to this vector.
virtual size_t key()=0
Generates a unique key for this state.
virtual bool is_goal()=0
Check, wether we reached a goal or not.
std::vector< AStarState * > solve(AStarState *initialState)
Solves a situation given by the initial state with AStar, and returns a vector of AStarStates that so...
This class tries to translate the found plan to interpreteable data for the rest of the program.
Fawkes library namespace.