Fawkes API  Fawkes Development Version
astar.h
1 
2 /***************************************************************************
3  * astar.h - Implementation of A*
4  *
5  * Created: Mon Sep 15 18:39:00 2002
6  * Copyright 2007 Martin Liebenberg
7  * 2002 Stefan Jacobs
8  * 2012 Tim Niemueller [www.niemueller.de]
9  ****************************************************************************/
10 
11 /* This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version. A runtime exception applies to
15  * this software (see LICENSE.GPL_WRE file mentioned below for details).
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU Library General Public License for more details.
21  *
22  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
23  */
24 
25 #ifndef _ABSTRACT_ASTAR_H_
26 #define _ABSTRACT_ASTAR_H_
27 
28 #include <utils/search/astar_state.h>
29 
30 #include <map>
31 #include <queue>
32 #include <vector>
33 
34 namespace fawkes {
35 
36 class AStar
37 {
38 public:
39  AStar();
40  ~AStar();
41 
42  std::vector<AStarState *> solve(AStarState *initialState);
43 
44 private:
45  struct CmpSearchStateCost
46  {
47  bool
48  operator()(AStarState *a1, AStarState *a2) const
49  {
50  return (a1->total_estimated_cost >= a2->total_estimated_cost);
51  }
52  };
53 
54  std::priority_queue<AStarState *, std::vector<AStarState *>, CmpSearchStateCost> open_list;
55  std::map<const size_t, AStarState *> closed_list;
56 
57  AStarState *search();
58 
59  std::vector<AStarState *> solution_sequence(AStarState *node);
60  std::vector<AStarState *> solution;
61 };
62 
63 } // end namespace fawkes
64 
65 #endif
search
This class tries to translate the found plan to interpreteable data for the rest of the program.
fawkes::AStarState::total_estimated_cost
float total_estimated_cost
Total estimated cost.
Definition: astar_state.h:81
fawkes::AStar::~AStar
~AStar()
Destructor.
Definition: astar.cpp:62
fawkes::AStar::solve
std::vector< AStarState * > solve(AStarState *initialState)
Solves a situation given by the initial state with AStar, and returns a vector of AStarStates that so...
Definition: astar.cpp:79
fawkes::AStar::AStar
AStar()
Constructor.
Definition: astar.cpp:55
fawkes
Fawkes library namespace.
fawkes::AStarState
This is the abstract(!) class for an A* State.
Definition: astar_state.h:39
fawkes::AStar
This is an implementation of the A* search algorithm.
Definition: astar.h:37