libmove3d-planners
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros Groups Pages
State.hpp
1 /*
2  *
3  * State.h
4  *
5  * This is the header file of a pure virtual base class for the
6  * state class that will be written by the
7  * programmer for his/her own purpose
8  * */
9 
10 #ifndef STATE_H
11 #define STATE_H
12 
13 #include <vector>
14 
15 namespace API
16 {
20  class State
21  {
22  public:
23  State();
24  double computeCost(State *parent, State* goal); /* f (f=g+h) */
25 
26  double f() const; /* get functions for the variables */
27  double g() const;
28  double h() const;
29 
30  // Test that the state is valid
31  virtual bool isValid() { return true; }
32 
33  /* states after branching is returned and the number of
34  non-NULL states in the returned array is saved in the variable nodes_n */
35  virtual std::vector<State*> getSuccessors(State* s);
36  virtual bool isLeaf(); /* leaf control for an admissible heuristic function; the test of h==0*/
37  virtual bool equal(State* other);
38 
39  virtual void setClosed(std::vector<State*>& closedStates,std::vector<State*>& openStates);
40  virtual bool isColsed(std::vector<State*>& closedStates);
41 
42  virtual void setOpen(std::vector<State*>& openStates);
43  virtual bool isOpen(std::vector<State*>& openStates);
44 
45  virtual void reset() {}
46 
47  virtual void print() {}
48 
49  protected:
50  virtual double computeLength(State *parent); /* g */
51  virtual double computeHeuristic(State *parent,State* goal); /* h */
52 
53  private:
54  /* f, g, h values */
55  double _f,_g,_h;
56  };
57 }
58 
59 #endif
60 
++
Definition: State.hpp:20