Eclipse SUMO - Simulation of Urban MObility
CHBuilder.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
17 // Contraction Hierarchy Builder for the shortest path search
18 /****************************************************************************/
19 #ifndef CHBuilder_h
20 #define CHBuilder_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <string>
29 #include <functional>
30 #include <vector>
31 #include <set>
32 #include <limits>
33 #include <algorithm>
34 #include <iterator>
35 #include <utils/common/SysUtils.h>
37 #include <utils/common/StdDefs.h>
39 #include "SPTree.h"
40 
41 //#define CHRouter_DEBUG_CONTRACTION
42 //#define CHRouter_DEBUG_CONTRACTION_WITNESSES
43 //#define CHRouter_DEBUG_CONTRACTION_QUEUE
44 //#define CHRouter_DEBUG_CONTRACTION_DEGREE
45 //#define CHRouter_DEBUG_WEIGHTS
46 
47 // ===========================================================================
48 // class definitions
49 // ===========================================================================
64 template<class E, class V>
65 class CHBuilder {
66 
67 public:
69  // forward connections are used only in forward search
70  // backward connections are used only in backwards search
71  class Connection {
72  public:
73  Connection(int t, double c, SVCPermissions p): target(t), cost(c), permissions(p) {}
74  int target;
75  double cost;
77  };
78 
79  typedef std::pair<const E*, const E*> ConstEdgePair;
80  typedef std::map<ConstEdgePair, const E*> ShortcutVia;
81  struct Hierarchy {
83  std::vector<std::vector<Connection> > forwardUplinks;
84  std::vector<std::vector<Connection> > backwardUplinks;
85  };
86 
92  CHBuilder(const std::vector<E*>& edges, bool unbuildIsWarning,
93  const SUMOVehicleClass svc,
94  bool validatePermissions):
95  myEdges(edges),
96  myErrorMsgHandler(unbuildIsWarning ? MsgHandler::getWarningInstance() : MsgHandler::getErrorInstance()),
97  mySPTree(new SPTree<CHInfo, CHConnection>(4, validatePermissions)),
98  mySVC(svc),
99  myUpdateCount(0) {
100  for (typename std::vector<E*>::const_iterator i = edges.begin(); i != edges.end(); ++i) {
101  myCHInfos.push_back(CHInfo(*i));
102  }
103  }
104 
106  virtual ~CHBuilder() {
107  delete mySPTree;
108  }
109 
110 
111  const Hierarchy* buildContractionHierarchy(SUMOTime time, const V* const vehicle, const SUMOAbstractRouter<E, V>* effortProvider) {
112  Hierarchy* result = new Hierarchy();
113  const int numEdges = (int)myCHInfos.size();
114  const std::string vClass = (mySPTree->validatePermissions() ?
115  "all vehicle classes " : "vClass='" + SumoVehicleClassStrings.getString(mySVC) + "' ");
116  PROGRESS_BEGIN_MESSAGE("Building Contraction Hierarchy for " + vClass
117  + "and time=" + time2string(time) + " (" + toString(numEdges) + " edges)\n");
118  const long startMillis = SysUtils::getCurrentMillis();
119  // init queue
120  std::vector<CHInfo*> queue; // max heap: edge to be contracted is front
121  // reset previous connections etc
122  for (int i = 0; i < numEdges; i++) {
123  myCHInfos[i].resetContractionState();
124  result->forwardUplinks.push_back(std::vector<Connection>());
125  result->backwardUplinks.push_back(std::vector<Connection>());
126  }
127  // copy connections from the original net
128  const double time_seconds = STEPS2TIME(time); // timelines store seconds!
129  for (int i = 0; i < numEdges; i++) {
130  synchronize(myCHInfos[i], time_seconds, vehicle, effortProvider);
131  }
132  // synchronization is finished. now we can compute priorities for the first time
133  for (int i = 0; i < numEdges; i++) {
134  myCHInfos[i].updatePriority(mySPTree);
135  queue.push_back(&(myCHInfos[i]));
136  }
137  std::make_heap(queue.begin(), queue.end(), myCmp);
138  int contractionRank = 0;
139  // contraction loop
140  while (!queue.empty()) {
141  while (tryUpdateFront(queue)) {}
142  CHInfo* max = queue.front();
143  max->rank = contractionRank;
144 #ifdef CHRouter_DEBUG_CONTRACTION
145  std::cout << "contracting '" << max->edge->getID() << "' with prio: " << max->priority << " (rank " << contractionRank << ")\n";
146 #endif
147  const E* const edge = max->edge;
148  // add outgoing connections to the forward search
149  const int edgeID = edge->getNumericalID();
150  for (typename CHConnections::const_iterator it = max->followers.begin(); it != max->followers.end(); it++) {
151  const CHConnection& con = *it;
152  result->forwardUplinks[edgeID].push_back(Connection(con.target->edge->getNumericalID(), con.cost, con.permissions));
153  disconnect(con.target->approaching, max);
154  con.target->updatePriority(0);
155  }
156  // add incoming connections to the backward search
157  for (typename CHConnections::const_iterator it = max->approaching.begin(); it != max->approaching.end(); it++) {
158  const CHConnection& con = *it;
159  result->backwardUplinks[edgeID].push_back(Connection(con.target->edge->getNumericalID(), con.cost, con.permissions));
160  disconnect(con.target->followers, max);
161  con.target->updatePriority(0);
162  }
163  // add shortcuts to the net
164  for (typename std::vector<Shortcut>::const_iterator it = max->shortcuts.begin(); it != max->shortcuts.end(); it++) {
165  const ConstEdgePair& edgePair = it->edgePair;
166  result->shortcuts[edgePair] = edge;
167  CHInfo* from = getCHInfo(edgePair.first);
168  CHInfo* to = getCHInfo(edgePair.second);
169  from->followers.push_back(CHConnection(to, it->cost, it->permissions, it->underlying));
170  to->approaching.push_back(CHConnection(from, it->cost, it->permissions, it->underlying));
171  }
172  // if you need to debug the chrouter with MSVC uncomment the following line, hierarchy building will get slower and the hierarchy may change though
173  //std::make_heap(queue.begin(), queue.end(), myCmp);
174  // remove from queue
175  std::pop_heap(queue.begin(), queue.end(), myCmp);
176  queue.pop_back();
177  /*
178  if (contractionRank % 10000 == 0) {
179  // update all and rebuild queue
180  for (typename std::vector<CHInfo*>::iterator it = queue.begin(); it != queue.end(); ++it) {
181  (*it)->updatePriority(mySPTree);
182  }
183  std::make_heap(queue.begin(), queue.end(), myCmp);
184  }
185  */
186  contractionRank++;
187  }
188  // reporting
189  const long duration = SysUtils::getCurrentMillis() - startMillis;
190  WRITE_MESSAGE("Created " + toString(result->shortcuts.size()) + " shortcuts.");
191  WRITE_MESSAGE("Recomputed priority " + toString(myUpdateCount) + " times.");
192  MsgHandler::getMessageInstance()->endProcessMsg("done (" + toString(duration) + "ms).");
194  myUpdateCount = 0;
195  return result;
196  }
197 
198 private:
199  struct Shortcut {
200  Shortcut(ConstEdgePair e, double c, int u, SVCPermissions p):
201  edgePair(e), cost(c), underlying(u), permissions(p) {}
203  double cost;
206  };
207 
208 
209  class CHInfo;
210 
212  class CHConnection {
213  public:
214  CHConnection(CHInfo* t, double c, SVCPermissions p, int u):
215  target(t), cost(c), permissions(p), underlying(u) {}
217  double cost;
221  };
222 
223  typedef std::vector<CHConnection> CHConnections;
224  typedef std::pair<const CHConnection*, const CHConnection*> CHConnectionPair;
225  typedef std::vector<CHConnectionPair> CHConnectionPairs;
226 
227  /* @brief container class to use when building the contraction hierarchy.
228  * instances are reused every time the hierarchy is rebuilt (new time slice)
229  * but they must be synchronized first */
230  class CHInfo {
231  public:
233  CHInfo(const E* e) :
234  edge(e),
235  priority(0.),
237  rank(-1),
238  level(0),
239  underlyingTotal(0),
240  visited(false),
241  traveltime(std::numeric_limits<double>::max()),
242  depth(0),
244  }
245 
248  if (spTree != 0) {
249  updateShortcuts(spTree);
250  updateLevel();
251  } else {
252  contractedNeighbors += 1; // called when a connected edge was contracted
253  }
254  const double oldPriority = priority;
255  // priority term as used by abraham []
256  const int edge_difference = (int)followers.size() + (int)approaching.size() - 2 * (int)shortcuts.size();
257  priority = (double)(2 * edge_difference - contractedNeighbors - underlyingTotal - 5 * level);
258  return priority != oldPriority;
259  }
260 
263  const bool validatePermissions = spTree->validatePermissions();
264 #ifdef CHRouter_DEBUG_CONTRACTION_DEGREE
265  const int degree = (int)approaching.size() + (int)followers.size();
266  std::cout << "computing shortcuts for '" + edge->getID() + "' with degree " + toString(degree) + "\n";
267 #endif
268  shortcuts.clear();
269  underlyingTotal = 0;
270  for (typename CHConnections::iterator it_a = approaching.begin(); it_a != approaching.end(); it_a++) {
271  CHConnection& aInfo = *it_a;
272  // build shortest path tree in a fixed neighborhood
273  spTree->rebuildFrom(aInfo.target, this);
274  for (typename CHConnections::iterator it_f = followers.begin(); it_f != followers.end(); it_f++) {
275  CHConnection& fInfo = *it_f;
276  const double viaCost = aInfo.cost + fInfo.cost;
277  const SVCPermissions viaPermissions = (aInfo.permissions & fInfo.permissions);
278  if (fInfo.target->traveltime > viaCost) {
279  // found no faster path -> we need a shortcut via edge
280 #ifdef CHRouter_DEBUG_CONTRACTION_WITNESSES
281  debugNoWitness(aInfo, fInfo);
282 #endif
283  const int underlying = aInfo.underlying + fInfo.underlying;
284  underlyingTotal += underlying;
285  shortcuts.push_back(Shortcut(ConstEdgePair(aInfo.target->edge, fInfo.target->edge),
286  viaCost, underlying, viaPermissions));
287 
288  } else if (validatePermissions) {
289  if ((fInfo.target->permissions & viaPermissions) != viaPermissions) {
290  // witness has weaker restrictions. try to find another witness
291  spTree->registerForValidation(&aInfo, &fInfo);
292  } else {
293 #ifdef CHRouter_DEBUG_CONTRACTION_WITNESSES
294  debugNoWitness(aInfo, fInfo);
295 #endif
296  }
297  } else {
298 #ifdef CHRouter_DEBUG_CONTRACTION_WITNESSES
299  debugNoWitness(aInfo, fInfo);
300 #endif
301  }
302  }
303  }
304  // insert shortcuts needed due to unmet permissions
305  if (validatePermissions) {
306  const CHConnectionPairs& pairs = spTree->getNeededShortcuts(this);
307  for (typename CHConnectionPairs::const_iterator it = pairs.begin(); it != pairs.end(); ++it) {
308  const CHConnection* aInfo = it->first;
309  const CHConnection* fInfo = it->second;
310  const double viaCost = aInfo->cost + fInfo->cost;
311  const SVCPermissions viaPermissions = (aInfo->permissions & fInfo->permissions);
312  const int underlying = aInfo->underlying + fInfo->underlying;
313  underlyingTotal += underlying;
314  shortcuts.push_back(Shortcut(ConstEdgePair(aInfo->target->edge, fInfo->target->edge),
315  viaCost, underlying, viaPermissions));
316  }
317  }
318  }
319 
320 
321  // update level as defined by Abraham
322  void updateLevel() {
323  int maxLower = std::numeric_limits<int>::min();
324  int otherRank;
325  for (typename CHConnections::iterator it = approaching.begin(); it != approaching.end(); it++) {
326  otherRank = it->target->rank;
327  if (otherRank < rank) {
328  maxLower = MAX2(rank, maxLower);
329  }
330  }
331  for (typename CHConnections::iterator it = followers.begin(); it != followers.end(); it++) {
332  otherRank = it->target->rank;
333  if (otherRank < rank) {
334  maxLower = MAX2(rank, maxLower);
335  }
336  }
337  if (maxLower == std::numeric_limits<int>::min()) {
338  level = 0;
339  } else {
340  level = maxLower + 1;
341  }
342  }
343 
344  // resets state before rebuilding the hierarchy
347  rank = -1;
348  level = 0;
349  underlyingTotal = 0;
350  shortcuts.clear();
351  followers.clear();
352  approaching.clear();
353  }
354 
355 
357  const E* edge;
359  double priority;
361  std::vector<Shortcut> shortcuts;
364  int rank;
365  int level;
367 
371 
372 
374  bool visited;
376  double traveltime;
378  int depth;
380  // @note: we may miss some witness paths by making traveltime the only
381  // criteria durinng search
383 
384  inline void reset() {
385  traveltime = std::numeric_limits<double>::max();
386  visited = false;
387  }
388 
389 
391  inline void debugNoWitness(const CHConnection& aInfo, const CHConnection& fInfo) {
392  std::cout << "adding shortcut between " << aInfo.target->edge->getID() << ", " << fInfo.target->edge->getID() << " via " << edge->getID() << "\n";
393  }
394 
395  inline void debugWitness(const CHConnection& aInfo, const CHConnection& fInfo) {
396  const double viaCost = aInfo.cost + fInfo.cost;
397  std::cout << "found witness with lenght " << fInfo.target->traveltime << " against via " << edge->getID() << " (length " << viaCost << ") for " << aInfo.target->edge->getID() << ", " << fInfo.target->edge->getID() << "\n";
398  }
399 
400  };
401 
402 
408  public:
410  bool operator()(const CHInfo* a, const CHInfo* b) const {
411  if (a->priority == b->priority) {
412  return a->edge->getNumericalID() > b->edge->getNumericalID();
413  } else {
414  return a->priority < b->priority;
415  };
416  }
417  };
418 
419 
420  inline CHInfo* getCHInfo(const E* const edge) {
421  return &(myCHInfos[edge->getNumericalID()]);
422  }
423 
424 
426  void synchronize(CHInfo& info, double time, const V* const vehicle, const SUMOAbstractRouter<E, V>* effortProvider) {
427  // forward and backward connections are used only in forward search,
428  // thus approaching costs are those of the approaching edge and not of the edge itself
429  const bool prune = !mySPTree->validatePermissions();
430  const E* const edge = info.edge;
431  if (prune && ((edge->getPermissions() & mySVC) != mySVC)) {
432  return;
433  }
434  const double baseCost = effortProvider->getEffort(edge, vehicle, time);
435 
436  for (const std::pair<const E*, const E*>& successor : edge->getViaSuccessors(mySVC)) {
437  const E* fEdge = successor.first;
438  if (prune && ((fEdge->getPermissions() & mySVC) != mySVC)) {
439  continue;
440  }
441  CHInfo* const follower = getCHInfo(fEdge);
442  const SVCPermissions permissions = (edge->getPermissions() & fEdge->getPermissions());
443  double cost = baseCost;
444  const E* viaEdge = successor.second;
445  while (viaEdge != nullptr && viaEdge->isInternal()) {
446  cost += effortProvider->getEffort(viaEdge, vehicle, time);
447  viaEdge = viaEdge->getViaSuccessors().front().first;
448  }
449  info.followers.push_back(CHConnection(follower, cost, permissions, 1));
450  follower->approaching.push_back(CHConnection(&info, cost, permissions, 1));
451  }
452 #ifdef CHRouter_DEBUG_WEIGHTS
453  std::cout << time << ": " << edge->getID() << " cost: " << cost << "\n";
454 #endif
455  // @todo: check whether we even need to save approaching in ROEdge;
456  }
457 
458 
460  void disconnect(CHConnections& connections, CHInfo* other) {
461  for (typename CHConnections::iterator it = connections.begin(); it != connections.end(); it++) {
462  if (it->target == other) {
463  connections.erase(it);
464  return;
465  }
466  }
467  assert(false);
468  }
469 
473  bool tryUpdateFront(std::vector<CHInfo*>& queue) {
474  myUpdateCount++;
475  CHInfo* max = queue.front();
476 #ifdef CHRouter_DEBUG_CONTRACTION_QUEUE
477  std::cout << "updating '" << max->edge->getID() << "'\n";
478  debugPrintQueue(queue);
479 #endif
480  if (max->updatePriority(mySPTree)) {
481  std::pop_heap(queue.begin(), queue.end(), myCmp);
482  std::push_heap(queue.begin(), queue.end(), myCmp);
483  return true;
484  } else {
485  return false;
486  }
487  }
488 
489  // helper method for debugging
490  void debugPrintQueue(std::vector<CHInfo*>& queue) {
491  for (typename std::vector<CHInfo*>::iterator it = queue.begin(); it != queue.end(); it++) {
492  CHInfo* chInfo = *it;
493  std::cout << "(" << chInfo->edge->getID() << "," << chInfo->priority << ") ";
494  }
495  std::cout << "\n";
496  }
497 
498 private:
500  const std::vector<E*>& myEdges;
501 
504 
506  std::vector<CHInfo> myCHInfos;
507 
510 
513 
516 
519 
520 private:
522  CHBuilder& operator=(const CHBuilder& s);
523 };
524 
525 
526 #endif
527 
528 /****************************************************************************/
529 
CHBuilder::Shortcut
Definition: CHBuilder.h:199
CHBuilder::ConstEdgePair
std::pair< const E *, const E * > ConstEdgePair
Definition: CHBuilder.h:79
CHBuilder::Connection::permissions
SVCPermissions permissions
Definition: CHBuilder.h:76
CHBuilder::CHConnection::permissions
SVCPermissions permissions
Definition: CHBuilder.h:218
SUMOVehicleClass
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
Definition: SUMOVehicleClass.h:134
CHBuilder
Definition: CHBuilder.h:65
CHBuilder::CHInfo::shortcuts
std::vector< Shortcut > shortcuts
The needed shortcuts.
Definition: CHBuilder.h:361
CHBuilder::CHConnection::target
CHInfo * target
Definition: CHBuilder.h:216
CHBuilder::tryUpdateFront
bool tryUpdateFront(std::vector< CHInfo * > &queue)
tries to update the priority of the first edge
Definition: CHBuilder.h:473
CHBuilder::ShortcutVia
std::map< ConstEdgePair, const E * > ShortcutVia
Definition: CHBuilder.h:80
CHBuilder::debugPrintQueue
void debugPrintQueue(std::vector< CHInfo * > &queue)
Definition: CHBuilder.h:490
CHBuilder::CHConnectionPairs
std::vector< CHConnectionPair > CHConnectionPairs
Definition: CHBuilder.h:225
MsgHandler.h
CHBuilder::CHInfo::reset
void reset()
Definition: CHBuilder.h:384
SUMOAbstractRouter::getEffort
double getEffort(const E *const e, const V *const v, double t) const
Definition: SUMOAbstractRouter.h:210
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:35
CHBuilder::CHInfo::depth
int depth
number of edges from start
Definition: CHBuilder.h:378
CHBuilder::Connection
Forward/backward connection with associated forward/backward cost.
Definition: CHBuilder.h:71
CHBuilder::CHInfo::level
int level
Definition: CHBuilder.h:365
CHBuilder::CHBuilder
CHBuilder(const std::vector< E * > &edges, bool unbuildIsWarning, const SUMOVehicleClass svc, bool validatePermissions)
Constructor.
Definition: CHBuilder.h:92
CHBuilder::mySVC
const SUMOVehicleClass mySVC
the permissions for which the hierarchy was constructed
Definition: CHBuilder.h:515
CHBuilder::Connection::target
int target
Definition: CHBuilder.h:74
SPTree::rebuildFrom
void rebuildFrom(E *start, const E *excluded)
build a shortest path tree from start to a depth of myMaxdepth. The given edge is excluded from this ...
Definition: SPTree.h:88
CHBuilder::Shortcut::edgePair
ConstEdgePair edgePair
Definition: CHBuilder.h:202
CHBuilder::Hierarchy
Definition: CHBuilder.h:81
CHBuilder::myEdges
const std::vector< E * > & myEdges
all edges with numerical ids
Definition: CHBuilder.h:500
SumoVehicleClassStrings
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
SysUtils::getCurrentMillis
static long getCurrentMillis()
Returns the current time in milliseconds.
Definition: SysUtils.cpp:39
CHBuilder::Hierarchy::shortcuts
ShortcutVia shortcuts
Definition: CHBuilder.h:82
CHBuilder::CHConnections
std::vector< CHConnection > CHConnections
Definition: CHBuilder.h:223
MAX2
T MAX2(T a, T b)
Definition: StdDefs.h:80
CHBuilder::Shortcut::cost
double cost
Definition: CHBuilder.h:203
MsgHandler
Definition: MsgHandler.h:44
CHBuilder::myCHInfos
std::vector< CHInfo > myCHInfos
static vector for lookup
Definition: CHBuilder.h:506
SVCPermissions
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
Definition: SUMOVehicleClass.h:219
CHBuilder::Hierarchy::backwardUplinks
std::vector< std::vector< Connection > > backwardUplinks
Definition: CHBuilder.h:84
SysUtils.h
CHBuilder::CHInfo::debugWitness
void debugWitness(const CHConnection &aInfo, const CHConnection &fInfo)
Definition: CHBuilder.h:395
CHBuilder::CHInfo::rank
int rank
Definition: CHBuilder.h:364
MsgHandler::endProcessMsg
virtual void endProcessMsg(std::string msg)
Ends a process information.
Definition: MsgHandler.cpp:148
CHBuilder::CHInfo::resetContractionState
void resetContractionState()
Definition: CHBuilder.h:345
STEPS2TIME
#define STEPS2TIME(x)
Definition: SUMOTime.h:57
CHBuilder::CHInfo::permissions
SVCPermissions permissions
the permissions when reaching this edge on the fastest path
Definition: CHBuilder.h:382
CHBuilder::Hierarchy::forwardUplinks
std::vector< std::vector< Connection > > forwardUplinks
Definition: CHBuilder.h:83
time2string
std::string time2string(SUMOTime t)
Definition: SUMOTime.cpp:65
CHBuilder::CHInfo::traveltime
double traveltime
Effort to reach the edge.
Definition: CHBuilder.h:376
CHBuilder::CHInfoComparator
Definition: CHBuilder.h:407
CHBuilder::CHInfo::CHInfo
CHInfo(const E *e)
Constructor.
Definition: CHBuilder.h:233
CHBuilder::~CHBuilder
virtual ~CHBuilder()
Destructor.
Definition: CHBuilder.h:106
SPTree::getNeededShortcuts
const CHConnectionPairs & getNeededShortcuts(const E *excluded)
Definition: SPTree.h:143
CHBuilder::CHInfo
Definition: CHBuilder.h:230
CHBuilder::myCmp
CHInfoComparator myCmp
Comparator for contraction priority.
Definition: CHBuilder.h:509
CHBuilder::Shortcut::Shortcut
Shortcut(ConstEdgePair e, double c, int u, SVCPermissions p)
Definition: CHBuilder.h:200
CHBuilder::CHInfo::visited
bool visited
members used in SPTree
Definition: CHBuilder.h:374
CHBuilder::getCHInfo
CHInfo * getCHInfo(const E *const edge)
Definition: CHBuilder.h:420
SUMOAbstractRouter
Definition: SUMOAbstractRouter.h:47
CHBuilder::CHInfo::edge
const E * edge
The current edge - not const since it may receive shortcut edges.
Definition: CHBuilder.h:357
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:48
CHBuilder::Shortcut::permissions
SVCPermissions permissions
Definition: CHBuilder.h:205
SPTree::validatePermissions
bool validatePermissions()
whether permissions should be validated;
Definition: SPTree.h:130
CHBuilder::CHConnection::underlying
int underlying
the number of connections underlying this connection
Definition: CHBuilder.h:220
CHBuilder::CHInfoComparator::operator()
bool operator()(const CHInfo *a, const CHInfo *b) const
Comparing method.
Definition: CHBuilder.h:410
CHBuilder::CHInfo::underlyingTotal
int underlyingTotal
Definition: CHBuilder.h:366
PROGRESS_BEGIN_MESSAGE
#define PROGRESS_BEGIN_MESSAGE(msg)
Definition: MsgHandler.h:241
CHBuilder::CHInfo::priority
double priority
The contraction priority.
Definition: CHBuilder.h:359
CHBuilder::CHConnection
Forward/backward connection with associated FORWARD cost.
Definition: CHBuilder.h:212
CHBuilder::operator=
CHBuilder & operator=(const CHBuilder &s)
Invalidated assignment operator.
CHBuilder::myErrorMsgHandler
MsgHandler *const myErrorMsgHandler
the handler for routing errors
Definition: CHBuilder.h:503
CHBuilder::Connection::cost
double cost
Definition: CHBuilder.h:75
CHBuilder::CHInfo::debugNoWitness
void debugNoWitness(const CHConnection &aInfo, const CHConnection &fInfo)
debugging methods
Definition: CHBuilder.h:391
CHBuilder::buildContractionHierarchy
const Hierarchy * buildContractionHierarchy(SUMOTime time, const V *const vehicle, const SUMOAbstractRouter< E, V > *effortProvider)
Definition: CHBuilder.h:111
PROGRESS_DONE_MESSAGE
#define PROGRESS_DONE_MESSAGE()
Definition: MsgHandler.h:242
CHBuilder::Connection::Connection
Connection(int t, double c, SVCPermissions p)
Definition: CHBuilder.h:73
CHBuilder::disconnect
void disconnect(CHConnections &connections, CHInfo *other)
remove all connections to/from the given edge (assume it exists only once)
Definition: CHBuilder.h:460
CHBuilder::Shortcut::underlying
int underlying
Definition: CHBuilder.h:204
CHBuilder::CHInfo::contractedNeighbors
int contractedNeighbors
priority subterms
Definition: CHBuilder.h:363
SPTree
Definition: SPTree.h:39
SPTree.h
CHBuilder::synchronize
void synchronize(CHInfo &info, double time, const V *const vehicle, const SUMOAbstractRouter< E, V > *effortProvider)
copy connections from the original net (modified destructively during contraction)
Definition: CHBuilder.h:426
config.h
CHBuilder::CHInfo::updatePriority
bool updatePriority(SPTree< CHInfo, CHConnection > *spTree)
recompute the contraction priority and report whether it changed
Definition: CHBuilder.h:247
SPTree::registerForValidation
void registerForValidation(const C *aInfo, const C *fInfo)
save source/target pair for later validation
Definition: SPTree.h:135
StdDefs.h
CHBuilder::CHInfo::approaching
CHConnections approaching
Definition: CHBuilder.h:370
CHBuilder::CHInfo::updateLevel
void updateLevel()
Definition: CHBuilder.h:322
CHBuilder::CHConnectionPair
std::pair< const CHConnection *, const CHConnection * > CHConnectionPair
Definition: CHBuilder.h:224
SVC_IGNORING
vehicles ignoring classes
Definition: SUMOVehicleClass.h:136
SUMOAbstractRouter.h
CHBuilder::CHInfo::updateShortcuts
void updateShortcuts(SPTree< CHInfo, CHConnection > *spTree)
compute needed shortcuts when contracting this edge
Definition: CHBuilder.h:262
CHBuilder::CHConnection::CHConnection
CHConnection(CHInfo *t, double c, SVCPermissions p, int u)
Definition: CHBuilder.h:214
WRITE_MESSAGE
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:240
CHBuilder::myUpdateCount
int myUpdateCount
counters for performance logging
Definition: CHBuilder.h:518
CHBuilder::CHConnection::cost
double cost
Definition: CHBuilder.h:217
CHBuilder::mySPTree
SPTree< CHInfo, CHConnection > * mySPTree
the shortest path tree to use when searching for shortcuts
Definition: CHBuilder.h:512
MsgHandler::getMessageInstance
static MsgHandler * getMessageInstance()
Returns the instance to add normal messages to.
Definition: MsgHandler.cpp:59
CHBuilder::CHInfo::followers
CHConnections followers
connections (only valid after synchronization)
Definition: CHBuilder.h:369