SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
RONet.cpp
Go to the documentation of this file.
1 /****************************************************************************/
9 // The router's network representation
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2001-2015 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
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 <algorithm>
34 #include "ROEdge.h"
35 #include "RONode.h"
36 #include "RONet.h"
37 #include "RORoute.h"
38 #include "RORouteDef.h"
39 #include "ROVehicle.h"
45 #include <utils/common/ToString.h>
49 
50 #ifdef CHECK_MEMORY_LEAKS
51 #include <foreign/nvwa/debug_new.h>
52 #endif // CHECK_MEMORY_LEAKS
53 
54 
55 // ===========================================================================
56 // method definitions
57 // ===========================================================================
59  : myVehicleTypes(), myDefaultVTypeMayBeDeleted(true),
60  myRoutesOutput(0), myRouteAlternativesOutput(0), myTypesOutput(0),
61  myReadRouteNo(0), myDiscardedRouteNo(0), myWrittenRouteNo(0),
62  myHaveRestrictions(false),
63  myNumInternalEdges(0),
64  myErrorHandler(OptionsCont::getOptions().exists("ignore-errors")
65  && OptionsCont::getOptions().getBool("ignore-errors") ? MsgHandler::getWarningInstance() : MsgHandler::getErrorInstance()) {
67  type->onlyReferenced = true;
68  myVehicleTypes.add(type->id, type);
69 }
70 
71 
73  myNodes.clear();
74  myEdges.clear();
76  myRoutes.clear();
77  myVehicles.clear();
78 }
79 
80 
81 bool
83  if (!myEdges.add(edge->getID(), edge)) {
84  WRITE_ERROR("The edge '" + edge->getID() + "' occurs at least twice.");
85  delete edge;
86  return false;
87  }
88  if (edge->getType() == ROEdge::ET_INTERNAL) {
89  myNumInternalEdges += 1;
90  }
91  return true;
92 }
93 
94 
95 bool
96 RONet::addDistrict(const std::string id, ROEdge* source, ROEdge* sink) {
97  if (myDistricts.count(id) > 0) {
98  WRITE_ERROR("The TAZ '" + id + "' occurs at least twice.");
99  delete source;
100  delete sink;
101  return false;
102  }
104  addEdge(sink);
105  source->setType(ROEdge::ET_DISTRICT);
106  addEdge(source);
107  myDistricts[id] = std::make_pair(std::vector<std::string>(), std::vector<std::string>());
108  return true;
109 }
110 
111 
112 bool
113 RONet::addDistrictEdge(const std::string tazID, const std::string edgeID, const bool isSource) {
114  if (myDistricts.count(tazID) == 0) {
115  WRITE_ERROR("The TAZ '" + tazID + "' is unknown.");
116  return false;
117  }
118  ROEdge* edge = getEdge(edgeID);
119  if (edge == 0) {
120  WRITE_ERROR("The edge '" + edgeID + "' for TAZ '" + tazID + "' is unknown.");
121  return false;
122  }
123  if (isSource) {
124  getEdge(tazID + "-source")->addSuccessor(edge);
125  myDistricts[tazID].first.push_back(edgeID);
126  } else {
127  edge->addSuccessor(getEdge(tazID + "-sink"));
128  myDistricts[tazID].second.push_back(edgeID);
129  }
130  return true;
131 }
132 
133 
134 void
136  if (!myNodes.add(node->getID(), node)) {
137  WRITE_ERROR("The node '" + node->getID() + "' occurs at least twice.");
138  delete node;
139  }
140 }
141 
142 
143 void
144 RONet::addBusStop(const std::string& id, SUMOVehicleParameter::Stop* stop) {
145  std::map<std::string, SUMOVehicleParameter::Stop*>::const_iterator it = myBusStops.find(id);
146  if (it != myBusStops.end()) {
147  WRITE_ERROR("The bus stop '" + id + "' occurs at least twice.");
148  delete stop;
149  }
150  myBusStops[id] = stop;
151 }
152 
153 
154 void
156  std::map<std::string, SUMOVehicleParameter::Stop*>::const_iterator it = myContainerStops.find(id);
157  if (it != myContainerStops.end()) {
158  WRITE_ERROR("The container stop '" + id + "' occurs at least twice.");
159  delete stop;
160  }
161  myContainerStops[id] = stop;
162 }
163 
164 
165 bool
167  return myRoutes.add(def->getID(), def);
168 }
169 
170 
171 void
172 RONet::openOutput(const std::string& filename, const std::string altFilename, const std::string typeFilename) {
173  if (filename != "") {
176  myRoutesOutput->writeAttr("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance").writeAttr("xsi:noNamespaceSchemaLocation", "http://sumo.dlr.de/xsd/routes_file.xsd");
177  }
178  if (altFilename != "") {
181  myRouteAlternativesOutput->writeAttr("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance").writeAttr("xsi:noNamespaceSchemaLocation", "http://sumo.dlr.de/xsd/routes_file.xsd");
182  }
183  if (typeFilename != "") {
184  myTypesOutput = &OutputDevice::getDevice(typeFilename);
185  myTypesOutput->writeXMLHeader("routes", "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo.dlr.de/xsd/routes_file.xsd\"");
186  }
187 }
188 
189 
190 void
192  // end writing
193  if (myRoutesOutput != 0) {
195  }
196  // only if opened
197  if (myRouteAlternativesOutput != 0) {
199  }
200  // only if opened
201  if (myTypesOutput != 0) {
202  myTypesOutput->close();
203  }
205 #ifdef HAVE_FOX
206  if (myThreadPool.size() > 0) {
207  myThreadPool.clear();
208  return;
209  }
210 #endif
211  delete router;
212 }
213 
214 
215 
217 RONet::getVehicleTypeSecure(const std::string& id) {
218  // check whether the type was already known
220  if (id == DEFAULT_VTYPE_ID) {
222  }
223  if (type != 0) {
224  return type;
225  }
226  VTypeDistDictType::iterator it2 = myVTypeDistDict.find(id);
227  if (it2 != myVTypeDistDict.end()) {
228  return it2->second->get();
229  }
230  if (id == "") {
231  // ok, no vehicle type or an unknown type was given within the user input
232  // return the default type
235  }
236  return type;
237 }
238 
239 
240 bool
241 RONet::checkVType(const std::string& id) {
242  if (id == DEFAULT_VTYPE_ID) {
246  } else {
247  return false;
248  }
249  } else {
250  if (myVehicleTypes.get(id) != 0 || myVTypeDistDict.find(id) != myVTypeDistDict.end()) {
251  return false;
252  }
253  }
254  return true;
255 }
256 
257 
258 bool
260  if (checkVType(type->id)) {
261  myVehicleTypes.add(type->id, type);
262  } else {
263  WRITE_ERROR("The vehicle type '" + type->id + "' occurs at least twice.");
264  delete type;
265  return false;
266  }
267  return true;
268 }
269 
270 
271 bool
272 RONet::addVTypeDistribution(const std::string& id, RandomDistributor<SUMOVTypeParameter*>* vehTypeDistribution) {
273  if (checkVType(id)) {
274  myVTypeDistDict[id] = vehTypeDistribution;
275  return true;
276  }
277  return false;
278 }
279 
280 
281 bool
282 RONet::addVehicle(const std::string& id, ROVehicle* veh) {
283  if (myVehIDs.find(id) == myVehIDs.end() && myVehicles.add(id, veh)) {
284  myVehIDs.insert(id);
285  myReadRouteNo++;
286  return true;
287  }
288  WRITE_ERROR("Another vehicle with the id '" + id + "' exists.");
289  return false;
290 }
291 
292 
293 bool
294 RONet::addFlow(SUMOVehicleParameter* flow, const bool randomize) {
295  if (randomize) {
296  myDepartures[flow->id].reserve(flow->repetitionNumber);
297  for (int i = 0; i < flow->repetitionNumber; ++i) {
298  myDepartures[flow->id].push_back(flow->depart + RandHelper::rand(flow->repetitionNumber * flow->repetitionOffset));
299  }
300  std::sort(myDepartures[flow->id].begin(), myDepartures[flow->id].end());
301  std::reverse(myDepartures[flow->id].begin(), myDepartures[flow->id].end());
302  }
303  return myFlows.add(flow->id, flow);
304 }
305 
306 
307 void
308 RONet::addPerson(const SUMOTime depart, const std::string desc) {
309  myPersons.insert(std::pair<const SUMOTime, const std::string>(depart, desc));
310 }
311 
312 void
313 RONet::addContainer(const SUMOTime depart, const std::string desc) {
314  myContainers.insert(std::pair<const SUMOTime, const std::string>(depart, desc));
315 }
316 
317 
318 bool
320  const ROVehicle* const veh, const bool removeLoops,
321  MsgHandler* errorHandler) {
322  std::string noRouteMsg = "The vehicle '" + veh->getID() + "' has no valid route.";
323  RORouteDef* const routeDef = veh->getRouteDefinition();
324  // check if the route definition is valid
325  if (routeDef == 0) {
326  errorHandler->inform(noRouteMsg);
327  return false;
328  }
329  RORoute* current = routeDef->buildCurrentRoute(router, veh->getDepartureTime(), *veh);
330  if (current == 0 || current->size() == 0) {
331  delete current;
332  errorHandler->inform(noRouteMsg);
333  return false;
334  }
335  // check whether we have to evaluate the route for not containing loops
336  if (removeLoops) {
337  current->recheckForLoops();
338  // check whether the route is still valid
339  if (current->size() == 0) {
340  delete current;
341  errorHandler->inform(noRouteMsg + " (after removing loops)");
342  return false;
343  }
344  }
345  // add built route
346  routeDef->addAlternative(router, veh, current, veh->getDepartureTime());
347  return true;
348 }
349 
350 
351 void
353  std::vector<std::string> toRemove;
355  SUMOVehicleParameter* pars = i->second;
356  if (pars->repetitionProbability > 0) {
357  while (pars->depart < time) {
358  if (pars->repetitionEnd <= pars->depart) {
359  toRemove.push_back(i->first);
360  break;
361  }
362  // only call rand if all other conditions are met
363  if (RandHelper::rand() < (pars->repetitionProbability * TS)) {
364  SUMOVehicleParameter* newPars = new SUMOVehicleParameter(*pars);
365  newPars->id = pars->id + "." + toString(pars->repetitionsDone);
366  newPars->depart = pars->depart;
367  pars->repetitionsDone++;
368  // try to build the vehicle
370  if (type == 0) {
372  } else {
373  // fix the type id in case we used a distribution
374  newPars->vtypeid = type->id;
375  }
376  RORouteDef* route = getRouteDef(pars->routeid)->copy("!" + newPars->id);
377  ROVehicle* veh = new ROVehicle(*newPars, route, type, this);
378  addVehicle(newPars->id, veh);
379  delete newPars;
380  }
381  pars->depart += DELTA_T;
382  }
383  } else {
384  while (pars->repetitionsDone < pars->repetitionNumber) {
385  SUMOTime depart = static_cast<SUMOTime>(pars->depart + pars->repetitionsDone * pars->repetitionOffset);
386  if (myDepartures.find(pars->id) != myDepartures.end()) {
387  depart = myDepartures[pars->id].back();
388  }
389  if (depart >= time + DELTA_T) {
390  break;
391  }
392  if (myDepartures.find(pars->id) != myDepartures.end()) {
393  myDepartures[pars->id].pop_back();
394  }
395  SUMOVehicleParameter* newPars = new SUMOVehicleParameter(*pars);
396  newPars->id = pars->id + "." + toString(pars->repetitionsDone);
397  newPars->depart = depart;
398  pars->repetitionsDone++;
399  // try to build the vehicle
401  if (type == 0) {
403  } else {
404  // fix the type id in case we used a distribution
405  newPars->vtypeid = type->id;
406  }
407  RORouteDef* route = getRouteDef(pars->routeid)->copy("!" + newPars->id);
408  ROVehicle* veh = new ROVehicle(*newPars, route, type, this);
409  addVehicle(newPars->id, veh);
410  delete newPars;
411  }
412  if (pars->repetitionsDone == pars->repetitionNumber) {
413  toRemove.push_back(i->first);
414  }
415  }
416  }
417  for (std::vector<std::string>::const_iterator i = toRemove.begin(); i != toRemove.end(); ++i) {
418  myFlows.erase(*i);
419  }
420 }
421 
422 
423 SUMOTime
425  SUMOTime time) {
426  checkFlows(time);
427  SUMOTime lastTime = -1;
428  const bool removeLoops = options.getBool("remove-loops");
429 #ifdef HAVE_FOX
430  const int maxNumThreads = options.getInt("routing-threads");
431 #endif
432  if (myVehicles.size() != 0) {
433  const std::map<std::string, ROVehicle*>& mmap = myVehicles.getMyMap();
434  for (std::map<std::string, ROVehicle*>::const_iterator i = mmap.begin(); i != mmap.end(); ++i) {
435  if (i->second->getDepart() >= time) {
436  // we cannot go through a sorted list here, because the priority queue in the myVehicles container is not fully sorted
437  continue;
438  }
439  i->second->setRoutingSuccess(false);
440 #ifdef HAVE_FOX
441  // add thread if necessary
442  const int numThreads = (int)myThreadPool.size();
443  if (numThreads < maxNumThreads && myThreadPool.isFull()) {
444  new WorkerThread(myThreadPool, numThreads == 0 ? &router : router.clone());
445  }
446  // add task
447  if (maxNumThreads > 0) {
448  myThreadPool.add(new RoutingTask(i->second, removeLoops, myErrorHandler));
449  continue;
450  }
451 #endif
452  i->second->setRoutingSuccess(computeRoute(router, i->second, removeLoops, myErrorHandler));
453  }
454 #ifdef HAVE_FOX
455  myThreadPool.waitAll();
456 #endif
457  }
458  // write all vehicles (and additional structures)
459  while (myVehicles.size() != 0 || myPersons.size() != 0 || myContainers.size() != 0) {
460  // get the next vehicle, person or container
461  const ROVehicle* const veh = myVehicles.getTopVehicle();
462  const SUMOTime vehicleTime = veh == 0 ? SUMOTime_MAX : veh->getDepart();
463  PersonMap::iterator person = myPersons.begin();
464  const SUMOTime personTime = person == myPersons.end() ? SUMOTime_MAX : person->first;
465  ContainerMap::iterator container = myContainers.begin();
466  const SUMOTime containerTime = container == myContainers.end() ? SUMOTime_MAX : container->first;
467  // check whether it shall not yet be computed
468  if (vehicleTime >= time && personTime >= time && containerTime >= time) {
469  lastTime = MIN3(vehicleTime, personTime, containerTime);
470  break;
471  }
472  SUMOTime minTime = MIN3(vehicleTime, personTime, containerTime);
473  if (vehicleTime == minTime) {
474  // check whether to print the output
475  if (lastTime != vehicleTime && lastTime != -1) {
476  // report writing progress
477  if (options.getInt("stats-period") >= 0 && ((int) vehicleTime % options.getInt("stats-period")) == 0) {
478  WRITE_MESSAGE("Read: " + toString(myReadRouteNo) + ", Discarded: " + toString(myDiscardedRouteNo) + ", Written: " + toString(myWrittenRouteNo));
479  }
480  }
481  lastTime = vehicleTime;
482 
483  // ok, compute the route (try it)
484  if (veh->getRoutingSuccess()) {
485  // write the route
487  veh->saveAllAsXML(*myRoutesOutput, false, options.getBool("exit-times"));
488  if (myRouteAlternativesOutput != 0) {
489  veh->saveAllAsXML(*myRouteAlternativesOutput, true, options.getBool("exit-times"));
490  }
492  } else {
494  }
495  // delete routes and the vehicle
496  if (veh->getRouteDefinition()->getID()[0] == '!') {
497  if (!myRoutes.erase(veh->getRouteDefinition()->getID())) {
498  delete veh->getRouteDefinition();
499  }
500  }
501  myVehicles.erase(veh->getID());
502  }
503  if (personTime == minTime) {
504  myRoutesOutput->writePreformattedTag(person->second);
505  if (myRouteAlternativesOutput != 0) {
507  }
508  myPersons.erase(person);
509  }
510  if (containerTime == minTime) {
511  myRoutesOutput->writePreformattedTag(container->second);
512  if (myRouteAlternativesOutput != 0) {
514  }
515  myContainers.erase(container);
516  }
517  }
518  return lastTime;
519 }
520 
521 
522 bool
524  return myVehicles.size() > 0 || myFlows.size() > 0 || myPersons.size() > 0 || myContainers.size() > 0;
525 }
526 
527 
528 size_t
530  return myEdges.size();
531 }
532 
533 
534 int
536  return myNumInternalEdges;
537 }
538 
539 
540 const std::map<std::string, ROEdge*>&
542  return myEdges.getMyMap();
543 }
544 
545 
546 bool
548  return myHaveRestrictions;
549 }
550 
551 
552 void
554  myHaveRestrictions = true;
555 }
556 
557 
558 #ifdef HAVE_FOX
559 // ---------------------------------------------------------------------------
560 // RONet::RoutingTask-methods
561 // ---------------------------------------------------------------------------
562 void
563 RONet::RoutingTask::run(FXWorkerThread* context) {
564  myVehicle->setRoutingSuccess(RONet::computeRoute(static_cast<WorkerThread*>(context)->getRouter(), myVehicle, myRemoveLoops, myErrorHandler));
565 }
566 #endif
567 
568 
569 /****************************************************************************/
570 
SUMOTime getDepartureTime() const
Returns the time the vehicle starts at, 0 for triggered vehicles.
Definition: ROVehicle.h:112
const std::string & getID() const
Returns the id of the vehicle.
Definition: ROVehicle.h:103
SUMOTime repetitionEnd
The time at which the flow ends (only needed when using repetitionProbability)
bool addDistrictEdge(const std::string tazID, const std::string edgeID, const bool isSource)
Definition: RONet.cpp:113
SUMOReal repetitionProbability
The probability for emitting a vehicle per second.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:257
OutputDevice * myRouteAlternativesOutput
The file to write the computed route alternatives into.
Definition: RONet.h:469
void close()
Closes the device and removes it from the dictionary.
EdgeType getType() const
Returns the type of the edge.
Definition: ROEdge.h:175
NamedObjectCont< SUMOVehicleParameter * > myFlows
Known flows.
Definition: RONet.h:449
int repetitionNumber
The number of times the vehicle shall be repeatedly inserted.
std::map< std::string, std::pair< std::vector< std::string >, std::vector< std::string > > > myDistricts
traffic assignment zones with sources and sinks
Definition: RONet.h:463
std::string vtypeid
The vehicle's type id.
int myNumInternalEdges
The number of internal edges in the dictionary.
Definition: RONet.h:487
void clear()
Deletes all vehicles stored; clears the lists.
size_t getEdgeNo() const
Returns the total number of edges the network contains including internal edges.
Definition: RONet.cpp:529
unsigned int size() const
Returns the number of edges in this route.
Definition: RORoute.h:146
bool checkVType(const std::string &id)
Checks whether the vehicle type (distribution) may be added.
Definition: RONet.cpp:241
bool erase(const std::string &id)
Removes the named item from the container.
virtual bool add(const std::string &id, T item)
Adds an item.
Structure representing possible vehicle parameter.
void addAlternative(SUMOAbstractRouter< ROEdge, ROVehicle > &router, const ROVehicle *const, RORoute *current, SUMOTime begin)
Adds an alternative to the list of routes.
Definition: RORouteDef.cpp:245
void addNode(RONode *node)
Definition: RONet.cpp:135
RORoute * buildCurrentRoute(SUMOAbstractRouter< ROEdge, ROVehicle > &router, SUMOTime begin, const ROVehicle &veh) const
Triggers building of the complete route (via preComputeCurrentRoute) or returns precomputed route...
Definition: RORouteDef.cpp:95
virtual SUMOAbstractRouter * clone() const =0
ROEdge * getEdge(const std::string &name) const
Retrieves an edge from the network.
Definition: RONet.h:138
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
OutputDevice & writePreformattedTag(const std::string &val)
writes a preformatted tag to the device but ensures that any pending tags are closed ...
Definition: OutputDevice.h:303
static SUMOReal rand()
Returns a random real number in [0, 1)
Definition: RandHelper.h:62
int repetitionsDone
The number of times the vehicle was already inserted.
void recheckForLoops()
Checks whether this route contains loops and removes such.
Definition: RORoute.cpp:86
NamedObjectCont< ROEdge * > myEdges
Known edges.
Definition: RONet.h:423
SUMOTime getDepart() const
Returns the time the vehicle starts at, -1 for triggered vehicles.
Definition: ROVehicle.h:120
An internal edge which models vehicles driving across a junction. This is currently not used for rout...
Definition: ROEdge.h:93
unsigned int myDiscardedRouteNo
The number of discarded routes.
Definition: RONet.h:478
#define TS
Definition: SUMOTime.h:52
A map of named object pointers.
std::map< std::string, std::vector< SUMOTime > > myDepartures
Departure times for randomized flows.
Definition: RONet.h:460
OutputDevice * myTypesOutput
The file to write the vehicle types into.
Definition: RONet.h:472
SUMOReal repetitionOffset
The time offset between vehicle reinsertions.
const std::string DEFAULT_VTYPE_ID
virtual bool addVehicleType(SUMOVTypeParameter *type)
Adds a read vehicle type definition to the network.
Definition: RONet.cpp:259
virtual bool addVehicle(const std::string &id, ROVehicle *veh)
Definition: RONet.cpp:282
const std::map< std::string, ROEdge * > & getEdgeMap() const
Definition: RONet.cpp:541
virtual bool add(const std::string &id, ROVehicle *item)
Adds a vehicle to the container.
void openOutput(const std::string &filename, const std::string altFilename, const std::string typeFilename)
Opens the output for computed routes.
Definition: RONet.cpp:172
T get(const std::string &id) const
Retrieves an item.
bool writeXMLHeader(const std::string &rootElement, const std::string &attrs="", const std::string &comment="")
Writes an XML header with optional configuration.
void checkFlows(SUMOTime time)
Definition: RONet.cpp:352
void clear()
Removes all items from the container (deletes them, too)
bool writeHeader(const SumoXMLTag &rootElement)
Definition: OutputDevice.h:189
void saveTypeAsXML(OutputDevice &os, OutputDevice *const altos, OutputDevice *const typeos) const
Saves the vehicle type if it was not saved before.
Definition: ROVehicle.cpp:116
const std::string & getID() const
Returns the id.
Definition: Named.h:60
bool addVTypeDistribution(const std::string &id, RandomDistributor< SUMOVTypeParameter * > *vehTypeDistribution)
Adds a vehicle type distribution.
Definition: RONet.cpp:272
bool getRoutingSuccess() const
Definition: ROVehicle.h:170
A vehicle as used by router.
Definition: ROVehicle.h:60
void setType(EdgeType type)
Sets the type of te edge.
Definition: ROEdge.cpp:225
bool addRouteDef(RORouteDef *def)
Definition: RONet.cpp:166
bool myHaveRestrictions
Whether the network contains edges which not all vehicles may pass.
Definition: RONet.h:484
std::string routeid
The vehicle's route id.
OutputDevice * myRoutesOutput
The file to write the computed routes into.
Definition: RONet.h:466
void addContainer(const SUMOTime depart, const std::string desc)
Definition: RONet.cpp:313
std::map< std::string, SUMOVehicleParameter::Stop * > myContainerStops
Known container stops.
Definition: RONet.h:429
virtual bool remove(const std::string &id)
Removes an item.
const ROVehicle * getTopVehicle() const
Returns the vehicle that departs most early.
NamedObjectCont< SUMOVTypeParameter * > myVehicleTypes
Known vehicle types.
Definition: RONet.h:432
SUMOTime depart
The vehicle's departure time.
void addPerson(const SUMOTime depart, const std::string desc)
Definition: RONet.cpp:308
ContainerMap myContainers
Definition: RONet.h:457
virtual bool furtherStored()
Returns the information whether further vehicles, persons or containers are stored.
Definition: RONet.cpp:523
unsigned int size() const
Returns the number of items within the container.
ROVehicleCont myVehicles
Known vehicles.
Definition: RONet.h:446
An edge representing a whole district.
Definition: ROEdge.h:83
unsigned int myReadRouteNo
The number of read routes.
Definition: RONet.h:475
bool myDefaultVTypeMayBeDeleted
Whether no vehicle type was loaded.
Definition: RONet.h:440
NamedObjectCont< RORouteDef * > myRoutes
Known routes.
Definition: RONet.h:443
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:53
bool erase(const std::string &id)
Tries to remove (and delete) the named vehicle.
A basic edge for routing applications.
Definition: ROEdge.h:73
bool onlyReferenced
Information whether this is a type-stub, being only referenced but not defined (needed by routers) ...
void saveAllAsXML(OutputDevice &os, bool asAlternatives, bool withExitTimes) const
Saves the complete vehicle description.
Definition: ROVehicle.cpp:135
int getInternalEdgeNumber() const
Returns the number of internal edges the network contains.
Definition: RONet.cpp:535
const IDMap & getMyMap() const
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:205
RONet()
Constructor.
Definition: RONet.cpp:58
bool addDistrict(const std::string id, ROEdge *source, ROEdge *sink)
Definition: RONet.cpp:96
Structure representing possible vehicle parameter.
void setRestrictionFound()
Definition: RONet.cpp:553
virtual void addSuccessor(ROEdge *s, std::string dir="")
Adds information about a connected edge.
Definition: ROEdge.cpp:103
#define SUMOTime_MAX
Definition: SUMOTime.h:44
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
RORouteDef * copy(const std::string &id) const
Returns a deep copy of the route definition.
Definition: RORouteDef.cpp:368
Definition of vehicle stop (position and duration)
PersonMap myPersons
Definition: RONet.h:453
void inform(std::string msg, bool addType=true)
adds a new error to the list
Definition: MsgHandler.cpp:89
A storage for options typed value containers)
Definition: OptionsCont.h:108
bool hasRestrictions() const
Definition: RONet.cpp:547
VTypeDistDictType myVTypeDistDict
A distribution of vehicle types (probability->vehicle type)
Definition: RONet.h:437
Base class for a vehicle's route definition.
Definition: RORouteDef.h:63
std::string id
The vehicle type's id.
void addBusStop(const std::string &id, SUMOVehicleParameter::Stop *stop)
Definition: RONet.cpp:144
int SUMOTime
Definition: SUMOTime.h:43
virtual bool addEdge(ROEdge *edge)
Definition: RONet.cpp:82
static bool computeRoute(SUMOAbstractRouter< ROEdge, ROVehicle > &router, const ROVehicle *const veh, const bool removeLoops, MsgHandler *errorHandler)
Definition: RONet.cpp:319
std::set< std::string > myVehIDs
Known vehicle ids.
Definition: RONet.h:417
virtual ~RONet()
Destructor.
Definition: RONet.cpp:72
SUMOVTypeParameter * getVehicleTypeSecure(const std::string &id)
Retrieves the named vehicle type.
Definition: RONet.cpp:217
A thread repeatingly calculating incoming tasks.
MsgHandler * myErrorHandler
handler for ignorable error messages
Definition: RONet.h:490
T MIN3(T a, T b, T c)
Definition: StdDefs.h:81
Base class for nodes used by the router.
Definition: RONode.h:53
#define DELTA_T
Definition: SUMOTime.h:50
NamedObjectCont< RONode * > myNodes
Known nodes.
Definition: RONet.h:420
bool addFlow(SUMOVehicleParameter *flow, const bool randomize)
Definition: RONet.cpp:294
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
RORouteDef * getRouteDefinition() const
Returns the definition of the route the vehicle takes.
Definition: ROVehicle.h:83
SUMOTime saveAndRemoveRoutesUntil(OptionsCont &options, SUMOAbstractRouter< ROEdge, ROVehicle > &router, SUMOTime time)
Computes routes described by their definitions and saves them.
Definition: RONet.cpp:424
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:201
void cleanup(SUMOAbstractRouter< ROEdge, ROVehicle > *router)
closes the file output for computed routes and deletes routers and associated threads if necessary ...
Definition: RONet.cpp:191
void addContainerStop(const std::string &id, SUMOVehicleParameter::Stop *stop)
Definition: RONet.cpp:155
RORouteDef * getRouteDef(const std::string &name) const
Returns the named route definition.
Definition: RONet.h:290
vehicles ignoring classes
std::map< std::string, SUMOVehicleParameter::Stop * > myBusStops
Known bus stops.
Definition: RONet.h:426
A complete router's route.
Definition: RORoute.h:62
std::string id
The vehicle's id.
unsigned int myWrittenRouteNo
The number of written routes.
Definition: RONet.h:481