Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
astar_state.h
1 
2 /***************************************************************************
3  * astar_state.h - Abstract class of a astar state.
4  *
5  * Generated: Mon Sep 15 18:48:00 2002
6  * Copyright 2002-2007 Stefan Jacobs, Martin Liebenberg
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef _ASTAR_ABSTRACT_STATE_H_
25 #define _ASTAR_ABSTRACT_STATE_H_
26 
27 #include <vector>
28 
29 namespace fawkes {
30 
31 /** @class AStarState <utils/search/astar_state.h>
32  * This is the abstract(!) class for an A* State.
33  *
34  * @author Stefan Jacobs
35  */
37 {
38  public:
39 
40  /** Constructor. */
41  AStarState() {};
42 
43  /** Destructor. */
44  virtual ~AStarState() {};
45 
46 
47  // ***** You have to implement the following 4 methods! ***** //
48  // ***** ============================================== ***** //
49 
50  /** Generates a unique key for this state.
51  * There has to be a unique key for each state (fast closed list -> bottleneck!)
52  * @return unique long key
53  */
54  virtual long calculateKey() = 0;
55 
56  /** Estimate the heuristic cost to the goal.
57  * @return estimated cost as double
58  */
59  virtual double estimate() = 0;
60 
61  /** Check, wether we reached a goal or not.
62  * @return true, if this state is a goal, else false
63  */
64  virtual bool isGoal() = 0;
65 
66  /** Generate all successors and put them to this vector.
67  * @return a vector of pointers of AStarState to a successor
68  */
69  virtual std::vector< AStarState * > generateChildren() = 0;
70 
71  /** Predecessor. */
73 
74  /** Past cost. */
75  double pastCost;
76  /** Total estimated cost. */
78 
79  /** The unique key of this state. */
80  long key;
81 };
82 
83 } // end namespace fawkes
84 
85 #endif
This is the abstract(!) class for an A* State.
Definition: astar_state.h:36
virtual std::vector< AStarState * > generateChildren()=0
Generate all successors and put them to this vector.
virtual double estimate()=0
Estimate the heuristic cost to the goal.
double pastCost
Past cost.
Definition: astar_state.h:75
AStarState()
Constructor.
Definition: astar_state.h:41
long key
The unique key of this state.
Definition: astar_state.h:80
double totalEstimatedCost
Total estimated cost.
Definition: astar_state.h:77
virtual bool isGoal()=0
Check, wether we reached a goal or not.
AStarState * father
Predecessor.
Definition: astar_state.h:72
virtual long calculateKey()=0
Generates a unique key for this state.
virtual ~AStarState()
Destructor.
Definition: astar_state.h:44