libmove3d  3.13.0
/home/slemaign/softs-local/BioMove3D-git/include/roadmap.h
00001 #ifndef _ROADMAP_H
00002 #define _ROADMAP_H
00003 
00004 #include "stat.h" // Statistic module; Commit Jim; date: 01/10/2008
00005 #include <vector>
00006 
00011 typedef struct node {
00012   int         type; /* type du noeud (isole,...) */
00013   int         num; /* numero du noeud dans le graphe */
00014   int         numcomp; /* numero de la composante connexe du noeud */
00015   struct compco *comp;
00016   configPt q; /* la configuration du robot */
00017   double* coldeg_q; /*configuration in the space of the collective degrees */ // Modif Juan
00018   double      dq; /* le rayon de la boule */
00019   int *iksol;  /* index of the solution generated by the cntrt (modif Juan) */
00020   double dqmin;
00021   int nneighb;    /* nombre de voisins dans le graphe */
00022   struct list_node *neighb; /* voisins du noeud dans le graphe */
00023   struct list_node *last_neighb;
00024   int nedge;    /* nombre d'arete partant du noeud dans le graphe */
00025   struct list_edge *edges; /* aretes reliant le noeud a ses voisins */
00026   struct list_edge *last_edge; /* aretes reliant le noeud a ses voisins */
00027   double dist_Nnew; /* distance au noeud courant cree */
00028   /* for graph exploration Astar*/
00029   double f;                /*g+h*/
00030   double g;                /*Real cost from the init node*/
00031   double h;                /*heuristic cost to goal node*/
00032   short opened;            /* whether node is open in A* search */
00033   short closed;            /* whether node is closed in A* search */
00034   struct node *search_from; /* parent node in A* search */
00035   struct node *search_to;  /* child node in A* search */
00036   struct edge *edge_from;  /* edge connecting to node search from */
00037   int n_fail_extend;       // modif Juan (test)
00038   int n_extend;            // modif Juan (test)
00039   double weight;           // modif Juan (test)
00040   /* for graph search DFS*/
00041   int discovered;
00042   int processed;
00043 
00044   /* cost of a node according to the cost function in a space */
00045   double cost;
00046 
00047   /* total cost from the root node to the current node in the tree
00048      graph (for diffusion techniques) */
00049   double sumCost;
00050 
00051   /* Position of the node in the tree starting from the root node. The
00052      goal nodes have a rank of 1 and all the sons of a node of rank n
00053      have a rank of n+1 */
00054   int rankFromRoot;
00055 
00056   /* Flag TRUE if a node is discarded for the selection as nearest
00057      neighbor*/
00058   int IsDiscarded;
00059 
00060  /* Used in cost space problems. Current node temperature. */
00061   double temp;
00062 
00063   /*Used in cost space problems. Number of consecutive times the node
00064     failed to be extended due to the temperature in the cost test */
00065   int nbFailedTemp;
00066 
00067   /* Used in cost space problems. Number of consecutive times the node
00068      create a son with a cost inferior than its own cost.
00069      Warning: this variable is currently no more used*/
00070   // int NbDown;
00071 
00072   /* Used in the p3d_OrderingGraphSearch algorithm,
00073      variant of the astar algorithm that is used if the flag
00074      GlobalOrdering is set to TRUE*/
00075   dbl_list* orderCostListEdge;
00076 
00077 
00078   double avr_dist;         // modif Noureddine
00079   double min_dist;         // modif Noureddine
00080   double E;                // modif Noureddine
00081   struct node *parent;     // modif Juan (test)
00082   p3d_matrix4 RelMobFrame;
00083   double radius; /* modif Leonard */
00084   int pinpointed;          // flag to indicate pinpointed node (for graph displaying)
00085   int boundary; /* say if the node is a boundary node or not (Leonard) */
00086 
00087   int is_dist_sc_ligand_checked;
00088   int* list_closed_flex_sc;   //table of the size of nb flexible sc.
00089                               // list_closed_flex_sc[i] = 1 if the ligand and sc are closed,
00090                               // 0 otherwise
00091   int isSingularity;
00092   //start path deform
00093   int only_for_cycle; /*flag for nodes used in cycling graphs */
00094   int visible;
00095   //end path deform
00096 
00097   p3d_vector3 g3d_position; // 3d position of the node when drawing the graph
00098   bool g3d_position_flag;
00099 #ifdef MULTIGRAPH
00100   int mergeState; //The merge state of the node: 0 None, 1 trajectory, 2 All
00101   int needMgCycle;
00102 #endif
00103 
00104 } p3d_node, *pp3d_node;
00105 
00106 typedef struct list_node{
00107   p3d_node *N;
00108   struct list_node *next;
00109   struct list_node *prev;
00110 } p3d_list_node;
00111 
00112 
00113 /* Structure d'arete du graphe */
00114 typedef struct edge {
00115   p3d_node  *Ni, *Nf;
00116   p3d_localpath *path;
00117   p3d_localpath_type planner;
00118   double     longueur;
00119   double cost;
00120   int sens_edge;
00121   //start path deform
00122   int visible;
00123   int unvalid;
00124   int for_cycle;
00125   //end path deform
00126 } p3d_edge;
00127 
00128 typedef struct list_edge{
00129   p3d_edge *E;
00130   struct list_edge *next;
00131   struct list_edge *prev;
00132 } p3d_list_edge;
00133 
00134 /* Structure de composante connexe */
00135 typedef struct compco {
00136   int num; /* numero de la composante connexe */
00137   int nnode; /* nombre de noeuds dans la composante connexe */
00138   p3d_list_node *nodes;  /* noeuds faisant partie de la composante connexe */
00139   p3d_list_node *dist_nodes;/* noeuds de la composante connexe pour le tri par distance */
00140   p3d_list_node *last_node; /* dernier noeud de la composante */
00141   struct compco *suiv;
00142   struct compco *prec;
00143   int ncanreach;
00144   int nbRefinNodes;
00145   double temperature;
00146   struct list_compco * canreach;
00147   struct list_compco * last_canreach;
00148   configPt box_env_small[2];
00149   double minCost;   /*Used in cost space problems. Minimal
00150                       cost actually found in the connect componant*/
00151   double maxCost;   /*Used in cost space problems. Maximal
00152                       cost actually found in the connect componant*/
00153   double maxUrmsonCost; /*Used in cost space problems (Urmson variant). Maximal
00154                        sum cost actually found in the connect componant*/
00155   int* AnaSuccessTab;
00156   int nbTests;
00157 } p3d_compco;
00158 
00159 typedef struct list_compco{
00160   struct compco *comp;
00161   struct list_compco *next;
00162   struct list_compco *prev;
00163 } p3d_list_compco;
00164 
00165 
00166 /* Structure d'exterma pour classer les paves selon les ddl */
00167 typedef struct ddlbox{
00168   int num; /* numero du noeud auquel ce ddl se rattache */
00169   char   min_max; /* 0 si c'est un min, 1 si c'est un max */
00170   double val; /* valeur du min ou du max */
00171   struct ddlbox *next;
00172   struct ddlbox *prev;
00173 } p3d_ddlbox;
00174 
00175 /* Structure de graphe */
00176 typedef struct graph {
00177   p3d_env *env; /* environnement auquel le graphe se rattache */
00178   p3d_rob *rob; /* robot auquel le graphe se rattache */
00179   char * file; /* nom du fichier de sauvegarde du graphe */
00180   int oriented;
00181 
00182   int nnode; /* nombre de noeuds dans le graphe */
00183   p3d_list_node *nodes; /* noeuds du graphe */
00184   p3d_list_node *last_node; /* dernier noeud du graphe */
00185   int nedge; /*nombre d'aretes */
00186   p3d_list_edge *edges; /* aretes */
00187   p3d_list_edge *last_edge;
00188   int ncomp; /* nombre de composantes connexes */
00189   p3d_compco *comp; /*liste des composantes connexes */
00190   p3d_compco *last_comp;
00191   p3d_ddlbox **ddlbox; /* liste des intervalles des paves sur les ddl */
00192   unsigned long int hhCount; /* number of the next point of the Halton Set */
00193   int nb_standart_nodes; /*Number of nodes built by standart-RRT*/
00194   int nb_DD_nodes;       /*Number of nodes built by DD-RRT*/
00195   int nboundary; /* number of boundary nodes */
00196   int n_call_nearest; /*number  of call to the nearest neighbour function */
00197 
00198   int IsCurrentNodeBias; /* Flag to tell if the current
00199                             direction of expansion is given by a node
00200                             (used to avoid the superposition of 2 nodes) */
00201   p3d_node*  NodeBiasPt;
00202   int        arc_type;
00203   int        arc_value;
00204   p3d_node   *search_start;
00205   p3d_node   *search_goal;
00206   p3d_node   *search_goal_sol;
00207   int        search_done;
00208   int        search_path;
00209   int        search_numdev;
00210   double     search_cost;
00211   int        search_path_length;
00212 
00213   double time;
00214 #ifdef MULTIGRAPH
00215   double mgTime;
00216 #endif
00217 #ifdef DPG
00218   class DpgGrid * dpgGrid;
00219 #endif
00220 
00221         // Planning on graph stat
00222         double totTime;
00223         double optTime;
00224   double rrtTime;
00225   double rrtCost1;
00226   double rrtCost2;
00227 
00228   int nb_test_BB;
00229   int nb_test_coll;
00230   int nb_test_energy;  //mod noureddine
00231   int nb_local_call;
00232   int nb_q;
00233   int nb_q_free;
00234   int nb_bkb_q_free;
00235   int nb_q_closed;
00236 
00237   int ** usedIkSols; //List of iksol in the graph
00238   int nbUsedIkSols; //The number of item in the list
00239   //start path deform
00240   p3d_list_node *dist_nodes ;/* noeuds du graph pour un tri global par distance */
00241   p3d_node* start_nodePt;
00242   p3d_node* last_nodePt;
00243   p3d_node* prev_nodePt;
00244   p3d_traj* traj1Pt;
00245   p3d_traj* traj2Pt;
00246   //end path deform
00247 
00248   double critic_cur_pb_level;
00249   int n_consec_fail_pb_level;
00250   int n_consec_pb_level;
00251   double CurPbLevel;
00252   p3d_vector3 g3d_position; // 3d position of the node when drawing the graph
00253   bool g3d_position_flag;
00254   p3d_jnt* g3d_drawnjnt; // used when drawing the graph
00255 
00256   struct p3d_statistics * stat; /* Statistic data structure of the algorithm
00257                                                   associated with the graph; Commit Jim; date: 01/10/2008 */
00258 
00259 } p3d_graph, *pp3d_graph;
00260 
00261 
00262 //start path deform
00263 typedef struct project_point {
00264   int i;
00265   int j;
00266   int in_test;
00267   int is_valid;
00268   double cost;
00269 }p3d_project_point;
00270 
00271 typedef struct path_nodes {
00272   dbl_list* list_node; // liste de noeuds
00273   /*p3d_node*/void* N; // Le noeud
00274   double f;
00275   double g;
00276   double h;
00277   int opened;
00278   int closed;
00279   int nnode;// nombre de noeuds dans list_node
00280 }p3d_path_nodes;
00281 //end path deform
00282 
00283 #ifdef MULTIGRAPH
00284 
00285 typedef struct fsgListNode{
00287   struct flatSuperGraphNode * node;
00289   struct fsgListNode * prev;
00291   struct fsgListNode * next;
00292 }p3d_fsgListNode;
00293 
00295 typedef struct fsgListEdge{
00297   struct flatSuperGraphEdge * edge;
00299   struct fsgListEdge * prev;
00301   struct fsgListEdge * next;
00302 }p3d_fsgListEdge;
00303 
00305 typedef struct flatSuperGraphNode{
00307   int num;
00309   int nNodes;
00311   configPt q;
00313   p3d_node * mergedNode;
00315   p3d_node ** nodes;
00317   int nEdges;
00319   p3d_fsgListEdge * fsgEdges;
00320 
00321   /************* Astar Variables****************/
00323   double h;
00325   double g;
00327   double f;
00329   int opened;
00331   int closed;
00333   struct flatSuperGraphNode *search_from;
00335   struct flatSuperGraphNode *search_to;
00337   struct flatSuperGraphEdge *edge_from;
00339   dbl_list * orderCostListEdge;
00340 }p3d_flatSuperGraphNode;
00341 
00343 typedef struct flatSuperGraphEdge{
00345   struct flatSuperGraphNode * node1;
00347   struct flatSuperGraphNode * node2;
00348   /************* Astar Variables****************/
00350   double cost;
00351 }p3d_flatSuperGraphEdge;
00352 
00354 typedef struct flatSuperGraph{
00356   int nNodes;
00358   p3d_fsgListNode * nodes;
00360   int nEdges;
00362   p3d_fsgListEdge * edges;
00364   std::vector<p3d_flatSuperGraphEdge *> autoColNodes;
00365 
00366   /************* Astar Variables****************/
00368   struct flatSuperGraphNode * search_start;
00370   struct flatSuperGraphNode   *search_goal;
00372   int search_done;
00374   int search_numdev;
00376   int search_path;
00378   struct flatSuperGraphNode *search_goal_sol;
00380   double search_cost;
00382   int search_path_length;
00383 }p3d_flatSuperGraph;
00384 #endif //MULTIGRAPH
00385 
00386 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines