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