libmove3d-planners
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros Groups Pages
TreePlanner.hpp
1 /*
2  * TreePlanner.hpp
3  *
4  * Created on: Aug 31, 2009
5  * Author: jmainpri
6  */
7 
8 #ifndef TREEPLANNER_HPP_
9 #define TREEPLANNER_HPP_
10 
11 #include "planner/planner.hpp"
12 #include "planner/Diffusion/Variants/BaseExpansion.hpp"
13 
14 
19 {
20 public:
22  TreeExpansion(Graph * graph) : BaseExpansion(graph) {};
23 
25  virtual ~TreeExpansion() {};
26 
28  void expansionSucceeded(Node * node);
29 
31  void expansionFailed(Node * node);
32 };
33 
34 
38 class TreePlanner : public Planner {
39 
40 public:
44  TreePlanner(Robot* R, Graph* G);
45 
49  ~TreePlanner();
50 
54  virtual unsigned init();
55 
60  virtual bool checkStopConditions();
61 
67  virtual bool preConditions();
68 
76  virtual bool connectNodeToComp(Node* N, Node* CompNode);
77 
81  virtual bool connectionToTheOtherCompco(Node* toNode);
82 
88  virtual unsigned int expandOneStep(Node * fromComp) {return 0;}
89 
94  virtual unsigned int run();
95 
100  bool goalBias() const;
101 
103  double getTime();
104 
106  int getRunId() {
107  return m_runId;
108  }
109 
111  void setRunId(int id) {
112  m_runId = id;
113  }
114 
116  unsigned int getNumberOfConsecutiveFail() {
117  return m_nbConscutiveFailures;
118  }
119 
121  unsigned int getNumberOfExpansion() {
122  return m_nbExpansion;
123  }
124 
126  unsigned int getNumberOfFailedExpansion() {
127  return m_nbFailedExpansion;
128  }
129 
131  unsigned int getNumberOfInitialNodes() {
132  return m_nbInitNodes;
133  }
134 
137  return m_last_node;
138  }
139 
140  double getDistanceGap(){ return m_DistanceGap;}
141 
142 protected:
143  int m_runId;
144 
145  unsigned int m_nbConscutiveFailures;
146  unsigned int m_nbExpansion;
147  unsigned int m_nbFailedExpansion;
148  unsigned int m_nbInitNodes;
149  double m_DistanceGap;
150 
151  Node* m_last_node;
152 };
153 
154 #endif /* TREEPLANNER_HPP_ */
void setRunId(int id)
Set the run Id.
Definition: TreePlanner.hpp:111
virtual unsigned int expandOneStep(Node *fromComp)
Expands tree from component fromComp.
Definition: TreePlanner.hpp:88
virtual bool connectNodeToComp(Node *N, Node *CompNode)
Tries to connect a node to the other connected component of the graph.
Definition: TreePlanner.cpp:194
Expansion procedure of the tree planner.
Definition: TreePlanner.hpp:18
bool goalBias() const
Decide whether the goal bias should be applied, based on a random trial.
Definition: TreePlanner.cpp:326
unsigned int getNumberOfInitialNodes()
Return the initial number of nodes.
Definition: TreePlanner.hpp:131
double getTime()
Return time in algorithm: this function must be called after ChronoTimeOfDayOn()
Definition: TreePlanner.cpp:82
Classe représentant un Node d'un Graph.
Definition: node.hpp:39
~TreePlanner()
Destructor.
Definition: TreePlanner.cpp:67
Definition: TreePlanner.hpp:38
Definition: graph.hpp:28
unsigned int getNumberOfExpansion()
Return the number of expansions performed during planification.
Definition: TreePlanner.hpp:121
This class holds a the robot represented by a kinematic chain.
Definition: robot.hpp:42
unsigned int getNumberOfConsecutiveFail()
Return the number of consecutive failures observed during planification.
Definition: TreePlanner.hpp:116
TreeExpansion(Graph *graph)
Constructor.
Definition: TreePlanner.hpp:22
The expansion class holds the method and local variables allowing to expand a Tree in a given configu...
Definition: BaseExpansion.hpp:34
virtual unsigned int run()
Main function of the Tree process.
Definition: TreePlanner.cpp:230
TreePlanner(Robot *R, Graph *G)
Constructor.
Definition: TreePlanner.cpp:57
virtual bool preConditions()
Checks out the Pre-conditions.
Definition: TreePlanner.cpp:93
int getRunId()
Get the run Id.
Definition: TreePlanner.hpp:106
virtual bool connectionToTheOtherCompco(Node *toNode)
Main function to connect to the other Connected Component.
Definition: TreePlanner.cpp:202
virtual unsigned init()
Initializes Planner.
Definition: TreePlanner.cpp:70
Base class for planning algorithms.
Definition: planner.hpp:28
void expansionSucceeded(Node *node)
Actions to be done after the expansion attempted from the given node, in case of success.
Definition: TreePlanner.cpp:33
virtual ~TreeExpansion()
Destructor.
Definition: TreePlanner.hpp:25
virtual bool checkStopConditions()
Check the stopping conditions of the Tree Planner.
Definition: TreePlanner.cpp:158
void expansionFailed(Node *node)
Actions to be done after the expansion attempted from the given node, in case of failure.
Definition: TreePlanner.cpp:43
unsigned int getNumberOfFailedExpansion()
Return the number of expansion that failed during planification.
Definition: TreePlanner.hpp:126
Node * getLastNode()
Return the last node added to the graph.
Definition: TreePlanner.hpp:136