SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RODFNet.cpp
Go to the documentation of this file.
1 /****************************************************************************/
10 // A DFROUTER-network
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
13 // Copyright (C) 2001-2014 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 <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 #ifdef CHECK_MEMORY_LEAKS
49 #include <foreign/nvwa/debug_new.h>
50 #endif // CHECK_MEMORY_LEAKS
51 
52 
53 // ===========================================================================
54 // method definitions
55 // ===========================================================================
56 RODFNet::RODFNet(bool amInHighwayMode)
57  : RONet(), myAmInHighwayMode(amInHighwayMode),
58  mySourceNumber(0), mySinkNumber(0), myInBetweenNumber(0), myInvalidNumber(0) {
60  myKeepTurnarounds = OptionsCont::getOptions().getBool("keep-turnarounds");
61 }
62 
63 
65 }
66 
67 
68 void
70  const std::map<std::string, ROEdge*>& edges = getEdgeMap();
71  for (std::map<std::string, ROEdge*>::const_iterator rit = edges.begin(); rit != edges.end(); ++rit) {
72  ROEdge* ce = (*rit).second;
73  unsigned int i = 0;
74  unsigned int length_size = ce->getNoFollowing();
75  for (i = 0; i < length_size; i++) {
76  ROEdge* help = ce->getFollower(i);
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->getToNode() == ce->getFromNode()) {
82  // do not use turnarounds
83  continue;
84  }
85  // add the connection help->ce to myApproachingEdges
86  if (myApproachingEdges.find(help) == myApproachingEdges.end()) {
87  myApproachingEdges[help] = std::vector<ROEdge*>();
88  }
89  myApproachingEdges[help].push_back(ce);
90  // add the connection ce->help to myApproachingEdges
91  if (myApproachedEdges.find(ce) == myApproachedEdges.end()) {
92  myApproachedEdges[ce] = std::vector<ROEdge*>();
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  std::vector<ROEdge*>& /*visited*/,
191  const RODFDetector& det, RODFRouteCont& into,
192  const RODFDetectorCon& detectors,
193  int maxFollowingLength,
194  std::vector<ROEdge*>& seen) const {
195  std::vector<RODFRouteDesc> unfoundEnds;
196  std::priority_queue<RODFRouteDesc, std::vector<RODFRouteDesc>, DFRouteDescByTimeComperator> toSolve;
197  std::map<ROEdge*, std::vector<ROEdge*> > dets2Follow;
198  dets2Follow[edge] = std::vector<ROEdge*>();
199  base.passedNo = 0;
200  SUMOReal 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] = std::vector<ROEdge*>();
209  }
210  for (std::vector<ROEdge*>::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  SUMOReal cdist = current.edges2Pass[0]->getFromNode()->getPosition().distanceTo(current.edges2Pass.back()->getToNode()->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  SUMOReal cdist = current.edges2Pass[0]->getFromNode()->getPosition().distanceTo(current.edges2Pass.back()->getToNode()->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->getSpeed() < 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  SUMOReal cdist = current.edges2Pass[0]->getFromNode()->getPosition().distanceTo(current.edges2Pass.back()->getToNode()->getPosition());
288  if (minDist < cdist) {
289  into.addRouteDesc(current);
290  }
291  continue;
292  }
293  }
294  // ... else: loop over the next edges
295  const std::vector<ROEdge*>& appr = myApproachedEdges.find(last)->second;
296  bool hadOne = false;
297  for (size_t i = 0; i < 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]->getSpeed());
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 = (SUMOReal) 1. / (SUMOReal) appr.size();
312  SUMOReal cdist = current.edges2Pass[0]->getFromNode()->getPosition().distanceTo(current.edges2Pass.back()->getToNode()->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  std::vector<const ROEdge*> 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  std::vector<ROEdge*> 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->getSpeed());
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  std::vector<ROEdge*> 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  SUMOReal duration = mrd.duration_2;
388  SUMOReal distance = mrd.distance;
389  // go through each route's edges
390  std::vector<ROEdge*>::const_iterator routeend = mrd.edges2Pass.end();
391  for (std::vector<ROEdge*>::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)->getSpeed();
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)->getSpeed();
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  std::vector<ROEdge*> 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  std::vector<ROEdge*> approaching = myApproachingEdges[last.edge];
458  for (std::vector<ROEdge*>::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  std::vector<ROEdge*> latter;
478  {
479  std::vector<IterationEdge> missing;
480  for (std::vector<ROEdge*>::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  std::vector<ROEdge*> approached = myApproachedEdges[last.edge];
491  for (std::vector<ROEdge*>::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 (std::vector<ROEdge*>::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 /= (SUMOReal) previous.size();
540  inFlow.vPKW /= (SUMOReal) 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 (std::vector<ROEdge*>::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 /= (SUMOReal) latter.size();
561  outFlow.vPKW /= (SUMOReal) 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) / (SUMOReal) 2.;
567  mFlow.vPKW = (inFlow.vPKW + outFlow.vPKW) / (SUMOReal) 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 SUMOReal
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  std::vector<ROEdge*> 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  std::vector<ROEdge*> 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  std::vector<ROEdge*> seen;
701  return isDestination(det, getDetectorEdge(det), seen, detectors);
702 }
703 
704 
705 bool
707  std::vector<ROEdge*>& 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->getSpeed() >= 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 std::vector<ROEdge*>& appr = myApproachingEdges.find(edge)->second;
750  size_t noOk = 0;
751  size_t noFalse = 0;
752  size_t noSkipped = 0;
753  for (size_t i = 0; i < appr.size(); i++) {
754  if (!hasDetector(appr[i])) {
755  noOk++;
756  } else {
757  noFalse++;
758  }
759  }
760  if ((noFalse + noSkipped) == appr.size()) {
761  return false;
762  }
763  }
764  }
765  }
766 
767  if (myAmInHighwayMode) {
768  if (edge->getSpeed() < 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 std::vector<ROEdge*>& appr = myApproachingEdges.find(edge)->second;
784  size_t noOk = 0;
785  size_t noFalse = 0;
786  size_t noSkipped = 0;
787  seen.push_back(edge);
788  for (size_t i = 0; i < 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  noOk++;
793  } else {
794  noFalse++;
795  }
796  } else {
797  noSkipped++;
798  }
799  }
800  if (!strict) {
801  return (noFalse + noSkipped) != appr.size();
802  } else {
803  return (noOk + noSkipped) == appr.size();
804  }
805 }
806 
807 
808 bool
809 RODFNet::isDestination(const RODFDetector& det, ROEdge* edge, std::vector<ROEdge*>& seen,
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->getSpeed() >= 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->getSpeed() < 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 std::vector<ROEdge*>& appr = myApproachedEdges.find(edge)->second;
869  bool isall = true;
870  size_t no = 0;
871  seen.push_back(edge);
872  for (size_t i = 0; i < 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
885 RODFNet::isFalseSource(const RODFDetector& det, ROEdge* edge, std::vector<ROEdge*>& seen,
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->getSpeed() < 19.) {
909  return false;
910  }
911  }
912  }
913 
914  if (myApproachedEdges.find(edge) == myApproachedEdges.end()) {
915  return false;
916  }
917 
918  const std::vector<ROEdge*>& appr = myApproachedEdges.find(edge)->second;
919  bool isall = false;
920  for (size_t i = 0; i < 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  for (i = myDetectorsOnEdges.begin(); i != myDetectorsOnEdges.end(); ++i) {
940  ROEdge* into = (*i).first;
941  const std::vector<std::string>& dets = (*i).second;
942  std::map<SUMOReal, std::vector<std::string> > cliques;
943  std::vector<std::string>* maxClique = 0;
944  for (std::vector<std::string>::const_iterator j = dets.begin(); j != dets.end(); ++j) {
945  if (!flows.knows(*j)) {
946  continue;
947  }
948  const RODFDetector& det = detectors.getDetector(*j);
949  bool found = false;
950  for (std::map<SUMOReal, std::vector<std::string> >::iterator k = cliques.begin(); !found && k != cliques.end(); ++k) {
951  if (fabs((*k).first - det.getPos()) < 1) {
952  (*k).second.push_back(*j);
953  if ((*k).second.size() > maxClique->size()) {
954  maxClique = &(*k).second;
955  }
956  found = true;
957  }
958  }
959  if (!found) {
960  cliques[det.getPos()].push_back(*j);
961  maxClique = &cliques[det.getPos()];
962  }
963  }
964  if (maxClique == 0) {
965  continue;
966  }
967  std::vector<FlowDef> mflows; // !!! reserve
968  for (SUMOTime t = startTime; t < endTime; t += stepOffset) {
969  FlowDef fd;
970  fd.qPKW = 0;
971  fd.qLKW = 0;
972  fd.vLKW = 0;
973  fd.vPKW = 0;
974  fd.fLKW = 0;
975  fd.isLKW = 0;
976  mflows.push_back(fd);
977  }
978  for (std::vector<std::string>::iterator l = maxClique->begin(); l != maxClique->end(); ++l) {
979  bool didWarn = false;
980  const std::vector<FlowDef>& dflows = flows.getFlowDefs(*l);
981  int index = 0;
982  for (SUMOTime t = startTime; t < endTime; t += stepOffset, index++) {
983  const FlowDef& srcFD = dflows[index];
984  FlowDef& fd = mflows[index];
985  fd.qPKW += srcFD.qPKW;
986  fd.qLKW += srcFD.qLKW;
987  fd.vLKW += (srcFD.vLKW / (SUMOReal) maxClique->size());
988  fd.vPKW += (srcFD.vPKW / (SUMOReal) maxClique->size());
989  fd.fLKW += (srcFD.fLKW / (SUMOReal) maxClique->size());
990  fd.isLKW += (srcFD.isLKW / (SUMOReal) maxClique->size());
991  if (!didWarn && srcFD.vPKW > 0 && srcFD.vPKW < 255 && srcFD.vPKW / 3.6 > into->getSpeed()) {
992  WRITE_MESSAGE("Detected PKW speed higher than allowed speed at '" + (*l) + "' on '" + into->getID() + "'.");
993  didWarn = true;
994  }
995  if (!didWarn && srcFD.vLKW > 0 && srcFD.vLKW < 255 && srcFD.vLKW / 3.6 > into->getSpeed()) {
996  WRITE_MESSAGE("Detected LKW speed higher than allowed speed at '" + (*l) + "' on '" + into->getID() + "'.");
997  didWarn = true;
998  }
999  }
1000  }
1001  static_cast<RODFEdge*>(into)->setFlows(mflows);
1002  }
1003 }
1004 
1005 
1006 void
1008  // !!! this will not work when several detectors are lying on the same edge on different positions
1009 
1010 
1011  buildDetectorEdgeDependencies(detectors);
1012  // for each detector, compute the lists of predecessor and following detectors
1013  std::map<std::string, ROEdge*>::const_iterator i;
1014  for (i = myDetectorEdges.begin(); i != myDetectorEdges.end(); ++i) {
1015  const RODFDetector& det = detectors.getDetector((*i).first);
1016  if (!det.hasRoutes()) {
1017  continue;
1018  }
1019  // mark current detectors
1020  std::vector<RODFDetector*> last;
1021  {
1022  const std::vector<std::string>& detNames = myDetectorsOnEdges.find((*i).second)->second;
1023  for (std::vector<std::string>::const_iterator j = detNames.begin(); j != detNames.end(); ++j) {
1024  last.push_back(&detectors.getModifiableDetector(*j));
1025  }
1026  }
1027  // iterate over the current detector's routes
1028  const std::vector<RODFRouteDesc>& routes = det.getRouteVector();
1029  for (std::vector<RODFRouteDesc>::const_iterator j = routes.begin(); j != routes.end(); ++j) {
1030  const std::vector<ROEdge*>& edges2Pass = (*j).edges2Pass;
1031  for (std::vector<ROEdge*>::const_iterator k = edges2Pass.begin() + 1; k != edges2Pass.end(); ++k) {
1032  if (myDetectorsOnEdges.find(*k) != myDetectorsOnEdges.end()) {
1033  const std::vector<std::string>& detNames = myDetectorsOnEdges.find(*k)->second;
1034  // ok, consecutive detector found
1035  for (std::vector<RODFDetector*>::iterator l = last.begin(); l != last.end(); ++l) {
1036  // mark as follower of current
1037  for (std::vector<std::string>::const_iterator m = detNames.begin(); m != detNames.end(); ++m) {
1038  detectors.getModifiableDetector(*m).addPriorDetector(*l);
1039  (*l)->addFollowingDetector(&detectors.getDetector(*m));
1040  }
1041  }
1042  last.clear();
1043  for (std::vector<std::string>::const_iterator m = detNames.begin(); m != detNames.end(); ++m) {
1044  last.push_back(&detectors.getModifiableDetector(*m));
1045  }
1046  }
1047  }
1048  }
1049  }
1050 }
1051 
1052 
1053 void
1055  buildDetectorEdgeDependencies(detectors);
1056  std::map<ROEdge*, std::vector<std::string>, idComp>::iterator i;
1057  for (i = myDetectorsOnEdges.begin(); i != myDetectorsOnEdges.end(); ++i) {
1058  const std::vector<std::string>& dets = (*i).second;
1059  std::map<SUMOReal, std::vector<std::string> > cliques;
1060  // compute detector cliques
1061  for (std::vector<std::string>::const_iterator j = dets.begin(); j != dets.end(); ++j) {
1062  const RODFDetector& det = detectors.getDetector(*j);
1063  bool found = false;
1064  for (std::map<SUMOReal, std::vector<std::string> >::iterator k = cliques.begin(); !found && k != cliques.end(); ++k) {
1065  if (fabs((*k).first - det.getPos()) < 10.) {
1066  (*k).second.push_back(*j);
1067  found = true;
1068  }
1069  }
1070  if (!found) {
1071  cliques[det.getPos()] = std::vector<std::string>();
1072  cliques[det.getPos()].push_back(*j);
1073  }
1074  }
1075  // join detector cliques
1076  for (std::map<SUMOReal, std::vector<std::string> >::iterator m = cliques.begin(); m != cliques.end(); ++m) {
1077  std::vector<std::string> clique = (*m).second;
1078  // do not join if only one
1079  if (clique.size() == 1) {
1080  continue;
1081  }
1082  std::string nid;
1083  for (std::vector<std::string>::iterator n = clique.begin(); n != clique.end(); ++n) {
1084  std::cout << *n << " ";
1085  if (n != clique.begin()) {
1086  nid = nid + "_";
1087  }
1088  nid = nid + *n;
1089  }
1090  std::cout << ":" << nid << std::endl;
1091  flows.mesoJoin(nid, (*m).second);
1092  detectors.mesoJoin(nid, (*m).second);
1093  }
1094  }
1095 }
1096 
1097 
1098 
1099 /****************************************************************************/
1100 
void mesoJoin(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
Definition: RODFNet.cpp:1054
void revalidateFlows(const RODFDetectorCon &detectors, RODFDetectorFlows &flows, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
Definition: RODFNet.cpp:576
RODFDetector & getModifiableDetector(const std::string &id) const
SUMOReal factor
Definition: RODFRouteDesc.h:67
std::vector< std::string > myDisallowedEdges
List of ids of edges that shall not be used.
Definition: RODFNet.h:173
~RODFNet()
Destructor.
Definition: RODFNet.cpp:64
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) ...
RONode * getToNode() const
Returns the node this edge ends at.
Definition: ROEdge.h:219
std::map< ROEdge *, std::vector< ROEdge * > > myApproachingEdges
Map of edge name->list of names of this edge approaching edges.
Definition: RODFNet.h:161
bool hasInBetweenDetectorsOnly(ROEdge *edge, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:154
ROEdge * getFollower(unsigned int pos) const
Returns the edge at the given position from the list of reachable edges.
Definition: ROEdge.h:292
size_t mySourceNumber
Definition: RODFNet.h:170
ROEdge * getDetectorEdge(const RODFDetector &det) const
Definition: RODFNet.cpp:631
bool isFalseSource(const RODFDetector &det, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:692
void removeDetector(const std::string &id)
std::vector< ROEdge * > edges2Pass
The edges the route is made of.
Definition: RODFRouteDesc.h:55
A source detector.
Definition: RODFDetector.h:76
bool isSource(const RODFDetector &det, const RODFDetectorCon &detectors, bool strict) const
Definition: RODFNet.cpp:684
bool myKeepTurnarounds
Definition: RODFNet.h:176
ROEdge * getEdge(const std::string &name) const
Retrieves an edge from the network.
Definition: RONet.h:102
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
SUMOReal distance
Definition: RODFRouteDesc.h:59
const std::vector< FlowDef > & getFlows() const
Definition: RODFEdge.cpp:60
void removeFlow(const std::string &detector_id)
void reportEmptyDetectors(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
Definition: RODFNet.cpp:613
const std::vector< RODFRouteDesc > & getRouteVector() const
void computeTypes(RODFDetectorCon &dets, bool sourcesStrict) const
Definition: RODFNet.cpp:114
void addPriorDetector(const RODFDetector *det)
const std::vector< RODFDetector * > & getDetectors() const
SUMOReal getFloat(const std::string &name) const
Returns the SUMOReal-value of the named option (only for Option_Float)
SUMOReal distance2Last
Definition: RODFRouteDesc.h:63
SUMOReal isLKW
bool hasSourceDetector(ROEdge *edge, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:170
void computeRoutesFor(ROEdge *edge, RODFRouteDesc &base, int no, bool keepUnfoundEnds, bool keepShortestOnly, std::vector< ROEdge * > &visited, const RODFDetector &det, RODFRouteCont &into, const RODFDetectorCon &detectors, int maxFollowingLength, std::vector< ROEdge * > &seen) const
Definition: RODFNet.cpp:187
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
bool hasDetector(ROEdge *edge) const
Definition: RODFNet.cpp:661
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:200
SUMOReal getAbsPos(const RODFDetector &det) const
Definition: RODFNet.cpp:676
const std::map< std::string, ROEdge * > & getEdgeMap() const
Definition: RONet.cpp:407
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:67
RONode * getFromNode() const
Returns the node this edge starts at.
Definition: ROEdge.h:211
void buildRoutes(RODFDetectorCon &det, bool keepUnfoundEnds, bool includeInBetween, bool keepShortestOnly, int maxFollowingLength) const
Definition: RODFNet.cpp:346
RODFDetectorType getType() const
Returns the type of the detector.
Definition: RODFDetector.h:150
comparator for maps using edges as key, used only in myDetectorsOnEdges to make tests comparable ...
Definition: RODFNet.h:154
A not yet defined detector.
Definition: RODFDetector.h:67
bool isDestination(const RODFDetector &det, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:699
const std::string & getID() const
Returns the id.
Definition: Named.h:60
size_t myInvalidNumber
Definition: RODFNet.h:170
SUMOReal fLKW
bool removeRouteDesc(RODFRouteDesc &desc)
Removes the given route description from the container.
An in-between detector.
Definition: RODFDetector.h:73
bool hasApproaching(ROEdge *edge) const
Definition: RODFNet.cpp:643
RODFNet(bool amInHighwayMode)
Constructor.
Definition: RODFNet.cpp:56
A detector which had to be discarded (!!!)
Definition: RODFDetector.h:70
SUMOReal overallProb
Definition: RODFRouteDesc.h:66
#define PROGRESS_BEGIN_MESSAGE(msg)
Definition: MsgHandler.h:202
void setFlows(const std::string &detector_id, std::vector< FlowDef > &)
const std::vector< std::string > & getDetectorList(ROEdge *edge) const
Definition: RODFNet.cpp:670
void buildDetectorEdgeDependencies(RODFDetectorCon &dets) const
Definition: RODFNet.cpp:101
void buildApproachList()
Definition: RODFNet.cpp:69
bool knows(const std::string &det_id) const
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:53
Definition of the traffic during a certain time containing the flows and speeds.
A route within the DFROUTER.
Definition: RODFRouteDesc.h:53
A basic edge for routing applications.
Definition: ROEdge.h:69
unsigned int getNoFollowing() const
Returns the number of edges this edge is connected to.
Definition: ROEdge.cpp:285
SUMOReal vPKW
SUMOTime duration2Last
Definition: RODFRouteDesc.h:64
The router's network representation.
Definition: RONet.h:67
SUMOReal getLength() const
Returns the length of the edge.
Definition: ROEdge.h:180
void buildEdgeFlowMap(const RODFDetectorFlows &flows, const RODFDetectorCon &detectors, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
Definition: RODFNet.cpp:934
const RODFDetector & getDetector(const std::string &id) const
void buildDetectorDependencies(RODFDetectorCon &detectors)
Definition: RODFNet.cpp:1007
Class representing a detector within the DFROUTER.
Definition: RODFDetector.h:88
size_t mySinkNumber
Definition: RODFNet.h:170
const ROEdge * endDetectorEdge
Definition: RODFRouteDesc.h:61
std::map< std::string, ROEdge * > myDetectorEdges
Definition: RODFNet.h:167
SUMOReal duration_2
Definition: RODFRouteDesc.h:58
bool hasApproached(ROEdge *edge) const
Definition: RODFNet.cpp:652
A container for DFROUTER-routes.
Definition: RODFRouteCont.h:63
int SUMOTime
Definition: SUMOTime.h:43
SUMOReal qPKW
SUMOReal getPos() const
Returns the position at which the detector lies.
Definition: RODFDetector.h:141
const std::vector< FlowDef > & getFlowDefs(const std::string &id) const
std::map< ROEdge *, std::vector< std::string >, idComp > myDetectorsOnEdges
Definition: RODFNet.h:166
#define SUMOReal
Definition: config.h:215
void mesoJoin(const std::string &nid, const std::vector< std::string > &oldids)
bool myAmInHighwayMode
Definition: RODFNet.h:169
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:62
void addRouteDesc(RODFRouteDesc &desc)
Adds a route to the container.
SUMOReal vLKW
SUMOReal qLKW
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:201
std::map< ROEdge *, std::vector< ROEdge * > > myApproachedEdges
Map of edge name->list of names of edges approached by this edge.
Definition: RODFNet.h:164
SUMOReal getSpeed() const
Returns the speed allowed on this edge.
Definition: ROEdge.h:195
size_t myInBetweenNumber
Definition: RODFNet.h:170
bool hasRoutes() const
const std::string & getLaneID() const
Returns the id of the lane this detector is placed on.
Definition: RODFDetector.h:125