libmove3d-planners
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros Groups Pages
compco.hpp
1 /*
2  * compco.h
3  * BioMove3D
4  *
5  * Created by Jim Mainprice on 27/04/10.
6  * Copyright 2010 CNRS/LAAS. All rights reserved.
7  *
8  */
9 #ifndef COMPCO_HPP
10 #define COMPCO_HPP
11 
12 #include "API/ConfigSpace/configuration.hpp"
13 
14 #include <vector>
15 
16 class Node;
17 class Graph;
18 
19 #ifndef _ROADMAP_H
20 struct compco;
21 #endif
22 
24 {
25 public:
27  ConnectedComponent(Graph * G, compco * Comp);
28 
30  ConnectedComponent(Graph * G, Node * N);
31 
34  free(m_Compco);
35  }
36 
38  compco * getCompcoStruct() const {
39  return m_Compco;
40  }
41 
43  std::vector<Node *> & getNodes() {
44  return m_Nodes;
45  }
46 
48  Node * getNode(unsigned i) const {
49  return m_Nodes[i];
50  }
51 
53  unsigned getNumberOfNodes() const {
54  return m_Nodes.size();
55  }
56 
58  const std::vector<double> & getLowerBBox() const {
59  return bBoxMin;
60  }
61 
63  const std::vector<double> & getUpperBBox() const {
64  return bBoxMax;
65  }
66 
68  double getBBoxVolume() const {
69  return bBoxVolume;
70  }
71 
73  unsigned getId() const;
74 
76  unsigned getNumberOfRefinementNodes() const;
77 
80 
85  void addNode(Node * N);
86 
88  void removeNode(Node * node) {
89  m_Nodes.erase(std::find(m_Nodes.begin(), m_Nodes.end(), node));
90  }
91 
96 
101 
106  void mergeWith(ConnectedComponent* CompcoPt);
107 
111  bool isLinkedToCompco(ConnectedComponent* CompcoPt);
112 
114  Node * nearestNeighbor(confPtr_t conf,bool backward=false);
115 
117  std::vector<Node *> kNearestNeighbors(unsigned k, confPtr_t conf);
118 
123  std::vector<Node *> neighborsInBall(confPtr_t conf, double radius);
124 
128  Node* nearestWeightNeighbour(std::tr1::shared_ptr<Configuration> q, bool weighted, int distConfigChoice);
129 
134  std::vector<Node*> KNearestWeightNeighbour(confPtr_t config, int K, double radius, bool weighted,
135  int distConfigChoice);
136 
141 
143  Node* randomNode();
144 
146  double getTemperature();
147 
149  void setTemperature(double temp);
150 
151 private:
152  compco* m_Compco;
153  Graph* m_Graph;
154 
155  int m_Id;
156 
157  std::vector<Node*> m_Nodes;
158  std::vector<ConnectedComponent*> m_CanReach;
159 
161  std::vector<double> bBoxMin;
162  std::vector<double> bBoxMax;
163  double bBoxVolume;
164 };
165 #endif
const std::vector< double > & getUpperBBox() const
Get the upper bounds of the bounding box.
Definition: compco.hpp:63
double getBBoxVolume() const
Get the volume of the bounding box.
Definition: compco.hpp:68
Definition: compco.hpp:23
std::vector< Node * > KNearestWeightNeighbour(confPtr_t config, int K, double radius, bool weighted, int distConfigChoice)
K Nearest Weighted Neighbors in connected component.
Definition: compco.cpp:365
const std::vector< double > & getLowerBBox() const
Get the lower bounds of the bounding box.
Definition: compco.hpp:58
~ConnectedComponent()
Destructor.
Definition: compco.hpp:33
void removeNode(Node *node)
Remove the given node.
Definition: compco.hpp:88
Classe représentant un Node d'un Graph.
Definition: node.hpp:39
void mergeWith(ConnectedComponent *CompcoPt)
Merge CompcoPt with this compco and delete it.
Definition: compco.cpp:178
void addNode(Node *N)
Add a node to the connected component.
Definition: compco.cpp:99
void updateNumberOfRefinementNodes()
Add the given number to the current number of refinement nodes.
Definition: compco.cpp:89
void addToReachableListAndUpdatePredecessors(ConnectedComponent *Comp)
Add the compco to the reachable Compco and update predecessors.
Definition: compco.cpp:157
double getTemperature()
Get the temperature of the component.
Definition: compco.cpp:426
bool isLinkedToCompco(ConnectedComponent *CompcoPt)
Can reach the compco.
Definition: compco.cpp:149
ConnectedComponent(Graph *G, compco *Comp)
Out of use!!!
std::vector< Node * > kNearestNeighbors(unsigned k, confPtr_t conf)
Return the k nodes whose configurations are the closest (in the C-space) to the given configuration...
Definition: compco.cpp:283
Definition: graph.hpp:28
Node * searchConf(Configuration &q)
Search configuration in connected compco.
Definition: compco.cpp:399
unsigned getNumberOfNodes() const
Get the number of nodes in the connected component.
Definition: compco.hpp:53
void setTemperature(double temp)
Set the temperature of the component.
Definition: compco.cpp:434
std::vector< Node * > & getNodes()
Get the vector of nodes.
Definition: compco.hpp:43
unsigned getId() const
Get the id of the connected component.
Definition: compco.cpp:71
Node * nearestNeighbor(confPtr_t conf, bool backward=false)
Return the node whose configuration is the closest (in the C-space) to the given configuration.
Definition: compco.cpp:236
std::vector< Node * > neighborsInBall(confPtr_t conf, double radius)
Return the nodes whose configurations are within a ball (in the C-space) having the given radius and ...
Definition: compco.cpp:315
unsigned getNumberOfRefinementNodes() const
Get the number of refinement nodes.
Definition: compco.cpp:80
Classe représentant une Configuration d'un Robot.
Definition: configuration.hpp:25
Node * getNode(unsigned i) const
Get the ith node.
Definition: compco.hpp:48
Node * randomNode()
Return a node, randomly chosen in the connected component.
Definition: compco.cpp:415
void addToReachableList(ConnectedComponent *Comp)
Add the compco to the reachable Compco.
Definition: compco.cpp:141
Node * nearestWeightNeighbour(std::tr1::shared_ptr< Configuration > q, bool weighted, int distConfigChoice)
Nearest weithed Neigboor.
Definition: compco.cpp:332
compco * getCompcoStruct() const
Get the Connected Component structure.
Definition: compco.hpp:38