SUMO - Simulation of Urban MObility
RODFNet.cpp
Go to the documentation of this file.
1 /****************************************************************************/
10 // A DFROUTER-network
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
13 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
32 #include <cassert>
33 #include <iostream>
34 #include <map>
35 #include <queue>
36 #include <vector>
37 #include <iterator>
38 #include "RODFNet.h"
39 #include "RODFDetector.h"
40 #include "RODFRouteDesc.h"
41 #include "RODFDetectorFlow.h"
42 #include "RODFEdge.h"
43 #include <cmath>
45 #include <utils/common/ToString.h>
47 #include <utils/geom/GeomHelper.h>
48 
49 
50 // ===========================================================================
51 // method definitions
52 // ===========================================================================
53 RODFNet::RODFNet(bool amInHighwayMode) :
54  RONet(), myAmInHighwayMode(amInHighwayMode),
55  mySourceNumber(0), mySinkNumber(0), myInBetweenNumber(0), myInvalidNumber(0),
56  myMaxSpeedFactorPKW(1),
57  myMaxSpeedFactorLKW(1),
58  myAvgSpeedFactorPKW(1),
59  myAvgSpeedFactorLKW(1) {
61  myKeepTurnarounds = OptionsCont::getOptions().getBool("keep-turnarounds");
62 }
63 
64 
66 }
67 
68 
69 void
71  const std::map<std::string, ROEdge*>& edges = getEdgeMap();
72  for (std::map<std::string, ROEdge*>::const_iterator rit = edges.begin(); rit != edges.end(); ++rit) {
73  ROEdge* ce = (*rit).second;
74  const ROEdgeVector& successors = ce->getSuccessors();
75  for (ROEdgeVector::const_iterator it = successors.begin(); it != successors.end(); ++it) {
76  ROEdge* help = *it;
77  if (find(myDisallowedEdges.begin(), myDisallowedEdges.end(), help->getID()) != myDisallowedEdges.end()) {
78  // edges in sinks will not be used
79  continue;
80  }
81  if (!myKeepTurnarounds && help->getToJunction() == ce->getFromJunction()) {
82  // do not use turnarounds
83  continue;
84  }
85  // add the connection help->ce to myApproachingEdges
86  if (myApproachingEdges.find(help) == myApproachingEdges.end()) {
88  }
89  myApproachingEdges[help].push_back(ce);
90  // add the connection ce->help to myApproachingEdges
91  if (myApproachedEdges.find(ce) == myApproachedEdges.end()) {
93  }
94  myApproachedEdges[ce].push_back(help);
95  }
96  }
97 }
98 
99 
100 void
102  myDetectorsOnEdges.clear();
103  myDetectorEdges.clear();
104  const std::vector<RODFDetector*>& dets = detcont.getDetectors();
105  for (std::vector<RODFDetector*>::const_iterator i = dets.begin(); i != dets.end(); ++i) {
106  ROEdge* e = getDetectorEdge(**i);
107  myDetectorsOnEdges[e].push_back((*i)->getID());
108  myDetectorEdges[(*i)->getID()] = e;
109  }
110 }
111 
112 
113 void
115  bool sourcesStrict) const {
116  PROGRESS_BEGIN_MESSAGE("Computing detector types");
117  const std::vector< RODFDetector*>& dets = detcont.getDetectors();
118  // build needed information. first
120  // compute detector types then
121  for (std::vector< RODFDetector*>::const_iterator i = dets.begin(); i != dets.end(); ++i) {
122  if (isSource(**i, detcont, sourcesStrict)) {
123  (*i)->setType(SOURCE_DETECTOR);
124  mySourceNumber++;
125  }
126  if (isDestination(**i, detcont)) {
127  (*i)->setType(SINK_DETECTOR);
128  mySinkNumber++;
129  }
130  if ((*i)->getType() == TYPE_NOT_DEFINED) {
131  (*i)->setType(BETWEEN_DETECTOR);
133  }
134  }
135  // recheck sources
136  for (std::vector< RODFDetector*>::const_iterator i = dets.begin(); i != dets.end(); ++i) {
137  if ((*i)->getType() == SOURCE_DETECTOR && isFalseSource(**i, detcont)) {
138  (*i)->setType(DISCARDED_DETECTOR);
139  myInvalidNumber++;
140  mySourceNumber--;
141  }
142  }
143  // print results
145  WRITE_MESSAGE("Computed detector types:");
146  WRITE_MESSAGE(" " + toString(mySourceNumber) + " source detectors");
147  WRITE_MESSAGE(" " + toString(mySinkNumber) + " sink detectors");
148  WRITE_MESSAGE(" " + toString(myInBetweenNumber) + " in-between detectors");
149  WRITE_MESSAGE(" " + toString(myInvalidNumber) + " invalid detectors");
150 }
151 
152 
153 bool
155  const RODFDetectorCon& detectors) const {
156  assert(myDetectorsOnEdges.find(edge) != myDetectorsOnEdges.end());
157  const std::vector<std::string>& detIDs = myDetectorsOnEdges.find(edge)->second;
158  std::vector<std::string>::const_iterator i;
159  for (i = detIDs.begin(); i != detIDs.end(); ++i) {
160  const RODFDetector& det = detectors.getDetector(*i);
161  if (det.getType() != BETWEEN_DETECTOR) {
162  return false;
163  }
164  }
165  return true;
166 }
167 
168 
169 bool
171  const RODFDetectorCon& detectors) const {
172  assert(myDetectorsOnEdges.find(edge) != myDetectorsOnEdges.end());
173  const std::vector<std::string>& detIDs = myDetectorsOnEdges.find(edge)->second;
174  std::vector<std::string>::const_iterator i;
175  for (i = detIDs.begin(); i != detIDs.end(); ++i) {
176  const RODFDetector& det = detectors.getDetector(*i);
177  if (det.getType() == SOURCE_DETECTOR) {
178  return true;
179  }
180  }
181  return false;
182 }
183 
184 
185 
186 void
188  bool keepUnfoundEnds,
189  bool keepShortestOnly,
190  ROEdgeVector& /*visited*/,
191  const RODFDetector& det, RODFRouteCont& into,
192  const RODFDetectorCon& detectors,
193  int maxFollowingLength,
194  ROEdgeVector& seen) const {
195  std::vector<RODFRouteDesc> unfoundEnds;
196  std::priority_queue<RODFRouteDesc, std::vector<RODFRouteDesc>, DFRouteDescByTimeComperator> toSolve;
197  std::map<ROEdge*, ROEdgeVector > dets2Follow;
198  dets2Follow[edge] = ROEdgeVector();
199  base.passedNo = 0;
200  double minDist = OptionsCont::getOptions().getFloat("min-route-length");
201  toSolve.push(base);
202  while (!toSolve.empty()) {
203  RODFRouteDesc current = toSolve.top();
204  toSolve.pop();
205  ROEdge* last = *(current.edges2Pass.end() - 1);
206  if (hasDetector(last)) {
207  if (dets2Follow.find(last) == dets2Follow.end()) {
208  dets2Follow[last] = ROEdgeVector();
209  }
210  for (ROEdgeVector::reverse_iterator i = current.edges2Pass.rbegin() + 1; i != current.edges2Pass.rend(); ++i) {
211  if (hasDetector(*i)) {
212  dets2Follow[*i].push_back(last);
213  break;
214  }
215  }
216  }
217 
218  // do not process an edge twice
219  if (find(seen.begin(), seen.end(), last) != seen.end() && keepShortestOnly) {
220  continue;
221  }
222  seen.push_back(last);
223  // end if the edge has no further connections
224  if (!hasApproached(last)) {
225  // ok, no further connections to follow
226  current.factor = 1.;
227  double cdist = current.edges2Pass[0]->getFromJunction()->getPosition().distanceTo(current.edges2Pass.back()->getToJunction()->getPosition());
228  if (minDist < cdist) {
229  into.addRouteDesc(current);
230  }
231  continue;
232  }
233  // check for passing detectors:
234  // if the current last edge is not the one the detector is placed on ...
235  bool addNextNoFurther = false;
236  if (last != getDetectorEdge(det)) {
237  // ... if there is a detector ...
238  if (hasDetector(last)) {
239  if (!hasInBetweenDetectorsOnly(last, detectors)) {
240  // ... and it's not an in-between-detector
241  // -> let's add this edge and the following, but not any further
242  addNextNoFurther = true;
243  current.lastDetectorEdge = last;
244  current.duration2Last = (SUMOTime) current.duration_2;
245  current.distance2Last = current.distance;
246  current.endDetectorEdge = last;
247  if (hasSourceDetector(last, detectors)) {
249  }
250  current.factor = 1.;
251  double cdist = current.edges2Pass[0]->getFromJunction()->getPosition().distanceTo(current.edges2Pass.back()->getToJunction()->getPosition());
252  if (minDist < cdist) {
253  into.addRouteDesc(current);
254  }
255  continue;
256  } else {
257  // ... if it's an in-between-detector
258  // -> mark the current route as to be continued
259  current.passedNo = 0;
260  current.duration2Last = (SUMOTime) current.duration_2;
261  current.distance2Last = current.distance;
262  current.lastDetectorEdge = last;
263  }
264  }
265  }
266  // check for highway off-ramps
267  if (myAmInHighwayMode) {
268  // if it's beside the highway...
269  if (last->getSpeedLimit() < 19.4 && last != getDetectorEdge(det)) {
270  // ... and has more than one following edge
271  if (myApproachedEdges.find(last)->second.size() > 1) {
272  // -> let's add this edge and the following, but not any further
273  addNextNoFurther = true;
274  }
275 
276  }
277  }
278  // check for missing end connections
279  if (!addNextNoFurther) {
280  // ... if this one would be processed, but already too many edge
281  // without a detector occured
282  if (current.passedNo > maxFollowingLength) {
283  // mark not to process any further
284  WRITE_WARNING("Could not close route for '" + det.getID() + "'");
285  unfoundEnds.push_back(current);
286  current.factor = 1.;
287  double cdist = current.edges2Pass[0]->getFromJunction()->getPosition().distanceTo(current.edges2Pass.back()->getToJunction()->getPosition());
288  if (minDist < cdist) {
289  into.addRouteDesc(current);
290  }
291  continue;
292  }
293  }
294  // ... else: loop over the next edges
295  const ROEdgeVector& appr = myApproachedEdges.find(last)->second;
296  bool hadOne = false;
297  for (int i = 0; i < (int)appr.size(); i++) {
298  if (find(current.edges2Pass.begin(), current.edges2Pass.end(), appr[i]) != current.edges2Pass.end()) {
299  // do not append an edge twice (do not build loops)
300  continue;
301  }
302  RODFRouteDesc t(current);
303  t.duration_2 += (appr[i]->getLength() / appr[i]->getSpeedLimit());
304  t.distance += appr[i]->getLength();
305  t.edges2Pass.push_back(appr[i]);
306  if (!addNextNoFurther) {
307  t.passedNo = t.passedNo + 1;
308  toSolve.push(t);
309  } else {
310  if (!hadOne) {
311  t.factor = (double) 1. / (double) appr.size();
312  double cdist = current.edges2Pass[0]->getFromJunction()->getPosition().distanceTo(current.edges2Pass.back()->getToJunction()->getPosition());
313  if (minDist < cdist) {
314  into.addRouteDesc(t);
315  }
316  hadOne = true;
317  }
318  }
319  }
320  }
321  //
322  if (!keepUnfoundEnds) {
323  std::vector<RODFRouteDesc>::iterator i;
324  ConstROEdgeVector lastDetEdges;
325  for (i = unfoundEnds.begin(); i != unfoundEnds.end(); ++i) {
326  if (find(lastDetEdges.begin(), lastDetEdges.end(), (*i).lastDetectorEdge) == lastDetEdges.end()) {
327  lastDetEdges.push_back((*i).lastDetectorEdge);
328  } else {
329  bool ok = into.removeRouteDesc(*i);
330  assert(ok);
331  UNUSED_PARAMETER(ok); // ony used for assertion
332  }
333  }
334  } else {
335  // !!! patch the factors
336  }
337  while (!toSolve.empty()) {
338 // RODFRouteDesc d = toSolve.top();
339  toSolve.pop();
340 // delete d;
341  }
342 }
343 
344 
345 void
346 RODFNet::buildRoutes(RODFDetectorCon& detcont, bool keepUnfoundEnds, bool includeInBetween,
347  bool keepShortestOnly, int maxFollowingLength) const {
348  // build needed information first
350  // then build the routes
351  std::map<ROEdge*, RODFRouteCont* > doneEdges;
352  const std::vector< RODFDetector*>& dets = detcont.getDetectors();
353  for (std::vector< RODFDetector*>::const_iterator i = dets.begin(); i != dets.end(); ++i) {
354  ROEdge* e = getDetectorEdge(**i);
355  if (doneEdges.find(e) != doneEdges.end()) {
356  // use previously build routes
357  (*i)->addRoutes(new RODFRouteCont(*doneEdges[e]));
358  continue;
359  }
360  ROEdgeVector seen;
361  RODFRouteCont* routes = new RODFRouteCont();
362  doneEdges[e] = routes;
363  RODFRouteDesc rd;
364  rd.edges2Pass.push_back(e);
365  rd.duration_2 = (e->getLength() / e->getSpeedLimit());
366  rd.endDetectorEdge = 0;
367  rd.lastDetectorEdge = 0;
368  rd.distance = e->getLength();
369  rd.distance2Last = 0;
370  rd.duration2Last = 0;
371 
372  rd.overallProb = 0;
373 
374  ROEdgeVector visited;
375  visited.push_back(e);
376  computeRoutesFor(e, rd, 0, keepUnfoundEnds, keepShortestOnly,
377  visited, **i, *routes, detcont, maxFollowingLength, seen);
379  (*i)->addRoutes(routes);
380 
381  // add routes to in-between detectors if wished
382  if (includeInBetween) {
383  // go through the routes
384  const std::vector<RODFRouteDesc>& r = routes->get();
385  for (std::vector<RODFRouteDesc>::const_iterator j = r.begin(); j != r.end(); ++j) {
386  const RODFRouteDesc& mrd = *j;
387  double duration = mrd.duration_2;
388  double distance = mrd.distance;
389  // go through each route's edges
390  ROEdgeVector::const_iterator routeend = mrd.edges2Pass.end();
391  for (ROEdgeVector::const_iterator k = mrd.edges2Pass.begin(); k != routeend; ++k) {
392  // check whether any detectors lies on the current edge
393  if (myDetectorsOnEdges.find(*k) == myDetectorsOnEdges.end()) {
394  duration -= (*k)->getLength() / (*k)->getSpeedLimit();
395  distance -= (*k)->getLength();
396  continue;
397  }
398  // get the detectors
399  const std::vector<std::string>& dets = myDetectorsOnEdges.find(*k)->second;
400  // go through the detectors
401  for (std::vector<std::string>::const_iterator l = dets.begin(); l != dets.end(); ++l) {
402  const RODFDetector& m = detcont.getDetector(*l);
403  if (m.getType() == BETWEEN_DETECTOR) {
404  RODFRouteDesc nrd;
405  copy(k, routeend, back_inserter(nrd.edges2Pass));
406  nrd.duration_2 = duration;
409  nrd.distance = distance;
410  nrd.distance2Last = mrd.distance2Last;
411  nrd.duration2Last = mrd.duration2Last;
412  nrd.overallProb = mrd.overallProb;
413  nrd.factor = mrd.factor;
414  ((RODFDetector&) m).addRoute(nrd);
415  }
416  }
417  duration -= (*k)->getLength() / (*k)->getSpeedLimit();
418  distance -= (*k)->getLength();
419  }
420  }
421  }
422 
423  }
424 }
425 
426 
427 void
429  RODFDetectorFlows& flows,
430  SUMOTime startTime, SUMOTime endTime,
431  SUMOTime stepOffset) {
432  {
433  if (flows.knows(detector->getID())) {
434  const std::vector<FlowDef>& detFlows = flows.getFlowDefs(detector->getID());
435  for (std::vector<FlowDef>::const_iterator j = detFlows.begin(); j != detFlows.end(); ++j) {
436  if ((*j).qPKW > 0 || (*j).qLKW > 0) {
437  return;
438  }
439  }
440  }
441  }
442  // ok, there is no information for the whole time;
443  // lets find preceding detectors and rebuild the flows if possible
444  WRITE_WARNING("Detector '" + detector->getID() + "' has no flows.\n Trying to rebuild.");
445  // go back and collect flows
446  ROEdgeVector previous;
447  {
448  std::vector<IterationEdge> missing;
449  IterationEdge ie;
450  ie.depth = 0;
451  ie.edge = getDetectorEdge(*detector);
452  missing.push_back(ie);
453  bool maxDepthReached = false;
454  while (!missing.empty() && !maxDepthReached) {
455  IterationEdge last = missing.back();
456  missing.pop_back();
457  ROEdgeVector approaching = myApproachingEdges[last.edge];
458  for (ROEdgeVector::const_iterator j = approaching.begin(); j != approaching.end(); ++j) {
459  if (hasDetector(*j)) {
460  previous.push_back(*j);
461  } else {
462  ie.depth = last.depth + 1;
463  ie.edge = *j;
464  missing.push_back(ie);
465  if (ie.depth > 5) {
466  maxDepthReached = true;
467  }
468  }
469  }
470  }
471  if (maxDepthReached) {
472  WRITE_WARNING(" Could not build list of previous flows.");
473  }
474  }
475  // Edges with previous detectors are now in "previous";
476  // compute following
477  ROEdgeVector latter;
478  {
479  std::vector<IterationEdge> missing;
480  for (ROEdgeVector::const_iterator k = previous.begin(); k != previous.end(); ++k) {
481  IterationEdge ie;
482  ie.depth = 0;
483  ie.edge = *k;
484  missing.push_back(ie);
485  }
486  bool maxDepthReached = false;
487  while (!missing.empty() && !maxDepthReached) {
488  IterationEdge last = missing.back();
489  missing.pop_back();
490  ROEdgeVector approached = myApproachedEdges[last.edge];
491  for (ROEdgeVector::const_iterator j = approached.begin(); j != approached.end(); ++j) {
492  if (*j == getDetectorEdge(*detector)) {
493  continue;
494  }
495  if (hasDetector(*j)) {
496  latter.push_back(*j);
497  } else {
498  IterationEdge ie;
499  ie.depth = last.depth + 1;
500  ie.edge = *j;
501  missing.push_back(ie);
502  if (ie.depth > 5) {
503  maxDepthReached = true;
504  }
505  }
506  }
507  }
508  if (maxDepthReached) {
509  WRITE_WARNING(" Could not build list of latter flows.");
510  return;
511  }
512  }
513  // Edges with latter detectors are now in "latter";
514 
515  // lets not validate them by now - surely this should be done
516  // for each time step: collect incoming flows; collect outgoing;
517  std::vector<FlowDef> mflows;
518  int index = 0;
519  for (SUMOTime t = startTime; t < endTime; t += stepOffset, index++) {
520  FlowDef inFlow;
521  inFlow.qLKW = 0;
522  inFlow.qPKW = 0;
523  inFlow.vLKW = 0;
524  inFlow.vPKW = 0;
525  // collect incoming
526  {
527  // !! time difference is missing
528  for (ROEdgeVector::iterator i = previous.begin(); i != previous.end(); ++i) {
529  const std::vector<FlowDef>& flows = static_cast<const RODFEdge*>(*i)->getFlows();
530  if (flows.size() != 0) {
531  const FlowDef& srcFD = flows[index];
532  inFlow.qLKW += srcFD.qLKW;
533  inFlow.qPKW += srcFD.qPKW;
534  inFlow.vLKW += srcFD.vLKW;
535  inFlow.vPKW += srcFD.vPKW;
536  }
537  }
538  }
539  inFlow.vLKW /= (double) previous.size();
540  inFlow.vPKW /= (double) previous.size();
541  // collect outgoing
542  FlowDef outFlow;
543  outFlow.qLKW = 0;
544  outFlow.qPKW = 0;
545  outFlow.vLKW = 0;
546  outFlow.vPKW = 0;
547  {
548  // !! time difference is missing
549  for (ROEdgeVector::iterator i = latter.begin(); i != latter.end(); ++i) {
550  const std::vector<FlowDef>& flows = static_cast<const RODFEdge*>(*i)->getFlows();
551  if (flows.size() != 0) {
552  const FlowDef& srcFD = flows[index];
553  outFlow.qLKW += srcFD.qLKW;
554  outFlow.qPKW += srcFD.qPKW;
555  outFlow.vLKW += srcFD.vLKW;
556  outFlow.vPKW += srcFD.vPKW;
557  }
558  }
559  }
560  outFlow.vLKW /= (double) latter.size();
561  outFlow.vPKW /= (double) latter.size();
562  //
563  FlowDef mFlow;
564  mFlow.qLKW = inFlow.qLKW - outFlow.qLKW;
565  mFlow.qPKW = inFlow.qPKW - outFlow.qPKW;
566  mFlow.vLKW = (inFlow.vLKW + outFlow.vLKW) / (double) 2.;
567  mFlow.vPKW = (inFlow.vPKW + outFlow.vPKW) / (double) 2.;
568  mflows.push_back(mFlow);
569  }
570  static_cast<RODFEdge*>(getDetectorEdge(*detector))->setFlows(mflows);
571  flows.setFlows(detector->getID(), mflows);
572 }
573 
574 
575 void
577  RODFDetectorFlows& flows,
578  SUMOTime startTime, SUMOTime endTime,
579  SUMOTime stepOffset) {
580  const std::vector<RODFDetector*>& dets = detectors.getDetectors();
581  for (std::vector<RODFDetector*>::const_iterator i = dets.begin(); i != dets.end(); ++i) {
582  // check whether there is at least one entry with a flow larger than zero
583  revalidateFlows(*i, flows, startTime, endTime, stepOffset);
584  }
585 }
586 
587 
588 
589 void
591  RODFDetectorFlows& flows) {
592  const std::vector<RODFDetector*>& dets = detectors.getDetectors();
593  for (std::vector<RODFDetector*>::const_iterator i = dets.begin(); i != dets.end();) {
594  bool remove = true;
595  // check whether there is at least one entry with a flow larger than zero
596  if (flows.knows((*i)->getID())) {
597  remove = false;
598  }
599  if (remove) {
600  WRITE_MESSAGE("Removed detector '" + (*i)->getID() + "' because no flows for him exist.");
601  flows.removeFlow((*i)->getID());
602  detectors.removeDetector((*i)->getID());
603  i = dets.begin();
604  } else {
605  i++;
606  }
607  }
608 }
609 
610 
611 
612 void
614  RODFDetectorFlows& flows) {
615  const std::vector<RODFDetector*>& dets = detectors.getDetectors();
616  for (std::vector<RODFDetector*>::const_iterator i = dets.begin(); i != dets.end(); ++i) {
617  bool remove = true;
618  // check whether there is at least one entry with a flow larger than zero
619  if (flows.knows((*i)->getID())) {
620  remove = false;
621  }
622  if (remove) {
623  WRITE_MESSAGE("Detector '" + (*i)->getID() + "' has no flow.");
624  }
625  }
626 }
627 
628 
629 
630 ROEdge*
632  std::string edgeName = det.getLaneID();
633  edgeName = edgeName.substr(0, edgeName.rfind('_'));
634  ROEdge* ret = getEdge(edgeName);
635  if (ret == 0) {
636  throw ProcessError("Edge '" + edgeName + "' used by detector '" + det.getID() + "' is not known.");
637  }
638  return ret;
639 }
640 
641 
642 bool
644  return
645  myApproachingEdges.find(edge) != myApproachingEdges.end()
646  &&
647  myApproachingEdges.find(edge)->second.size() != 0;
648 }
649 
650 
651 bool
653  return
654  myApproachedEdges.find(edge) != myApproachedEdges.end()
655  &&
656  myApproachedEdges.find(edge)->second.size() != 0;
657 }
658 
659 
660 bool
662  return
663  myDetectorsOnEdges.find(edge) != myDetectorsOnEdges.end()
664  &&
665  myDetectorsOnEdges.find(edge)->second.size() != 0;
666 }
667 
668 
669 const std::vector<std::string>&
671  return myDetectorsOnEdges.find(edge)->second;
672 }
673 
674 
675 double
676 RODFNet::getAbsPos(const RODFDetector& det) const {
677  if (det.getPos() >= 0) {
678  return det.getPos();
679  }
680  return getDetectorEdge(det)->getLength() + det.getPos();
681 }
682 
683 bool
684 RODFNet::isSource(const RODFDetector& det, const RODFDetectorCon& detectors,
685  bool strict) const {
686  ROEdgeVector seen;
687  return
688  isSource(det, getDetectorEdge(det), seen, detectors, strict);
689 }
690 
691 bool
692 RODFNet::isFalseSource(const RODFDetector& det, const RODFDetectorCon& detectors) const {
693  ROEdgeVector seen;
694  return
695  isFalseSource(det, getDetectorEdge(det), seen, detectors);
696 }
697 
698 bool
699 RODFNet::isDestination(const RODFDetector& det, const RODFDetectorCon& detectors) const {
700  ROEdgeVector seen;
701  return isDestination(det, getDetectorEdge(det), seen, detectors);
702 }
703 
704 
705 bool
707  ROEdgeVector& seen,
708  const RODFDetectorCon& detectors,
709  bool strict) const {
710  if (seen.size() == 1000) { // !!!
711  WRITE_WARNING("Quitting checking for being a source for detector '" + det.getID() + "' due to seen edge limit.");
712  return false;
713  }
714  if (edge == getDetectorEdge(det)) {
715  // maybe there is another detector at the same edge
716  // get the list of this/these detector(s)
717  const std::vector<std::string>& detsOnEdge = myDetectorsOnEdges.find(edge)->second;
718  for (std::vector<std::string>::const_iterator i = detsOnEdge.begin(); i != detsOnEdge.end(); ++i) {
719  if ((*i) == det.getID()) {
720  continue;
721  }
722  const RODFDetector& sec = detectors.getDetector(*i);
723  if (getAbsPos(sec) < getAbsPos(det)) {
724  // ok, there is another detector on the same edge and it is
725  // before this one -> no source
726  return false;
727  }
728  }
729  }
730  // it's a source if no edges are approaching the edge
731  if (!hasApproaching(edge)) {
732  if (edge != getDetectorEdge(det)) {
733  if (hasDetector(edge)) {
734  return false;
735  }
736  }
737  return true;
738  }
739  if (edge != getDetectorEdge(det)) {
740  // ok, we are at one of the edges in front
741  if (myAmInHighwayMode) {
742  if (edge->getSpeedLimit() >= 19.4) {
743  if (hasDetector(edge)) {
744  // we are still on the highway and there is another detector
745  return false;
746  }
747  // the next is a hack for the A100 scenario...
748  // We have to look into further edges herein edges
749  const ROEdgeVector& appr = myApproachingEdges.find(edge)->second;
750  int noOk = 0;
751  int noFalse = 0;
752  int noSkipped = 0;
753  for (int i = 0; i < (int)appr.size(); i++) {
754  if (!hasDetector(appr[i])) {
755  noOk++;
756  } else {
757  noFalse++;
758  }
759  }
760  if (noFalse + noSkipped == (int)appr.size()) {
761  return false;
762  }
763  }
764  }
765  }
766 
767  if (myAmInHighwayMode) {
768  if (edge->getSpeedLimit() < 19.4 && edge != getDetectorEdge(det)) {
769  // we have left the highway already
770  // -> the detector will be a highway source
771  if (!hasDetector(edge)) {
772  return true;
773  }
774  }
775  }
776  if (myDetectorsOnEdges.find(edge) != myDetectorsOnEdges.end()
777  &&
778  myDetectorEdges.find(det.getID())->second != edge) {
779  return false;
780  }
781 
782  // let's check the edges in front
783  const ROEdgeVector& appr = myApproachingEdges.find(edge)->second;
784  int numOk = 0;
785  int numFalse = 0;
786  int numSkipped = 0;
787  seen.push_back(edge);
788  for (int i = 0; i < (int)appr.size(); i++) {
789  bool had = std::find(seen.begin(), seen.end(), appr[i]) != seen.end();
790  if (!had) {
791  if (isSource(det, appr[i], seen, detectors, strict)) {
792  numOk++;
793  } else {
794  numFalse++;
795  }
796  } else {
797  numSkipped++;
798  }
799  }
800  if (strict) {
801  return numOk + numSkipped == (int)appr.size();
802  }
803  return numFalse + numSkipped != (int)appr.size();
804 }
805 
806 
807 bool
809  const RODFDetectorCon& detectors) const {
810  if (seen.size() == 1000) { // !!!
811  WRITE_WARNING("Quitting checking for being a destination for detector '" + det.getID() + "' due to seen edge limit.");
812  return false;
813  }
814  if (edge == getDetectorEdge(det)) {
815  // maybe there is another detector at the same edge
816  // get the list of this/these detector(s)
817  const std::vector<std::string>& detsOnEdge = myDetectorsOnEdges.find(edge)->second;
818  for (std::vector<std::string>::const_iterator i = detsOnEdge.begin(); i != detsOnEdge.end(); ++i) {
819  if ((*i) == det.getID()) {
820  continue;
821  }
822  const RODFDetector& sec = detectors.getDetector(*i);
823  if (getAbsPos(sec) > getAbsPos(det)) {
824  // ok, there is another detector on the same edge and it is
825  // after this one -> no destination
826  return false;
827  }
828  }
829  }
830  if (!hasApproached(edge)) {
831  if (edge != getDetectorEdge(det)) {
832  if (hasDetector(edge)) {
833  return false;
834  }
835  }
836  return true;
837  }
838  if (edge != getDetectorEdge(det)) {
839  // ok, we are at one of the edges coming behind
840  if (myAmInHighwayMode) {
841  if (edge->getSpeedLimit() >= 19.4) {
842  if (hasDetector(edge)) {
843  // we are still on the highway and there is another detector
844  return false;
845  }
846  }
847  }
848  }
849 
850  if (myAmInHighwayMode) {
851  if (edge->getSpeedLimit() < 19.4 && edge != getDetectorEdge(det)) {
852  if (hasDetector(edge)) {
853  return true;
854  }
855  if (myApproachedEdges.find(edge)->second.size() > 1) {
856  return true;
857  }
858 
859  }
860  }
861 
862  if (myDetectorsOnEdges.find(edge) != myDetectorsOnEdges.end()
863  &&
864  myDetectorEdges.find(det.getID())->second != edge) {
865  return false;
866  }
867  const ROEdgeVector& appr = myApproachedEdges.find(edge)->second;
868  bool isall = true;
869  int no = 0;
870  seen.push_back(edge);
871  for (int i = 0; i < (int)appr.size() && isall; i++) {
872  bool had = std::find(seen.begin(), seen.end(), appr[i]) != seen.end();
873  if (!had) {
874  if (!isDestination(det, appr[i], seen, detectors)) {
875  no++;
876  isall = false;
877  }
878  }
879  }
880  return isall;
881 }
882 
883 bool
885  const RODFDetectorCon& detectors) const {
886  if (seen.size() == 1000) { // !!!
887  WRITE_WARNING("Quitting checking for being a false source for detector '" + det.getID() + "' due to seen edge limit.");
888  return false;
889  }
890  seen.push_back(edge);
891  if (edge != getDetectorEdge(det)) {
892  // ok, we are at one of the edges coming behind
893  if (hasDetector(edge)) {
894  const std::vector<std::string>& dets = myDetectorsOnEdges.find(edge)->second;
895  for (std::vector<std::string>::const_iterator i = dets.begin(); i != dets.end(); ++i) {
896  if (detectors.getDetector(*i).getType() == SINK_DETECTOR) {
897  return false;
898  }
899  if (detectors.getDetector(*i).getType() == BETWEEN_DETECTOR) {
900  return false;
901  }
902  if (detectors.getDetector(*i).getType() == SOURCE_DETECTOR) {
903  return true;
904  }
905  }
906  } else {
907  if (myAmInHighwayMode && edge->getSpeedLimit() < 19.) {
908  return false;
909  }
910  }
911  }
912 
913  if (myApproachedEdges.find(edge) == myApproachedEdges.end()) {
914  return false;
915  }
916 
917  const ROEdgeVector& appr = myApproachedEdges.find(edge)->second;
918  bool isall = false;
919  for (int i = 0; i < (int)appr.size() && !isall; i++) {
920  //printf("checking %s->\n", appr[i].c_str());
921  bool had = std::find(seen.begin(), seen.end(), appr[i]) != seen.end();
922  if (!had) {
923  if (isFalseSource(det, appr[i], seen, detectors)) {
924  isall = true;
925  }
926  }
927  }
928  return isall;
929 }
930 
931 
932 void
934  const RODFDetectorCon& detectors,
935  SUMOTime startTime, SUMOTime endTime,
936  SUMOTime stepOffset) {
937  std::map<ROEdge*, std::vector<std::string>, idComp>::iterator i;
938  double speedFactorSumPKW = 0;
939  double speedFactorSumLKW = 0;
940  double speedFactorCountPKW = 0;
941  double speedFactorCountLKW = 0;
942  for (i = myDetectorsOnEdges.begin(); i != myDetectorsOnEdges.end(); ++i) {
943  ROEdge* into = (*i).first;
944  const double maxSpeedPKW = into->getVClassMaxSpeed(SVC_PASSENGER);
945  const double maxSpeedLKW = into->getVClassMaxSpeed(SVC_TRUCK);
946 
947  const std::vector<std::string>& dets = (*i).second;
948  std::map<double, std::vector<std::string> > cliques;
949  std::vector<std::string>* maxClique = 0;
950  for (std::vector<std::string>::const_iterator j = dets.begin(); j != dets.end(); ++j) {
951  if (!flows.knows(*j)) {
952  continue;
953  }
954  const RODFDetector& det = detectors.getDetector(*j);
955  bool found = false;
956  for (std::map<double, std::vector<std::string> >::iterator k = cliques.begin(); !found && k != cliques.end(); ++k) {
957  if (fabs((*k).first - det.getPos()) < 1) {
958  (*k).second.push_back(*j);
959  if ((*k).second.size() > maxClique->size()) {
960  maxClique = &(*k).second;
961  }
962  found = true;
963  }
964  }
965  if (!found) {
966  cliques[det.getPos()].push_back(*j);
967  maxClique = &cliques[det.getPos()];
968  }
969  }
970  if (maxClique == 0) {
971  continue;
972  }
973  std::vector<FlowDef> mflows; // !!! reserve
974  for (SUMOTime t = startTime; t < endTime; t += stepOffset) {
975  FlowDef fd;
976  fd.qPKW = 0;
977  fd.qLKW = 0;
978  fd.vLKW = 0;
979  fd.vPKW = 0;
980  fd.fLKW = 0;
981  fd.isLKW = 0;
982  mflows.push_back(fd);
983  }
984  for (std::vector<std::string>::iterator l = maxClique->begin(); l != maxClique->end(); ++l) {
985  bool didWarn = false;
986  const std::vector<FlowDef>& dflows = flows.getFlowDefs(*l);
987  int index = 0;
988  for (SUMOTime t = startTime; t < endTime; t += stepOffset, index++) {
989  const FlowDef& srcFD = dflows[index];
990  FlowDef& fd = mflows[index];
991  fd.qPKW += srcFD.qPKW;
992  fd.qLKW += srcFD.qLKW;
993  fd.vLKW += srcFD.vLKW / (double) maxClique->size();
994  fd.vPKW += srcFD.vPKW / (double) maxClique->size();
995  fd.fLKW += srcFD.fLKW / (double) maxClique->size();
996  fd.isLKW += srcFD.isLKW / (double) maxClique->size();
997  const double speedFactorPKW = srcFD.vPKW / 3.6 / maxSpeedPKW;
998  const double speedFactorLKW = srcFD.vLKW / 3.6 / maxSpeedLKW;
999  myMaxSpeedFactorPKW = MAX2(myMaxSpeedFactorPKW, speedFactorPKW);
1000  myMaxSpeedFactorLKW = MAX2(myMaxSpeedFactorLKW, speedFactorLKW);
1001  speedFactorCountPKW += srcFD.qPKW;
1002  speedFactorCountLKW += srcFD.qLKW;
1003  speedFactorSumPKW += srcFD.qPKW * speedFactorPKW;
1004  speedFactorSumLKW += srcFD.qLKW * speedFactorLKW;
1005  if (!didWarn && srcFD.vPKW > 0 && srcFD.vPKW < 255 && srcFD.vPKW / 3.6 > into->getSpeedLimit()) {
1006  WRITE_MESSAGE("Detected PKW speed (" + toString(srcFD.vPKW / 3.6, 3) + ") higher than allowed speed (" + toString(into->getSpeedLimit(), 3) + ") at '" + (*l) + "' on edge '" + into->getID() + "'.");
1007  didWarn = true;
1008  }
1009  if (!didWarn && srcFD.vLKW > 0 && srcFD.vLKW < 255 && srcFD.vLKW / 3.6 > into->getSpeedLimit()) {
1010  WRITE_MESSAGE("Detected LKW speed (" + toString(srcFD.vLKW / 3.6, 3) + ") higher than allowed speed (" + toString(into->getSpeedLimit(), 3) + ") at '" + (*l) + "' on edge '" + into->getID() + "'.");
1011  didWarn = true;
1012  }
1013  }
1014  }
1015  static_cast<RODFEdge*>(into)->setFlows(mflows);
1016  }
1017  // @note: this assumes that the speedFactors are independent of location and time
1018  if (speedFactorCountPKW > 0) {
1019  myAvgSpeedFactorPKW = speedFactorSumPKW / speedFactorCountPKW;
1020  WRITE_MESSAGE("Average speedFactor for PKW is " + toString(myAvgSpeedFactorPKW) + " maximum speedFactor is " + toString(myMaxSpeedFactorPKW) + ".");
1021  }
1022  if (speedFactorCountLKW > 0) {
1023  myAvgSpeedFactorLKW = speedFactorSumLKW / speedFactorCountLKW;
1024  WRITE_MESSAGE("Average speedFactor for LKW is " + toString(myAvgSpeedFactorLKW) + " maximum speedFactor is " + toString(myMaxSpeedFactorLKW) + ".");
1025  }
1026 
1027 }
1028 
1029 
1030 void
1032  // !!! this will not work when several detectors are lying on the same edge on different positions
1033 
1034 
1035  buildDetectorEdgeDependencies(detectors);
1036  // for each detector, compute the lists of predecessor and following detectors
1037  std::map<std::string, ROEdge*>::const_iterator i;
1038  for (i = myDetectorEdges.begin(); i != myDetectorEdges.end(); ++i) {
1039  const RODFDetector& det = detectors.getDetector((*i).first);
1040  if (!det.hasRoutes()) {
1041  continue;
1042  }
1043  // mark current detectors
1044  std::vector<RODFDetector*> last;
1045  {
1046  const std::vector<std::string>& detNames = myDetectorsOnEdges.find((*i).second)->second;
1047  for (std::vector<std::string>::const_iterator j = detNames.begin(); j != detNames.end(); ++j) {
1048  last.push_back(&detectors.getModifiableDetector(*j));
1049  }
1050  }
1051  // iterate over the current detector's routes
1052  const std::vector<RODFRouteDesc>& routes = det.getRouteVector();
1053  for (std::vector<RODFRouteDesc>::const_iterator j = routes.begin(); j != routes.end(); ++j) {
1054  const ROEdgeVector& edges2Pass = (*j).edges2Pass;
1055  for (ROEdgeVector::const_iterator k = edges2Pass.begin() + 1; k != edges2Pass.end(); ++k) {
1056  if (myDetectorsOnEdges.find(*k) != myDetectorsOnEdges.end()) {
1057  const std::vector<std::string>& detNames = myDetectorsOnEdges.find(*k)->second;
1058  // ok, consecutive detector found
1059  for (std::vector<RODFDetector*>::iterator l = last.begin(); l != last.end(); ++l) {
1060  // mark as follower of current
1061  for (std::vector<std::string>::const_iterator m = detNames.begin(); m != detNames.end(); ++m) {
1062  detectors.getModifiableDetector(*m).addPriorDetector(*l);
1063  (*l)->addFollowingDetector(&detectors.getDetector(*m));
1064  }
1065  }
1066  last.clear();
1067  for (std::vector<std::string>::const_iterator m = detNames.begin(); m != detNames.end(); ++m) {
1068  last.push_back(&detectors.getModifiableDetector(*m));
1069  }
1070  }
1071  }
1072  }
1073  }
1074 }
1075 
1076 
1077 void
1079  buildDetectorEdgeDependencies(detectors);
1080  std::map<ROEdge*, std::vector<std::string>, idComp>::iterator i;
1081  for (i = myDetectorsOnEdges.begin(); i != myDetectorsOnEdges.end(); ++i) {
1082  const std::vector<std::string>& dets = (*i).second;
1083  std::map<double, std::vector<std::string> > cliques;
1084  // compute detector cliques
1085  for (std::vector<std::string>::const_iterator j = dets.begin(); j != dets.end(); ++j) {
1086  const RODFDetector& det = detectors.getDetector(*j);
1087  bool found = false;
1088  for (std::map<double, std::vector<std::string> >::iterator k = cliques.begin(); !found && k != cliques.end(); ++k) {
1089  if (fabs((*k).first - det.getPos()) < 10.) {
1090  (*k).second.push_back(*j);
1091  found = true;
1092  }
1093  }
1094  if (!found) {
1095  cliques[det.getPos()] = std::vector<std::string>();
1096  cliques[det.getPos()].push_back(*j);
1097  }
1098  }
1099  // join detector cliques
1100  for (std::map<double, std::vector<std::string> >::iterator m = cliques.begin(); m != cliques.end(); ++m) {
1101  std::vector<std::string> clique = (*m).second;
1102  // do not join if only one
1103  if (clique.size() == 1) {
1104  continue;
1105  }
1106  std::string nid;
1107  for (std::vector<std::string>::iterator n = clique.begin(); n != clique.end(); ++n) {
1108  std::cout << *n << " ";
1109  if (n != clique.begin()) {
1110  nid = nid + "_";
1111  }
1112  nid = nid + *n;
1113  }
1114  std::cout << ":" << nid << std::endl;
1115  flows.mesoJoin(nid, (*m).second);
1116  detectors.mesoJoin(nid, (*m).second);
1117  }
1118  }
1119 }
1120 
1121 
1122 
1123 /****************************************************************************/
1124 
void mesoJoin(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
Definition: RODFNet.cpp:1078
void revalidateFlows(const RODFDetectorCon &detectors, RODFDetectorFlows &flows, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
Definition: RODFNet.cpp:576
std::vector< std::string > myDisallowedEdges
List of ids of edges that shall not be used.
Definition: RODFNet.h:189
RODFDetector & getModifiableDetector(const std::string &id) const
~RODFNet()
Destructor.
Definition: RODFNet.cpp:65
double myAvgSpeedFactorLKW
Definition: RODFNet.h:198
double myAvgSpeedFactorPKW
Definition: RODFNet.h:197
void removeDetector(const std::string &id)
double fLKW
A source detector.
Definition: RODFDetector.h:77
const RODFDetector & getDetector(const std::string &id) const
bool myKeepTurnarounds
Definition: RODFNet.h:192
bool isFalseSource(const RODFDetector &det, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:692
const RONode * getFromJunction() const
Definition: ROEdge.h:446
bool isSource(const RODFDetector &det, const RODFDetectorCon &detectors, bool strict) const
Definition: RODFNet.cpp:684
void computeTypes(RODFDetectorCon &dets, bool sourcesStrict) const
Definition: RODFNet.cpp:114
void removeFlow(const std::string &detector_id)
std::map< ROEdge *, ROEdgeVector > myApproachedEdges
Map of edge name->list of names of edges approached by this edge.
Definition: RODFNet.h:180
void reportEmptyDetectors(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
Definition: RODFNet.cpp:613
ROEdgeVector edges2Pass
The edges the route is made of.
Definition: RODFRouteDesc.h:56
T MAX2(T a, T b)
Definition: StdDefs.h:70
void addPriorDetector(const RODFDetector *det)
bool hasDetector(ROEdge *edge) const
Definition: RODFNet.cpp:661
double getAbsPos(const RODFDetector &det) const
Definition: RODFNet.cpp:676
const std::vector< RODFDetector * > & getDetectors() const
double getLength() const
Returns the length of the edge.
Definition: ROEdge.h:198
int myInBetweenNumber
Definition: RODFNet.h:186
std::vector< const ROEdge * > ConstROEdgeVector
Definition: ROEdge.h:62
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
const std::string & getID() const
Returns the id.
Definition: Named.h:66
ROEdge * getDetectorEdge(const RODFDetector &det) const
Definition: RODFNet.cpp:631
RODFDetectorType getType() const
Returns the type of the detector.
Definition: RODFDetector.h:151
const RONode * getToJunction() const
Definition: ROEdge.h:450
const std::vector< RODFRouteDesc > & getRouteVector() const
bool knows(const std::string &det_id) const
int mySourceNumber
Definition: RODFNet.h:186
std::vector< RODFRouteDesc > & get()
Returns the container of stored routes.
A container for flows.
A container for RODFDetectors.
Definition: RODFDetector.h:228
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:38
const std::vector< FlowDef > & getFlows() const
Definition: RODFEdge.cpp:56
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:200
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:65
double duration_2
Definition: RODFRouteDesc.h:59
vehicle is a large transport vehicle
double vPKW
comparator for maps using edges as key, used only in myDetectorsOnEdges to make tests comparable ...
Definition: RODFNet.h:170
A not yet defined detector.
Definition: RODFDetector.h:68
bool hasRoutes() const
bool removeRouteDesc(RODFRouteDesc &desc)
Removes the given route description from the container.
double vLKW
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:56
An in-between detector.
Definition: RODFDetector.h:74
int mySinkNumber
Definition: RODFNet.h:186
RODFNet(bool amInHighwayMode)
Constructor.
Definition: RODFNet.cpp:53
std::vector< ROEdge * > ROEdgeVector
Definition: RODFRouteDesc.h:43
A detector which had to be discarded (!!!)
Definition: RODFDetector.h:71
const std::vector< std::string > & getDetectorList(ROEdge *edge) const
Definition: RODFNet.cpp:670
std::vector< std::string > getStringVector(const std::string &name) const
Returns the list of string-vector-value of the named option (only for Option_String) ...
#define PROGRESS_BEGIN_MESSAGE(msg)
Definition: MsgHandler.h:202
void setFlows(const std::string &detector_id, std::vector< FlowDef > &)
void buildApproachList()
Definition: RODFNet.cpp:70
Definition of the traffic during a certain time containing the flows and speeds.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
double overallProb
Definition: RODFRouteDesc.h:67
double qPKW
vehicle is a passenger car (a "normal" car)
A route within the DFROUTER.
Definition: RODFRouteDesc.h:54
A basic edge for routing applications.
Definition: ROEdge.h:77
std::map< ROEdge *, ROEdgeVector > myApproachingEdges
Map of edge name->list of names of this edge approaching edges.
Definition: RODFNet.h:177
double myMaxSpeedFactorPKW
maximum speed factor in measurements
Definition: RODFNet.h:195
const std::string & getLaneID() const
Returns the id of the lane this detector is placed on.
Definition: RODFDetector.h:126
bool hasApproached(ROEdge *edge) const
Definition: RODFNet.cpp:652
void buildRoutes(RODFDetectorCon &det, bool keepUnfoundEnds, bool includeInBetween, bool keepShortestOnly, int maxFollowingLength) const
Definition: RODFNet.cpp:346
double myMaxSpeedFactorLKW
Definition: RODFNet.h:196
bool hasApproaching(ROEdge *edge) const
Definition: RODFNet.cpp:643
SUMOTime duration2Last
Definition: RODFRouteDesc.h:65
The router&#39;s network representation.
Definition: RONet.h:76
bool hasSourceDetector(ROEdge *edge, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:170
double distance2Last
Definition: RODFRouteDesc.h:64
void buildEdgeFlowMap(const RODFDetectorFlows &flows, const RODFDetectorCon &detectors, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
Definition: RODFNet.cpp:933
double isLKW
const ROEdgeVector & getSuccessors() const
Returns the following edges.
Definition: ROEdge.h:315
double qLKW
void buildDetectorDependencies(RODFDetectorCon &detectors)
Definition: RODFNet.cpp:1031
Class representing a detector within the DFROUTER.
Definition: RODFDetector.h:89
const ROEdge * endDetectorEdge
Definition: RODFRouteDesc.h:62
double getSpeedLimit() const
Returns the speed allowed on this edge.
Definition: ROEdge.h:213
const std::map< std::string, ROEdge * > & getEdgeMap() const
Definition: RONet.cpp:659
std::map< std::string, ROEdge * > myDetectorEdges
Definition: RODFNet.h:183
A container for DFROUTER-routes.
Definition: RODFRouteCont.h:63
bool hasInBetweenDetectorsOnly(ROEdge *edge, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:154
const std::vector< FlowDef > & getFlowDefs(const std::string &id) const
bool isDestination(const RODFDetector &det, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:699
double getVClassMaxSpeed(SUMOVehicleClass vclass) const
Returns the lane&#39;s maximum speed, given a vehicle&#39;s speed limit adaptation.
Definition: ROEdge.h:231
std::map< ROEdge *, std::vector< std::string >, idComp > myDetectorsOnEdges
Definition: RODFNet.h:182
void mesoJoin(const std::string &nid, const std::vector< std::string > &oldids)
bool myAmInHighwayMode
Definition: RODFNet.h:185
long long int SUMOTime
Definition: TraCIDefs.h:52
void computeRoutesFor(ROEdge *edge, RODFRouteDesc &base, int no, bool keepUnfoundEnds, bool keepShortestOnly, ROEdgeVector &visited, const RODFDetector &det, RODFRouteCont &into, const RODFDetectorCon &detectors, int maxFollowingLength, ROEdgeVector &seen) const
Definition: RODFNet.cpp:187
ROEdge * getEdge(const std::string &name) const
Retrieves an edge from the network.
Definition: RONet.h:165
void removeEmptyDetectors(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
Definition: RODFNet.cpp:590
void mesoJoin(const std::string &nid, const std::vector< std::string > &oldids)
#define PROGRESS_DONE_MESSAGE()
Definition: MsgHandler.h:203
const ROEdge * lastDetectorEdge
Definition: RODFRouteDesc.h:63
void addRouteDesc(RODFRouteDesc &desc)
Adds a route to the container.
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:201
void buildDetectorEdgeDependencies(RODFDetectorCon &dets) const
Definition: RODFNet.cpp:101
double getPos() const
Returns the position at which the detector lies.
Definition: RODFDetector.h:142
int myInvalidNumber
Definition: RODFNet.h:186