SUMO - Simulation of Urban MObility
marouter_main.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
20 // Main for MAROUTER
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 #ifdef HAVE_VERSION_H
34 #include <version.h>
35 #endif
36 
37 #include <xercesc/sax/SAXException.hpp>
38 #include <xercesc/sax/SAXParseException.hpp>
40 #include <iostream>
41 #include <string>
42 #include <limits.h>
43 #include <ctime>
44 #include <vector>
49 #include <utils/common/ToString.h>
53 #include <utils/options/Option.h>
59 #include <utils/vehicle/CHRouter.h>
61 #include <utils/xml/XMLSubSys.h>
62 #include <od/ODCell.h>
63 #include <od/ODDistrict.h>
64 #include <od/ODDistrictCont.h>
65 #include <od/ODDistrictHandler.h>
66 #include <od/ODMatrix.h>
67 #include <router/ROEdge.h>
68 #include <router/ROLoader.h>
69 #include <router/RONet.h>
70 #include <router/RORoute.h>
71 #include <router/RORoutable.h>
72 
73 #include "ROMAFrame.h"
74 #include "ROMAAssignments.h"
75 #include "ROMAEdgeBuilder.h"
76 #include "ROMARouteHandler.h"
77 #include "ROMAEdge.h"
78 
79 
80 // ===========================================================================
81 // functions
82 // ===========================================================================
83 /* -------------------------------------------------------------------------
84  * data processing methods
85  * ----------------------------------------------------------------------- */
91 void
92 initNet(RONet& net, ROLoader& loader, OptionsCont& oc) {
93  // load the net
94  ROMAEdgeBuilder builder;
95  ROEdge::setGlobalOptions(oc.getBool("weights.interpolate"));
96  loader.loadNet(net, builder);
97  // initialize the travel times
98  /* const SUMOTime begin = string2time(oc.getString("begin"));
99  const SUMOTime end = string2time(oc.getString("end"));
100  for (std::map<std::string, ROEdge*>::const_iterator i = net.getEdgeMap().begin(); i != net.getEdgeMap().end(); ++i) {
101  (*i).second->addTravelTime(STEPS2TIME(begin), STEPS2TIME(end), (*i).second->getLength() / (*i).second->getSpeedLimit());
102  }*/
103  // load the weights when wished/available
104  if (oc.isSet("weight-files")) {
105  loader.loadWeights(net, "weight-files", oc.getString("weight-attribute"), false, oc.getBool("weights.expand"));
106  }
107  if (oc.isSet("lane-weight-files")) {
108  loader.loadWeights(net, "lane-weight-files", oc.getString("weight-attribute"), true, oc.getBool("weights.expand"));
109  }
110 }
111 
112 double
113 getTravelTime(const ROEdge* const edge, const ROVehicle* const /* veh */, double /* time */) {
114  return edge->getLength() / edge->getSpeedLimit();
115 }
116 
117 
121 void
123  std::ofstream outFile(oc.getString("all-pairs-output").c_str(), std::ios::binary);
124  // build the router
126  Dijkstra router(ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &getTravelTime);
127  ConstROEdgeVector into;
128  const int numInternalEdges = net.getInternalEdgeNumber();
129  const int numTotalEdges = (int)net.getEdgeNumber();
130  for (int i = numInternalEdges; i < numTotalEdges; i++) {
131  const Dijkstra::EdgeInfo& ei = router.getEdgeInfo(i);
132  if (!ei.edge->isInternal()) {
133  router.compute(ei.edge, 0, 0, 0, into);
134  double fromEffort = router.getEffort(ei.edge, 0, 0);
135  for (int j = numInternalEdges; j < numTotalEdges; j++) {
136  double heuTT = router.getEdgeInfo(j).effort - fromEffort;
137  FileHelpers::writeFloat(outFile, heuTT);
138  /*
139  if (heuTT >
140  ei.edge->getDistanceTo(router.getEdgeInfo(j).edge)
141  && router.getEdgeInfo(j).traveltime != std::numeric_limits<double>::max()
142  ) {
143  std::cout << " heuristic failure: from=" << ei.edge->getID() << " to=" << router.getEdgeInfo(j).edge->getID()
144  << " fromEffort=" << fromEffort << " heuTT=" << heuTT << " airDist=" << ei.edge->getDistanceTo(router.getEdgeInfo(j).edge) << "\n";
145  }
146  */
147  }
148  }
149  }
150 }
151 
152 
156 void
157 writeInterval(OutputDevice& dev, const SUMOTime begin, const SUMOTime end, const RONet& net, const ROVehicle* const veh) {
159  for (std::map<std::string, ROEdge*>::const_iterator i = net.getEdgeMap().begin(); i != net.getEdgeMap().end(); ++i) {
160  ROMAEdge* edge = static_cast<ROMAEdge*>(i->second);
161  if (edge->getFunction() == EDGEFUNC_NORMAL) {
163  const double traveltime = edge->getTravelTime(veh, STEPS2TIME(begin));
164  const double flow = edge->getFlow(STEPS2TIME(begin));
165  dev.writeAttr("traveltime", traveltime);
166  dev.writeAttr("speed", edge->getLength() / traveltime);
167  dev.writeAttr("entered", flow);
168  dev.writeAttr("flowCapacityRatio", 100. * flow / ROMAAssignments::getCapacity(edge));
169  dev.closeTag();
170  }
171  }
172  dev.closeTag();
173 }
174 
175 
179 void
181  // build the router
183  const std::string measure = oc.getString("weight-attribute");
184  const std::string routingAlgorithm = oc.getString("routing-algorithm");
185  const SUMOTime begin = string2time(oc.getString("begin"));
186  const SUMOTime end = string2time(oc.getString("end"));
187  if (measure == "traveltime") {
188  if (routingAlgorithm == "dijkstra") {
189  if (net.hasPermissions()) {
190  if (oc.getInt("paths") > 1) {
193  } else {
195  ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &ROEdge::getTravelTimeStatic);
196  }
197  } else {
198  if (oc.getInt("paths") > 1) {
201  } else {
203  ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &ROEdge::getTravelTimeStatic);
204  }
205  }
206  } else if (routingAlgorithm == "astar") {
207  if (net.hasPermissions()) {
208  if (oc.getInt("paths") > 1) {
211  } else {
213  ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &ROEdge::getTravelTimeStatic);
214  }
215  } else {
216  if (oc.getInt("paths") > 1) {
219  } else {
221  ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &ROEdge::getTravelTimeStatic);
222  }
223  }
224  } else if (routingAlgorithm == "CH") {
225  const SUMOTime weightPeriod = (oc.isSet("weight-files") ?
226  string2time(oc.getString("weight-period")) :
227  std::numeric_limits<int>::max());
228  if (net.hasPermissions()) {
230  ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &ROEdge::getTravelTimeStatic, SVC_IGNORING, weightPeriod, true);
231  } else {
233  ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &ROEdge::getTravelTimeStatic, SVC_IGNORING, weightPeriod, false);
234  }
235  } else if (routingAlgorithm == "CHWrapper") {
236  const SUMOTime weightPeriod = (oc.isSet("weight-files") ?
237  string2time(oc.getString("weight-period")) :
238  std::numeric_limits<int>::max());
241  begin, end, weightPeriod, oc.getInt("routing-threads"));
242  } else {
243  throw ProcessError("Unknown routing Algorithm '" + routingAlgorithm + "'!");
244  }
245 
246  } else {
248  if (measure == "CO") {
249  op = &ROEdge::getEmissionEffort<PollutantsInterface::CO>;
250  } else if (measure == "CO2") {
251  op = &ROEdge::getEmissionEffort<PollutantsInterface::CO2>;
252  } else if (measure == "PMx") {
253  op = &ROEdge::getEmissionEffort<PollutantsInterface::PM_X>;
254  } else if (measure == "HC") {
255  op = &ROEdge::getEmissionEffort<PollutantsInterface::HC>;
256  } else if (measure == "NOx") {
257  op = &ROEdge::getEmissionEffort<PollutantsInterface::NO_X>;
258  } else if (measure == "fuel") {
259  op = &ROEdge::getEmissionEffort<PollutantsInterface::FUEL>;
260  } else if (measure == "electricity") {
261  op = &ROEdge::getEmissionEffort<PollutantsInterface::ELEC>;
262  } else if (measure == "noise") {
264  } else {
265  throw ProcessError("Unknown measure (weight attribute '" + measure + "')!");
266  }
267  if (net.hasPermissions()) {
268  if (oc.getInt("paths") > 1) {
271  } else {
273  ROEdge::getAllEdges(), oc.getBool("ignore-errors"), op, &ROEdge::getTravelTimeStatic);
274  }
275  } else {
276  if (oc.getInt("paths") > 1) {
279  } else {
281  ROEdge::getAllEdges(), oc.getBool("ignore-errors"), op, &ROEdge::getTravelTimeStatic);
282  }
283  }
284  }
285  try {
286  const RORouterProvider provider(router, 0, 0);
287  // prepare the output
288  net.openOutput(oc);
289  // process route definitions
290  if (oc.isSet("timeline")) {
291  matrix.applyCurve(matrix.parseTimeLine(oc.getStringVector("timeline"), oc.getBool("timeline.day-in-hours")));
292  }
293  matrix.sortByBeginTime();
294  ROVehicle defaultVehicle(SUMOVehicleParameter(), 0, net.getVehicleTypeSecure(DEFAULT_VTYPE_ID), &net);
295  ROMAAssignments a(begin, end, oc.getBool("additive-traffic"), oc.getFloat("weight-adaption"), net, matrix, *router);
296  a.resetFlows();
297 #ifdef HAVE_FOX
298  const int maxNumThreads = oc.getInt("routing-threads");
299  while ((int)net.getThreadPool().size() < maxNumThreads) {
300  new RONet::WorkerThread(net.getThreadPool(), provider);
301  }
302 #endif
303  const std::string assignMethod = oc.getString("assignment-method");
304  if (assignMethod == "incremental") {
305  a.incremental(oc.getInt("max-iterations"), oc.getBool("verbose"));
306  } else if (assignMethod == "SUE") {
307  a.sue(oc.getInt("max-iterations"), oc.getInt("max-inner-iterations"),
308  oc.getInt("paths"), oc.getFloat("paths.penalty"), oc.getFloat("tolerance"), oc.getString("route-choice-method"));
309  }
310  // update path costs and output
311  bool haveOutput = false;
312  OutputDevice* dev = net.getRouteOutput();
313  if (dev != 0) {
314  std::vector<std::string> tazParamKeys;
315  if (oc.isSet("taz-param")) {
316  tazParamKeys = oc.getStringVector("taz-param");
317  }
318  std::map<SUMOTime, std::string> sortedOut;
319  SUMOTime lastEnd = -1;
320  int num = 0;
321  for (std::vector<ODCell*>::const_iterator i = matrix.getCells().begin(); i != matrix.getCells().end(); ++i) {
322  const ODCell* const c = *i;
323  if (lastEnd >= 0 && lastEnd <= c->begin) {
324  for (std::map<SUMOTime, std::string>::const_iterator desc = sortedOut.begin(); desc != sortedOut.end(); ++desc) {
325  dev->writePreformattedTag(desc->second);
326  }
327  sortedOut.clear();
328  }
329  if (c->departures.empty()) {
330  OutputDevice_String od(dev->isBinary(), 1);
331  od.openTag(SUMO_TAG_FLOW).writeAttr(SUMO_ATTR_ID, oc.getString("prefix") + toString(num++));
334  matrix.writeDefaultAttrs(od, oc.getBool("ignore-vehicle-type"), c);
336  for (std::vector<RORoute*>::const_iterator j = c->pathsVector.begin(); j != c->pathsVector.end(); ++j) {
337  (*j)->setCosts(router->recomputeCosts((*j)->getEdgeVector(), &defaultVehicle, string2time(oc.getString("begin"))));
338  (*j)->writeXMLDefinition(od, 0, true, false);
339  }
340  od.closeTag();
341  od.closeTag();
342  sortedOut[c->begin] += od.getString();
343  } else {
344  for (std::map<SUMOTime, std::vector<std::string> >::const_iterator deps = c->departures.begin(); deps != c->departures.end(); ++deps) {
345  const std::string routeDistId = c->origin + "_" + c->destination + "_" + time2string(c->begin) + "_" + time2string(c->end);
346  for (std::vector<std::string>::const_iterator id = deps->second.begin(); id != deps->second.end(); ++id) {
347  OutputDevice_String od(dev->isBinary(), 1);
349  matrix.writeDefaultAttrs(od, oc.getBool("ignore-vehicle-type"), c);
351  for (std::vector<RORoute*>::const_iterator j = c->pathsVector.begin(); j != c->pathsVector.end(); ++j) {
352  (*j)->setCosts(router->recomputeCosts((*j)->getEdgeVector(), &defaultVehicle, string2time(oc.getString("begin"))));
353  (*j)->writeXMLDefinition(od, 0, true, false);
354  }
355  od.closeTag();
356  if (!tazParamKeys.empty()) {
357  od.openTag(SUMO_TAG_PARAM).writeAttr(SUMO_ATTR_KEY, tazParamKeys[0]).writeAttr(SUMO_ATTR_VALUE, c->origin).closeTag();
358  if (tazParamKeys.size() > 1) {
359  od.openTag(SUMO_TAG_PARAM).writeAttr(SUMO_ATTR_KEY, tazParamKeys[1]).writeAttr(SUMO_ATTR_VALUE, c->destination).closeTag();
360  }
361  }
362  od.closeTag();
363  sortedOut[deps->first] += od.getString();
364  }
365  }
366  }
367  for (std::vector<RORoute*>::const_iterator j = c->pathsVector.begin(); j != c->pathsVector.end(); ++j) {
368  delete *j;
369  }
370  if (c->end > lastEnd) {
371  lastEnd = c->end;
372  }
373  }
374  for (std::map<SUMOTime, std::string>::const_iterator desc = sortedOut.begin(); desc != sortedOut.end(); ++desc) {
375  dev->writePreformattedTag(desc->second);
376  }
377  haveOutput = true;
378  }
379  if (OutputDevice::createDeviceByOption("netload-output", "meandata")) {
380  if (oc.getBool("additive-traffic")) {
381  writeInterval(OutputDevice::getDeviceByOption("netload-output"), begin, end, net, a.getDefaultVehicle());
382  } else {
383  SUMOTime lastCell = 0;
384  for (std::vector<ODCell*>::const_iterator i = matrix.getCells().begin(); i != matrix.getCells().end(); ++i) {
385  if ((*i)->end > lastCell) {
386  lastCell = (*i)->end;
387  }
388  }
389  const SUMOTime interval = string2time(OptionsCont::getOptions().getString("aggregation-interval"));
390  for (SUMOTime start = begin; start < MIN2(end, lastCell); start += interval) {
391  writeInterval(OutputDevice::getDeviceByOption("netload-output"), start, start + interval, net, a.getDefaultVehicle());
392  }
393  }
394  haveOutput = true;
395  }
396  if (!haveOutput) {
397  throw ProcessError("No output file given.");
398  }
399  // end the processing
400  net.cleanup();
401  } catch (ProcessError&) {
402  for (std::vector<ODCell*>::const_iterator i = matrix.getCells().begin(); i != matrix.getCells().end(); ++i) {
403  for (std::vector<RORoute*>::const_iterator j = (*i)->pathsVector.begin(); j != (*i)->pathsVector.end(); ++j) {
404  delete *j;
405  }
406  }
407  net.cleanup();
408  throw;
409  }
410 }
411 
412 
413 /* -------------------------------------------------------------------------
414  * main
415  * ----------------------------------------------------------------------- */
416 int
417 main(int argc, char** argv) {
419  oc.setApplicationDescription("Import O/D-matrices for macroscopic traffic assignment");
420  oc.setApplicationName("marouter", "SUMO marouter Version " VERSION_STRING);
421  int ret = 0;
422  RONet* net = 0;
423  try {
424  XMLSubSys::init();
426  OptionsIO::setArgs(argc, argv);
428  if (oc.processMetaOptions(argc < 2)) {
430  return 0;
431  }
432  XMLSubSys::setValidation(oc.getString("xml-validation"), oc.getString("xml-validation.net"));
434  if (!ROMAFrame::checkOptions()) {
435  throw ProcessError();
436  }
438  // load data
439  ROLoader loader(oc, false, false);
440  net = new RONet();
441  initNet(*net, loader, oc);
442  if (oc.isSet("all-pairs-output")) {
443  computeAllPairs(*net, oc);
444  if (net->getDistricts().empty()) {
445  delete net;
447  if (ret == 0) {
448  std::cout << "Success." << std::endl;
449  }
450  return ret;
451  }
452  }
453  if (net->getDistricts().empty()) {
454  throw ProcessError("No districts loaded.");
455  }
456  // load districts
457  ODDistrictCont districts;
458  districts.makeDistricts(net->getDistricts());
459  // load the matrix
460  ODMatrix matrix(districts);
461  matrix.loadMatrix(oc);
462  ROMARouteHandler handler(matrix);
463  matrix.loadRoutes(oc, handler);
464  if (matrix.getNumLoaded() == 0) {
465  throw ProcessError("No vehicles loaded.");
466  }
467  if (MsgHandler::getErrorInstance()->wasInformed() && !oc.getBool("ignore-errors")) {
468  throw ProcessError("Loading failed.");
469  }
471  WRITE_MESSAGE(toString(matrix.getNumLoaded()) + " vehicles loaded.");
472 
473  // build routes and parse the incremental rates if the incremental method is choosen.
474  try {
475  computeRoutes(*net, oc, matrix);
476  } catch (XERCES_CPP_NAMESPACE::SAXParseException& e) {
477  WRITE_ERROR(toString(e.getLineNumber()));
478  ret = 1;
479  } catch (XERCES_CPP_NAMESPACE::SAXException& e) {
480  WRITE_ERROR(TplConvert::_2str(e.getMessage()));
481  ret = 1;
482  }
483  if (MsgHandler::getErrorInstance()->wasInformed() || ret != 0) {
484  throw ProcessError();
485  }
486  } catch (const ProcessError& e) {
487  if (std::string(e.what()) != std::string("Process Error") && std::string(e.what()) != std::string("")) {
488  WRITE_ERROR(e.what());
489  }
490  MsgHandler::getErrorInstance()->inform("Quitting (on error).", false);
491  ret = 1;
492  }
493 
494  delete net;
496  if (ret == 0) {
497  std::cout << "Success." << std::endl;
498  }
499  return ret;
500 }
501 
502 
503 
504 /****************************************************************************/
505 
Computes the shortest path through a contracted network.
Definition: CHRouter.h:69
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:260
int getEdgeNumber() const
Returns the total number of edges the network contains including internal edges.
Definition: RONet.cpp:645
const std::vector< ODCell * > & getCells()
Definition: ODMatrix.h:246
static void init()
Initialises the xml-subsystem.
Definition: XMLSubSys.cpp:53
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
Definition: MsgHandler.cpp:75
OutputDevice * getRouteOutput(const bool alternative=false)
Definition: RONet.h:410
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
void computeRoutes(RONet &net, OptionsCont &oc, ODMatrix &matrix)
static void getOptions(const bool commandLineOnly=false)
Parses the command line arguments and loads the configuration.
Definition: OptionsIO.cpp:82
int getInternalEdgeNumber() const
Returns the number of internal edges the network contains.
Definition: RONet.cpp:651
assignment methods
a flow definition (used by router)
static void setValidation(const std::string &validationScheme, const std::string &netValidationScheme)
Enables or disables validation.
Definition: XMLSubSys.cpp:64
distribution of a route
Interface for building instances of duarouter-edges.
virtual double recomputeCosts(const std::vector< const E *> &edges, const V *const v, SUMOTime msTime) const =0
void makeDistricts(const std::map< std::string, std::pair< std::vector< std::string >, std::vector< std::string > > > &districts)
create districts from description
void setApplicationDescription(const std::string &appDesc)
Sets the application description.
int main(int argc, char **argv)
static std::ostream & writeFloat(std::ostream &strm, double value)
Writes a float binary.
OutputDevice & writePreformattedTag(const std::string &val)
writes a preformatted tag to the device but ensures that any pending tags are closed ...
Definition: OutputDevice.h:306
std::string time2string(SUMOTime t)
Definition: SUMOTime.cpp:59
Computes the shortest path through a network using the A* algorithm.
Definition: AStarRouter.h:84
weights: time range begin
static bool checkOptions()
Checks set options from the OptionsCont-singleton for being valid for usage within duarouter...
Definition: ROMAFrame.cpp:291
const std::map< std::string, std::pair< std::vector< std::string >, std::vector< std::string > > > & getDistricts() const
Retrieves all TAZ (districts) from the network.
Definition: RONet.h:151
void computeAllPairs(RONet &net, OptionsCont &oc)
bool hasPermissions() const
Definition: RONet.cpp:688
double getLength() const
Returns the length of the edge.
Definition: ROEdge.h:204
std::vector< const ROEdge * > ConstROEdgeVector
Definition: ROEdge.h:62
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
Parser and container for routes during their loading.
const std::string & getID() const
Returns the id.
Definition: Named.h:65
std::vector< RORoute * > pathsVector
the list of paths / routes
Definition: ODCell.h:77
const std::string DEFAULT_VTYPE_ID
static void close()
Closes all of an applications subsystems.
double vehicleNumber
The number of vehicles.
Definition: ODCell.h:59
static void setArgs(int argc, char **argv)
Stores the command line arguments for later parsing.
Definition: OptionsIO.cpp:61
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:64
void loadMatrix(OptionsCont &oc)
read a matrix in one of several formats
Definition: ODMatrix.cpp:560
void openOutput(const OptionsCont &options)
Opens the output for computed routes.
Definition: RONet.cpp:214
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
A vehicle as used by router.
Definition: ROVehicle.h:59
void cleanup()
closes the file output for computed routes and deletes associated threads if necessary ...
Definition: RONet.cpp:253
static double getTravelTimeStatic(const ROEdge *const edge, const ROVehicle *const veh, double time)
Returns the travel time for the given edge.
Definition: ROEdge.h:404
A single O/D-matrix cell.
Definition: ODCell.h:57
void initNet(RONet &net, ROLoader &loader, OptionsCont &oc)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:55
std::string origin
Name of the origin district.
Definition: ODCell.h:68
Computes the shortest path through a network using the Dijkstra algorithm.
parameter associated to a certain key
An O/D (origin/destination) matrix.
Definition: ODMatrix.h:75
The data loader.
Definition: ROLoader.h:62
SumoXMLEdgeFunc getFunction() const
Returns the function of the edge.
Definition: ROEdge.h:188
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
bool processMetaOptions(bool missingOptions)
Checks for help and configuration output, returns whether we should exit.
#define STEPS2TIME(x)
Definition: SUMOTime.h:64
double getTravelTime(const ROEdge *const edge, const ROVehicle *const, double)
void loadRoutes(OptionsCont &oc, SUMOSAXHandler &handler)
read SUMO routes
Definition: ODMatrix.cpp:606
SUMOTime string2time(const std::string &r)
Definition: SUMOTime.cpp:46
A container for districts.
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) ...
T MIN2(T a, T b)
Definition: StdDefs.h:67
std::map< SUMOTime, std::vector< std::string > > departures
mapping of departure times to departing vehicles, if already fixed
Definition: ODCell.h:80
void writeInterval(OutputDevice &dev, const SUMOTime begin, const SUMOTime end, const RONet &net, const ROVehicle *const veh)
void sortByBeginTime()
Definition: ODMatrix.cpp:648
SUMOTime begin
The begin time this cell describes.
Definition: ODCell.h:62
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
static double getCapacity(const ROEdge *edge)
double getNumLoaded() const
Returns the number of loaded vehicles.
Definition: ODMatrix.cpp:513
virtual void loadNet(RONet &toFill, ROAbstractEdgeBuilder &eb)
Loads the network.
Definition: ROLoader.cpp:119
A basic edge for routing applications.
Definition: ROEdge.h:77
begin/end of the description of an edge
#define VERSION_STRING
Definition: config.h:210
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:205
static void fillOptions()
Inserts options used by duarouter into the OptionsCont-singleton.
Definition: ROMAFrame.cpp:52
static double getPenalizedEffort(const ROEdge *const e, const ROVehicle *const v, double t)
Returns the effort to pass an edge including penalties.
The router&#39;s network representation.
Definition: RONet.h:74
Structure representing possible vehicle parameter.
const NamedObjectCont< ROEdge * > & getEdgeMap() const
Definition: RONet.h:400
static double getTravelTime(const ROEdge *const e, const ROVehicle *const v, double t)
Returns the traveltime on an edge without penalties.
static OutputDevice & getDeviceByOption(const std::string &name)
Returns the device described by the option.
weights: time range end
static const ROEdgeVector & getAllEdges()
Returns all ROEdges.
Definition: ROEdge.cpp:319
double getTravelTime(const ROVehicle *const veh, double time) const
Returns the travel time for this edge.
Definition: ROEdge.cpp:174
void inform(std::string msg, bool addType=true)
adds a new error to the list
Definition: MsgHandler.cpp:84
A storage for options typed value containers)
Definition: OptionsCont.h:98
double getSpeedLimit() const
Returns the speed allowed on this edge.
Definition: ROEdge.h:219
static void initRandGlobal(std::mt19937 *which=0)
Reads the given random number options and initialises the random number generator in accordance...
Definition: RandHelper.cpp:76
void applyCurve(const Distribution_Points &ps)
Splits the stored cells dividing them on the given time line.
Definition: ODMatrix.cpp:547
static double getNoiseEffort(const ROEdge *const edge, const ROVehicle *const veh, double time)
Definition: ROEdge.cpp:198
static void setGlobalOptions(const bool interpolate)
Definition: ROEdge.h:454
description of a vehicle
an aggreagated-output interval
static bool createDeviceByOption(const std::string &optionName, const std::string &rootElement="", const std::string &schemaFile="")
Creates the device using the output definition stored in the named option.
double getFlow(const double time) const
Definition: ROMAEdge.h:92
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:70
std::string destination
Name of the destination district.
Definition: ODCell.h:71
bool closeTag()
Closes the most recently opened tag.
SUMOVTypeParameter * getVehicleTypeSecure(const std::string &id)
Retrieves the named vehicle type.
Definition: RONet.cpp:277
long long int SUMOTime
Definition: TraCIDefs.h:51
IDMap::const_iterator end() const
Returns a reference to the end iterator for the internal map.
SUMOTime end
The end time this cell describes.
Definition: ODCell.h:65
void clear()
Clears information whether an error occured previously.
Definition: MsgHandler.cpp:144
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:200
static void initOutputOptions()
Definition: MsgHandler.cpp:192
A basic edge for routing applications.
Definition: ROMAEdge.h:64
bool isBinary() const
Returns whether we have a binary output.
Definition: OutputDevice.h:248
static std::string _2str(const int var)
convert int to string
Definition: TplConvert.h:56
bool loadWeights(RONet &net, const std::string &optionName, const std::string &measure, const bool useLanes, const bool boundariesOverride)
Loads the net weights.
Definition: ROLoader.cpp:251
vehicles ignoring classes
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
An output device that encapsulates an ofstream.
static double getPenalizedTT(const ROEdge *const e, const ROVehicle *const v, double t)
Returns the traveltime on an edge including penalties.
Distribution_Points parseTimeLine(const std::vector< std::string > &def, bool timelineDayInHours)
split the given timeline
Definition: ODMatrix.cpp:623
Computes the shortest path through a contracted network.
IDMap::const_iterator begin() const
Returns a reference to the begin iterator for the internal map.
void setApplicationName(const std::string &appName, const std::string &fullName)
Sets the application name.