SUMO - Simulation of Urban MObility
IntermodalRouter.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-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 /****************************************************************************/
18 // The IntermodalRouter builds a special network and (delegates to a SUMOAbstractRouter)
19 /****************************************************************************/
20 #ifndef IntermodalRouter_h
21 #define IntermodalRouter_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include <string>
34 #include <vector>
35 #include <algorithm>
36 #include <assert.h>
38 #include <utils/common/SUMOTime.h>
39 #include <utils/common/ToString.h>
41 #include "SUMOAbstractRouter.h"
42 #include "SUMOVehicleParameter.h"
43 #include "DijkstraRouter.h"
44 #include "IntermodalNetwork.h"
45 #include "CarEdge.h"
46 #include "PedestrianRouter.h"
47 
48 //#define IntermodalRouter_DEBUG_ROUTES
49 
50 
51 // ===========================================================================
52 // class definitions
53 // ===========================================================================
58 template<class E, class L, class N, class V, class INTERNALROUTER = DijkstraRouter<IntermodalEdge<E, L, N, V>, IntermodalTrip<E, N, V>, prohibited_withPermissions<IntermodalEdge<E, L, N, V>, IntermodalTrip<E, N, V> > > >
59 class IntermodalRouter : public SUMOAbstractRouter<E, IntermodalTrip<E, N, V> > {
60 private:
67 
68 public:
69  struct TripItem {
70  TripItem(const std::string& _line = "") : line(_line), cost(0.) {}
71  std::string line;
72  std::string destStop;
73  std::vector<const E*> edges;
74  double cost;
75  };
76 
83  PT_STOPS = 2,
86  };
87 
89  IntermodalRouter(CreateNetCallback callback, int carWalkTransfer) :
90  SUMOAbstractRouter<E, _IntermodalTrip>(0, "IntermodalRouter"),
92  myCallback(callback), myCarWalkTransfer(carWalkTransfer) {
93  }
94 
96  virtual ~IntermodalRouter() {
97  delete myInternalRouter;
98  if (!myAmClone) {
99  delete myIntermodalNet;
100  }
101  }
102 
104  createNet();
106  }
107 
108  bool hasNet() const {
109  return myIntermodalNet != 0;
110  }
111 
125  void addAccess(const std::string& stopId, const E* stopEdge, const double pos, const SumoXMLTag category) {
126  assert(stopEdge != 0);
127  if (myStopConnections.count(stopId) == 0) {
128  myStopConnections[stopId] = new StopEdge<E, L, N, V>(stopId, myNumericalID++, stopEdge);
130  }
131  _IntermodalEdge* const stopConn = myStopConnections[stopId];
132  const L* lane = getSidewalk<E, L>(stopEdge);
133  if (lane != 0) {
134  const std::pair<_IntermodalEdge*, _IntermodalEdge*>& pair = myIntermodalNet->getBothDirections(stopEdge);
135  _IntermodalEdge* const fwdSplit = new PedestrianEdge<E, L, N, V>(myNumericalID++, stopEdge, lane, true, pos);
136  const int splitIndex = splitEdge(pair.first, fwdSplit, pos, stopConn);
137  _IntermodalEdge* const backSplit = new PedestrianEdge<E, L, N, V>(myNumericalID++, stopEdge, lane, false, pos);
138  splitEdge(pair.second, backSplit, stopEdge->getLength() - pos, stopConn, false);
139  _IntermodalEdge* carSplit = nullptr;
140  if (myCarLookup.count(stopEdge) > 0) {
141  carSplit = new CarEdge<E, L, N, V>(myNumericalID++, stopEdge, pos);
142  splitEdge(myCarLookup[stopEdge], carSplit, pos, stopConn, true, false);
143  }
144  if (splitIndex >= 0) {
145  if (carSplit != nullptr && ((category == SUMO_TAG_PARKING_AREA && (myCarWalkTransfer & PARKING_AREAS) != 0) || (category == SUMO_TAG_BUS_STOP && (myCarWalkTransfer & PT_STOPS) != 0))) {
146  _IntermodalEdge* const beforeSplit = myAccessSplits[myCarLookup[stopEdge]][splitIndex - 1];
147  for (_IntermodalEdge* conn : {
148  fwdSplit, backSplit
149  }) {
150  _AccessEdge* access = new _AccessEdge(myNumericalID++, beforeSplit, conn);
151  myIntermodalNet->addEdge(access);
152  beforeSplit->addSuccessor(access);
153  access->addSuccessor(conn);
154  }
155  }
156 
157  _IntermodalEdge* const prevDep = myIntermodalNet->getDepartConnector(stopEdge, splitIndex - 1);
158  const std::vector<_IntermodalEdge*>& backSplitList = myAccessSplits[pair.second];
159  _IntermodalEdge* const backBeforeSplit = backSplitList[backSplitList.size() - 1 - splitIndex];
160  // depart and arrival edges (the router can decide the initial direction to take and the direction to arrive from)
161  _IntermodalEdge* const depConn = new _IntermodalEdge(stopEdge->getID() + "_depart_connector" + toString(pos), myNumericalID++, stopEdge, "!connector");
162  depConn->addSuccessor(fwdSplit);
163  depConn->addSuccessor(backBeforeSplit);
164  depConn->setLength(fwdSplit->getLength());
165  prevDep->removeSuccessor(backBeforeSplit);
166  prevDep->addSuccessor(backSplit);
167  prevDep->setLength(backSplit->getLength());
168  if (carSplit != nullptr) {
169  depConn->addSuccessor(carSplit);
170  }
171 
172  _IntermodalEdge* const prevArr = myIntermodalNet->getArrivalConnector(stopEdge, splitIndex - 1);
173  _IntermodalEdge* const fwdBeforeSplit = myAccessSplits[pair.first][splitIndex - 1];
174  _IntermodalEdge* const arrConn = new _IntermodalEdge(stopEdge->getID() + "_arrival_connector" + toString(pos), myNumericalID++, stopEdge, "!connector");
175  fwdSplit->addSuccessor(arrConn);
176  backBeforeSplit->addSuccessor(arrConn);
177  arrConn->setLength(fwdSplit->getLength());
178  fwdSplit->removeSuccessor(prevArr);
179  fwdBeforeSplit->addSuccessor(prevArr);
180  prevArr->setLength(backSplit->getLength());
181  if (carSplit != nullptr) {
182  carSplit->addSuccessor(arrConn);
183  carSplit->removeSuccessor(prevArr);
184  myAccessSplits[myCarLookup[stopEdge]][splitIndex - 1]->addSuccessor(prevArr);
185  }
186  myIntermodalNet->addConnectors(depConn, arrConn, splitIndex);
187  } else {
188  delete fwdSplit;
189  delete backSplit;
190  delete carSplit;
191  }
192  }
193  }
194 
195  void addSchedule(const SUMOVehicleParameter& pars, const std::vector<SUMOVehicleParameter::Stop>* addStops = 0) {
196  SUMOTime lastUntil = 0;
197  std::vector<SUMOVehicleParameter::Stop> validStops;
198  if (addStops != 0) {
199  // stops are part of a stand-alone route. until times are offsets from vehicle departure
200  for (std::vector<SUMOVehicleParameter::Stop>::const_iterator s = addStops->begin(); s != addStops->end(); ++s) {
201  if (myStopConnections.count(s->busstop) > 0) {
202  // compute stop times for the first vehicle
203  SUMOVehicleParameter::Stop stop = *s;
204  stop.until += pars.depart;
205  if (stop.until >= lastUntil) {
206  validStops.push_back(stop);
207  lastUntil = stop.until;
208  } else {
209  WRITE_WARNING("Ignoring unordered stop at '" + stop.busstop + "' at " + time2string(stop.until) + " for vehicle '" + pars.id + "'.");
210  }
211  }
212  }
213  }
214  for (std::vector<SUMOVehicleParameter::Stop>::const_iterator s = pars.stops.begin(); s != pars.stops.end(); ++s) {
215  // stops are part of the vehicle until times are absolute times for the first vehicle
216  if (myStopConnections.count(s->busstop) > 0 && s->until >= lastUntil) {
217  validStops.push_back(*s);
218  lastUntil = s->until;
219  }
220  }
221  if (validStops.size() < 2) {
222  WRITE_WARNING("Ignoring public transport line '" + pars.line + "' with less than two usable stops.");
223  return;
224  }
225 
226  typename std::vector<_PTEdge*>& lineEdges = myPTLines[pars.line];
227  if (lineEdges.empty()) {
228  _IntermodalEdge* lastStop = 0;
229  SUMOTime lastTime = 0;
230  for (std::vector<SUMOVehicleParameter::Stop>::const_iterator s = validStops.begin(); s != validStops.end(); ++s) {
231  _IntermodalEdge* currStop = myStopConnections[s->busstop];
232  if (lastStop != 0) {
233  _PTEdge* const newEdge = new _PTEdge(s->busstop, myNumericalID++, lastStop, currStop->getEdge(), pars.line);
234  myIntermodalNet->addEdge(newEdge);
235  newEdge->addSchedule(lastTime, lastTime + pars.repetitionOffset * (pars.repetitionNumber - 1), pars.repetitionOffset, STEPS2TIME(s->until - lastTime));
236  lastStop->addSuccessor(newEdge);
237  newEdge->addSuccessor(currStop);
238  lineEdges.push_back(newEdge);
239  }
240  lastTime = s->until;
241  lastStop = currStop;
242  }
243  } else {
244  if (validStops.size() != lineEdges.size() + 1) {
245  WRITE_WARNING("Number of stops for public transport line '" + pars.line + "' does not match earlier definitions, ignoring schedule.");
246  return;
247  }
248  if (lineEdges.front()->getEntryStop() != myStopConnections[validStops.front().busstop]) {
249  WRITE_WARNING("Different stop for '" + pars.line + "' compared to earlier definitions, ignoring schedule.");
250  return;
251  }
252  typename std::vector<_PTEdge*>::const_iterator lineEdge = lineEdges.begin();
253  typename std::vector<SUMOVehicleParameter::Stop>::const_iterator s = validStops.begin() + 1;
254  for (; s != validStops.end(); ++s, ++lineEdge) {
255  if ((*lineEdge)->getSuccessors(SVC_IGNORING)[0] != myStopConnections[s->busstop]) {
256  WRITE_WARNING("Different stop for '" + pars.line + "' compared to earlier definitions, ignoring schedule.");
257  return;
258  }
259  }
260  SUMOTime lastTime = validStops.front().until;
261  for (lineEdge = lineEdges.begin(), s = validStops.begin() + 1; lineEdge != lineEdges.end(); ++lineEdge, ++s) {
262  (*lineEdge)->addSchedule(lastTime, lastTime + pars.repetitionOffset * (pars.repetitionNumber - 1), pars.repetitionOffset, STEPS2TIME(s->until - lastTime));
263  lastTime = s->until;
264  }
265  }
266  }
267 
270  bool compute(const E* from, const E* to, double departPos, double arrivalPos, double speed,
271  const V* const vehicle, const SVCPermissions modeSet, SUMOTime msTime,
272  std::vector<TripItem>& into) {
273  createNet();
274  _IntermodalTrip trip(from, to, departPos, arrivalPos, speed, msTime, 0, vehicle, modeSet);
275  std::vector<const _IntermodalEdge*> intoEdges;
276  const bool success = myInternalRouter->compute(myIntermodalNet->getDepartEdge(from, trip.departPos),
278  &trip, msTime, intoEdges);
279  if (success) {
280  std::string lastLine = "";
281  double time = STEPS2TIME(msTime);
282  for (const _IntermodalEdge* iEdge : intoEdges) {
283  if (iEdge->includeInRoute(false)) {
284  if (iEdge->getLine() == "!stop") {
285  into.back().destStop = iEdge->getID();
286  if (lastLine == "!ped") {
287  lastLine = ""; // a stop always starts a new trip item
288  }
289  } else {
290  if (iEdge->getLine() != lastLine) {
291  lastLine = iEdge->getLine();
292  if (lastLine == "!car") {
293  into.push_back(TripItem(vehicle->getID()));
294  } else if (lastLine == "!ped") {
295  into.push_back(TripItem());
296  } else {
297  into.push_back(TripItem(lastLine));
298  }
299  }
300  if (into.back().edges.empty() || into.back().edges.back() != iEdge->getEdge()) {
301  into.back().edges.push_back(iEdge->getEdge());
302  }
303  }
304  }
305  const double edgeEffort = myInternalRouter->getEffort(iEdge, &trip, time);
306  time += edgeEffort;
307  if (!into.empty()) {
308  into.back().cost += edgeEffort;
309  }
310  }
311  }
312 #ifdef IntermodalRouter_DEBUG_ROUTES
313  double time = STEPS2TIME(msTime);
314  for (const _IntermodalEdge* iEdge : intoEdges) {
315  const double edgeEffort = myInternalRouter->getEffort(iEdge, &trip, time);
316  time += edgeEffort;
317  std::cout << iEdge->getID() << "(" << iEdge->getLine() << "): " << edgeEffort << std::endl;
318  }
319  std::cout << TIME2STEPS(msTime) << " trip from " << from->getID() << " to " << to->getID()
320  << " departPos=" << trip.departPos
321  << " arrivalPos=" << trip.arrivalPos
322  << " edges=" << toString(intoEdges)
323 // << " resultEdges=" << toString(into)
324  << " time=" << time
325  << "\n";
326 #endif
327  return success;
328  }
329 
332  bool compute(const E*, const E*, const _IntermodalTrip* const,
333  SUMOTime, std::vector<const E*>&) {
334  throw ProcessError("Do not use this method");
335  }
336 
337  double recomputeCosts(const std::vector<const E*>&, const _IntermodalTrip* const, SUMOTime) const {
338  throw ProcessError("Do not use this method");
339  }
340 
341  void prohibit(const std::vector<E*>& toProhibit) {
342  createNet();
343  std::vector<_IntermodalEdge*> toProhibitPE;
344  for (typename std::vector<E*>::const_iterator it = toProhibit.begin(); it != toProhibit.end(); ++it) {
345  toProhibitPE.push_back(myIntermodalNet->getBothDirections(*it).first);
346  toProhibitPE.push_back(myIntermodalNet->getBothDirections(*it).second);
347  toProhibitPE.push_back(getCarEdge(*it));
348  }
349  myInternalRouter->prohibit(toProhibitPE);
350  }
351 
353  createNet();
354  for (_IntermodalEdge* e : myIntermodalNet->getAllEdges()) {
355  dev.openTag(SUMO_TAG_EDGE);
356  dev.writeAttr(SUMO_ATTR_ID, e->getID());
357  dev.writeAttr(SUMO_ATTR_LENGTH, e->getLength());
358  std::string succStr;
359  for (_IntermodalEdge* suc : e->getSuccessors(SVC_IGNORING)) {
360  succStr += suc->getID() + " ";
361  }
362  dev.writeAttr("successors", succStr);
363  dev.closeTag();
364  }
365  }
366 
368  createNet();
369  for (_IntermodalEdge* e : myIntermodalNet->getAllEdges()) {
370  dev.openTag(SUMO_TAG_EDGE);
371  dev.writeAttr(SUMO_ATTR_ID, e->getID());
372  dev.writeAttr("traveltime", 0. /* e->getTravelTime() */);
373  dev.writeAttr("effort", 0. /* e->getEffort() */);
374  dev.closeTag();
375  }
376  }
377 
378 private:
379  IntermodalRouter(_IntermodalNetwork* net):
380  SUMOAbstractRouter<E, _IntermodalTrip>(0, "PedestrianRouter"), myAmClone(true),
381  myInternalRouter(new INTERNALROUTER(net->getAllEdges(), true, &_IntermodalEdge::getTravelTimeStatic)),
382  myIntermodalNet(net), myNumericalID((int)net->getAllEdges().size()), myCarWalkTransfer(0) {}
383 
397  int splitEdge(_IntermodalEdge* const toSplit, _IntermodalEdge* afterSplit, const double pos,
398  _IntermodalEdge* const stopConn, const bool forward = true, const bool addExit = true) {
399  std::vector<_IntermodalEdge*>& splitList = myAccessSplits[toSplit];
400  if (splitList.empty()) {
401  splitList.push_back(toSplit);
402  }
403  double relPos = pos;
404  int splitIndex = 0;
405  for (const _IntermodalEdge* const split : splitList) {
406  if (relPos < split->getLength() + POSITION_EPS) {
407  break;
408  }
409  relPos -= split->getLength();
410  splitIndex++;
411  }
412  assert(splitIndex < (int)splitList.size());
413  _IntermodalEdge* beforeSplit = splitList[splitIndex];
414  if (splitIndex + 1 < (int)splitList.size() && fabs(relPos - beforeSplit->getLength()) < POSITION_EPS) {
415  // don't split, use the present split edges
416  afterSplit = splitList[splitIndex + 1];
417  splitIndex = -1;
418  } else {
419  myIntermodalNet->addEdge(afterSplit);
420  afterSplit->setSuccessors(beforeSplit->getSuccessors(SVC_IGNORING));
421  beforeSplit->clearSuccessors();
422  beforeSplit->addSuccessor(afterSplit);
423  afterSplit->setLength(beforeSplit->getLength() - relPos);
424  beforeSplit->setLength(relPos);
425  if (!forward) {
426  // rename backward edges for easier referencing
427  const std::string newID = beforeSplit->getID();
428  beforeSplit->setID(afterSplit->getID());
429  afterSplit->setID(newID);
430  }
431  splitIndex++;
432  splitList.insert(splitList.begin() + splitIndex, afterSplit);
433  }
434  // add access to / from edge
435  _AccessEdge* access = new _AccessEdge(myNumericalID++, beforeSplit, stopConn);
436  myIntermodalNet->addEdge(access);
437  beforeSplit->addSuccessor(access);
438  access->addSuccessor(stopConn);
439  if (addExit) {
440  // pedestrian case only, exit from public to pedestrian
441  _AccessEdge* exit = new _AccessEdge(myNumericalID++, stopConn, afterSplit);
442  myIntermodalNet->addEdge(exit);
443  stopConn->addSuccessor(exit);
444  exit->addSuccessor(afterSplit);
445  }
446  return splitIndex;
447  }
448 
449  void addCarEdges(const std::vector<E*>& edges) {
450  for (const E* const edge : edges) {
451  if (edge->getFunction() == EDGEFUNC_NORMAL) {
452  myCarLookup[edge] = new CarEdge<E, L, N, V>(myNumericalID++, edge);
454  }
455  }
456  for (const auto& edgePair : myCarLookup) {
457  _IntermodalEdge* const carEdge = edgePair.second;
458  for (const E* const suc : edgePair.first->getSuccessors()) {
459  _IntermodalEdge* const sucCarEdge = getCarEdge(suc);
460  if (sucCarEdge != nullptr) {
461  carEdge->addSuccessor(sucCarEdge);
462  }
463  }
464  if ((myCarWalkTransfer & ALL_JUNCTIONS) != 0) {
465  _IntermodalEdge* const walkCon = myIntermodalNet->getWalkingConnector(edgePair.first);
466  if (walkCon != 0) {
467  carEdge->addSuccessor(walkCon);
468  } else {
469  // we are on an edge where pedestrians are forbidden and want to continue on an arbitrary pedestrian edge
470  for (const E* const out : edgePair.first->getToJunction()->getOutgoing()) {
471  if (!out->isInternal() && !out->isTazConnector() && getSidewalk<E, L>(out) != 0) {
472  carEdge->addSuccessor(myIntermodalNet->getBothDirections(out).first);
473  }
474  }
475  for (const E* const in : edgePair.first->getToJunction()->getIncoming()) {
476  if (!in->isInternal() && !in->isTazConnector() && getSidewalk<E, L>(in) != 0) {
477  carEdge->addSuccessor(myIntermodalNet->getBothDirections(in).second);
478  }
479  }
480  }
481  }
482  myIntermodalNet->getDepartConnector(edgePair.first)->addSuccessor(carEdge);
483  carEdge->addSuccessor(myIntermodalNet->getArrivalConnector(edgePair.first));
484  }
485  }
486 
487  inline void createNet() {
488  if (myIntermodalNet == nullptr) {
489  myIntermodalNet = new _IntermodalNetwork(E::getAllEdges(), myNumericalID);
490  myNumericalID = (int)myIntermodalNet->getAllEdges().size();
491  addCarEdges(E::getAllEdges());
492  myCallback(*this);
494  }
495  }
496 
498  _IntermodalEdge* getCarEdge(const E* e) const {
499  typename std::map<const E*, _IntermodalEdge*>::const_iterator it = myCarLookup.find(e);
500  if (it == myCarLookup.end()) {
501  return 0;
502  }
503  return it->second;
504  }
505 
506 private:
507  const bool myAmClone;
508  INTERNALROUTER* myInternalRouter;
509  _IntermodalNetwork* myIntermodalNet;
512  const int myCarWalkTransfer;
513 
515  std::map<const E*, _IntermodalEdge*> myCarLookup;
516 
518  std::map<std::string, std::vector<_PTEdge*> > myPTLines;
519 
521  std::map<std::string, _IntermodalEdge*> myStopConnections;
522 
524  std::map<_IntermodalEdge*, std::vector<_IntermodalEdge*> > myAccessSplits;
525 
526 
527 private:
530 
531 };
532 
533 
534 
539 template<class E, class L, class N, class V>
541 public:
544  IntermodalRouter<E, L, N, V>* interRouter)
545  : myVehRouter(vehRouter), myPedRouter(pedRouter), myInterRouter(interRouter) {}
546 
548  : myVehRouter(original.getVehicleRouter().clone()),
549  myPedRouter(static_cast<PedestrianRouterDijkstra<E, L, N, V>*>(original.myPedRouter == 0 ? 0 : original.getPedestrianRouter().clone())),
550  myInterRouter(static_cast<IntermodalRouter<E, L, N, V>*>(original.myInterRouter == 0 ? 0 : original.getIntermodalRouter().clone())) {}
551 
553  return *myVehRouter;
554  }
555 
557  return *myPedRouter;
558  }
559 
561  return *myInterRouter;
562  }
563 
564  virtual ~RouterProvider() {
565  delete myVehRouter;
566  delete myPedRouter;
567  delete myInterRouter;
568  }
569 
570 
571 private:
575 
576 
577 private:
580 
581 };
582 
583 
584 #endif
585 
586 /****************************************************************************/
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:260
IntermodalRouter< E, L, N, V > & getIntermodalRouter() const
const EdgePair & getBothDirections(const E *e) const
Returns the pair of forward and backward edge.
ModeChangeOptions
where mode changes are possible
SumoXMLTag
Numbers representing SUMO-XML - element names.
IntermodalRouter & operator=(const IntermodalRouter &s)
Invalidated assignment operator.
_IntermodalEdge * getArrivalEdge(const E *e, const double pos) const
Returns the arriving intermodal edge.
std::map< const E *, _IntermodalEdge * > myCarLookup
retrieve the car edge for the given input edge E
bool hasNet() const
int repetitionNumber
The number of times the vehicle shall be repeatedly inserted.
_IntermodalEdge * getDepartConnector(const E *e, const int splitIndex=0) const
Returns the departing intermodal connector at the given split offset.
const std::vector< _IntermodalEdge * > & getAllEdges()
RouterProvider(const RouterProvider &original)
virtual ~RouterProvider()
SUMOAbstractRouter< E, V > *const myVehRouter
void addEdge(_IntermodalEdge *edge)
void(* CreateNetCallback)(IntermodalRouter< E, L, N, V, INTERNALROUTER > &)
static double getTravelTimeStatic(const IntermodalEdge *const edge, const IntermodalTrip< E, N, V > *const trip, double time)
AccessEdge< E, L, N, V > _AccessEdge
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
int splitEdge(_IntermodalEdge *const toSplit, _IntermodalEdge *afterSplit, const double pos, _IntermodalEdge *const stopConn, const bool forward=true, const bool addExit=true)
Splits an edge (if necessary) and connects it to a stopping edge.
void addSuccessor(IntermodalEdge *s)
_IntermodalNetwork * myIntermodalNet
std::string time2string(SUMOTime t)
Definition: SUMOTime.cpp:59
std::map< _IntermodalEdge *, std::vector< _IntermodalEdge * > > myAccessSplits
retrieve the splitted edges for the given "original"
the car edge type that is given to the internal router (SUMOAbstractRouter)
Definition: CarEdge.h:43
void writeNetwork(OutputDevice &dev)
const int myCarWalkTransfer
void addSchedule(const SUMOTime begin, const SUMOTime end, const SUMOTime period, const double travelTimeSec)
Definition: CarEdge.h:157
std::map< std::string, std::vector< _PTEdge * > > myPTLines
retrieve the public transport edges for the given line
SUMOTime until
The time at which the vehicle may continue its journey.
const std::string & getID() const
Returns the id.
Definition: Named.h:74
#define TIME2STEPS(x)
Definition: SUMOTime.h:66
void writeWeights(OutputDevice &dev)
TripItem(const std::string &_line="")
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:199
SUMOTime repetitionOffset
The time offset between vehicle reinsertions.
void removeSuccessor(const IntermodalEdge *const edge)
_IntermodalEdge * getCarEdge(const E *e) const
Returns the associated car edge.
std::vector< Stop > stops
List of the stops the vehicle will make, TraCI may add entries here.
const E * getEdge() const
_IntermodalEdge * getWalkingConnector(const E *e) const
Returns the outgoing pedestrian edge, which is either a walking area or a walking connector...
std::string busstop
(Optional) bus stop if one is assigned to the stop
PublicTransportEdge< E, L, N, V > _PTEdge
bool compute(const E *, const E *, const _IntermodalTrip *const, SUMOTime, std::vector< const E *> &)
Builds the route between the given edges using the minimum effort at the given time The definition of...
bool compute(const E *from, const E *to, double departPos, double arrivalPos, double speed, const V *const vehicle, const SVCPermissions modeSet, SUMOTime msTime, std::vector< TripItem > &into)
Builds the route between the given edges using the minimum effort at the given time The definition of...
CreateNetCallback myCallback
void addSchedule(const SUMOVehicleParameter &pars, const std::vector< SUMOVehicleParameter::Stop > *addStops=0)
void addAccess(const std::string &stopId, const E *stopEdge, const double pos, const SumoXMLTag category)
Adds access edges for stopping places to the intermodal network.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:55
IntermodalRouter(_IntermodalNetwork *net)
void setSuccessors(const std::vector< IntermodalEdge *> &edges)
IntermodalTrip< E, N, V > _IntermodalTrip
SUMOAbstractRouter< E, _IntermodalTrip > * clone()
_IntermodalEdge * getArrivalConnector(const E *e, const int splitIndex=0) const
Returns the arriving intermodal connector at the given split offset.
SUMOTime depart
The vehicle&#39;s departure time.
#define STEPS2TIME(x)
Definition: SUMOTime.h:64
the "vehicle" type that is given to the internal router (SUMOAbstractRouter)
PedestrianRouterDijkstra< E, L, N, V > & getPedestrianRouter() const
std::vector< std::string > & split(const std::string &s, char delim, std::vector< std::string > &elems)
#define POSITION_EPS
Definition: config.h:175
std::vector< const E * > edges
IntermodalRouter(CreateNetCallback callback, int carWalkTransfer)
Constructor.
PedestrianRouterDijkstra< E, L, N, V > *const myPedRouter
the intermodal network storing edges, connections and the mappings to the "real" edges ...
public transport stops and access
std::string line
The vehicle&#39;s line (mainly for public transport)
begin/end of the description of an edge
the base edge type that is given to the internal router (SUMOAbstractRouter)
INTERNALROUTER * myInternalRouter
std::map< std::string, _IntermodalEdge * > myStopConnections
retrieve the connecting edges for the given "bus" stop
SUMOAbstractRouter< E, V > & getVehicleRouter() const
_IntermodalEdge * getDepartEdge(const E *e, const double pos) const
Returns the departing intermodal edge.
IntermodalNetwork< E, L, N, V > _IntermodalNetwork
void setID(const std::string &newID)
resets the id
Definition: Named.h:82
const double arrivalPos
Structure representing possible vehicle parameter.
IntermodalEdge< E, L, N, V > _IntermodalEdge
const double departPos
virtual ~IntermodalRouter()
Destructor.
Definition of vehicle stop (position and duration)
the public transport edge type connecting the stop edges
Definition: CarEdge.h:131
void prohibit(const std::vector< E *> &toProhibit)
IntermodalRouter< E, L, N, V > *const myInterRouter
double getLength() const
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:70
bool closeTag()
Closes the most recently opened tag.
double recomputeCosts(const std::vector< const E *> &, const _IntermodalTrip *const, SUMOTime) const
the pedestrian edge type that is given to the internal router (SUMOAbstractRouter) ...
long long int SUMOTime
Definition: TraCIDefs.h:51
RouterProvider(SUMOAbstractRouter< E, V > *vehRouter, PedestrianRouterDijkstra< E, L, N, V > *pedRouter, IntermodalRouter< E, L, N, V > *interRouter)
void addConnectors(_IntermodalEdge *const depConn, _IntermodalEdge *const arrConn, const int splitIndex)
the stop edge type representing bus and train stops
Definition: CarEdge.h:114
junctions with edges allowing the additional mode
vehicles ignoring classes
void addCarEdges(const std::vector< E *> &edges)
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
the access edge connecting different modes that is given to the internal router (SUMOAbstractRouter) ...
Definition: CarEdge.h:192
std::string id
The vehicle&#39;s id.
void setLength(const double length)