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