Eclipse 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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
18 // Main for MAROUTER
19 /****************************************************************************/
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 #ifdef HAVE_VERSION_H
28 #include <version.h>
29 #endif
30 
31 #include <iostream>
32 #include <string>
33 #include <limits.h>
34 #include <ctime>
35 #include <vector>
36 #include <xercesc/sax/SAXException.hpp>
37 #include <xercesc/sax/SAXParseException.hpp>
43 #include <utils/common/ToString.h>
47 #include <utils/options/Option.h>
53 #include <utils/router/CHRouter.h>
55 #include <utils/xml/XMLSubSys.h>
56 #include <od/ODCell.h>
57 #include <od/ODDistrict.h>
58 #include <od/ODDistrictCont.h>
59 #include <od/ODDistrictHandler.h>
60 #include <od/ODMatrix.h>
61 #include <router/ROEdge.h>
62 #include <router/ROLoader.h>
63 #include <router/RONet.h>
64 #include <router/RORoute.h>
65 #include <router/RORoutable.h>
66 
67 #include "ROMAFrame.h"
68 #include "ROMAAssignments.h"
69 #include "ROMAEdgeBuilder.h"
70 #include "ROMARouteHandler.h"
71 #include "ROMAEdge.h"
72 
73 
74 // ===========================================================================
75 // functions
76 // ===========================================================================
77 /* -------------------------------------------------------------------------
78  * data processing methods
79  * ----------------------------------------------------------------------- */
85 void
86 initNet(RONet& net, ROLoader& loader, OptionsCont& oc) {
87  // load the net
88  ROMAEdgeBuilder builder;
89  ROEdge::setGlobalOptions(oc.getBool("weights.interpolate"));
90  loader.loadNet(net, builder);
91  // initialize the travel times
92  /* const SUMOTime begin = string2time(oc.getString("begin"));
93  const SUMOTime end = string2time(oc.getString("end"));
94  for (std::map<std::string, ROEdge*>::const_iterator i = net.getEdgeMap().begin(); i != net.getEdgeMap().end(); ++i) {
95  (*i).second->addTravelTime(STEPS2TIME(begin), STEPS2TIME(end), (*i).second->getLength() / (*i).second->getSpeedLimit());
96  }*/
97  // load the weights when wished/available
98  if (oc.isSet("weight-files")) {
99  loader.loadWeights(net, "weight-files", oc.getString("weight-attribute"), false, oc.getBool("weights.expand"));
100  }
101  if (oc.isSet("lane-weight-files")) {
102  loader.loadWeights(net, "lane-weight-files", oc.getString("weight-attribute"), true, oc.getBool("weights.expand"));
103  }
104 }
105 
106 
107 double
108 getTravelTime(const ROEdge* const edge, const ROVehicle* const /* veh */, double /* time */) {
109  return edge->getLength() / edge->getSpeedLimit();
110 }
111 
112 
116 void
118  std::ofstream outFile(oc.getString("all-pairs-output").c_str(), std::ios::binary);
119  // build the router
121  Dijkstra router(ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &getTravelTime);
122  ConstROEdgeVector into;
123  const int numInternalEdges = net.getInternalEdgeNumber();
124  const int numTotalEdges = (int)net.getEdgeNumber();
125  for (int i = numInternalEdges; i < numTotalEdges; i++) {
126  const Dijkstra::EdgeInfo& ei = router.getEdgeInfo(i);
127  if (!ei.edge->isInternal()) {
128  router.compute(ei.edge, nullptr, nullptr, 0, into);
129  double fromEffort = router.getEffort(ei.edge, nullptr, 0);
130  for (int j = numInternalEdges; j < numTotalEdges; j++) {
131  double heuTT = router.getEdgeInfo(j).effort - fromEffort;
132  FileHelpers::writeFloat(outFile, heuTT);
133  /*
134  if (heuTT >
135  ei.edge->getDistanceTo(router.getEdgeInfo(j).edge)
136  && router.getEdgeInfo(j).traveltime != std::numeric_limits<double>::max()
137  ) {
138  std::cout << " heuristic failure: from=" << ei.edge->getID() << " to=" << router.getEdgeInfo(j).edge->getID()
139  << " fromEffort=" << fromEffort << " heuTT=" << heuTT << " airDist=" << ei.edge->getDistanceTo(router.getEdgeInfo(j).edge) << "\n";
140  }
141  */
142  }
143  }
144  }
145 }
146 
147 
151 void
152 writeInterval(OutputDevice& dev, const SUMOTime begin, const SUMOTime end, const RONet& net, const ROVehicle* const veh) {
154  for (std::map<std::string, ROEdge*>::const_iterator i = net.getEdgeMap().begin(); i != net.getEdgeMap().end(); ++i) {
155  ROMAEdge* edge = static_cast<ROMAEdge*>(i->second);
156  if (edge->getFunction() == EDGEFUNC_NORMAL) {
158  const double traveltime = edge->getTravelTime(veh, STEPS2TIME(begin));
159  const double flow = edge->getFlow(STEPS2TIME(begin));
160  dev.writeAttr("traveltime", traveltime);
161  dev.writeAttr("speed", edge->getLength() / traveltime);
162  dev.writeAttr("entered", flow);
163  dev.writeAttr("flowCapacityRatio", 100. * flow / ROMAAssignments::getCapacity(edge));
164  dev.closeTag();
165  }
166  }
167  dev.closeTag();
168 }
169 
170 
174 void
176  // build the router
177  SUMOAbstractRouter<ROEdge, ROVehicle>* router = nullptr;
178  const std::string measure = oc.getString("weight-attribute");
179  const std::string routingAlgorithm = oc.getString("routing-algorithm");
180  const SUMOTime begin = string2time(oc.getString("begin"));
181  const SUMOTime end = string2time(oc.getString("end"));
182  if (measure == "traveltime") {
183  if (routingAlgorithm == "dijkstra") {
184  if (net.hasPermissions()) {
185  if (oc.getInt("paths") > 1) {
188  } else {
190  ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &ROEdge::getTravelTimeStatic);
191  }
192  } else {
193  if (oc.getInt("paths") > 1) {
196  } else {
198  ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &ROEdge::getTravelTimeStatic);
199  }
200  }
201  } else if (routingAlgorithm == "astar") {
202  if (net.hasPermissions()) {
203  if (oc.getInt("paths") > 1) {
206  } else {
208  ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &ROEdge::getTravelTimeStatic);
209  }
210  } else {
211  if (oc.getInt("paths") > 1) {
214  } else {
216  ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &ROEdge::getTravelTimeStatic);
217  }
218  }
219  } else if (routingAlgorithm == "CH") {
220  const SUMOTime weightPeriod = (oc.isSet("weight-files") ?
221  string2time(oc.getString("weight-period")) :
222  std::numeric_limits<int>::max());
223  if (net.hasPermissions()) {
225  ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &ROEdge::getTravelTimeStatic, SVC_IGNORING, weightPeriod, true);
226  } else {
228  ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &ROEdge::getTravelTimeStatic, SVC_IGNORING, weightPeriod, false);
229  }
230  } else if (routingAlgorithm == "CHWrapper") {
231  const SUMOTime weightPeriod = (oc.isSet("weight-files") ?
232  string2time(oc.getString("weight-period")) :
233  std::numeric_limits<int>::max());
236  begin, end, weightPeriod, oc.getInt("routing-threads"));
237  } else {
238  throw ProcessError("Unknown routing Algorithm '" + routingAlgorithm + "'!");
239  }
240 
241  } else {
243  if (measure == "CO") {
244  op = &ROEdge::getEmissionEffort<PollutantsInterface::CO>;
245  } else if (measure == "CO2") {
246  op = &ROEdge::getEmissionEffort<PollutantsInterface::CO2>;
247  } else if (measure == "PMx") {
248  op = &ROEdge::getEmissionEffort<PollutantsInterface::PM_X>;
249  } else if (measure == "HC") {
250  op = &ROEdge::getEmissionEffort<PollutantsInterface::HC>;
251  } else if (measure == "NOx") {
252  op = &ROEdge::getEmissionEffort<PollutantsInterface::NO_X>;
253  } else if (measure == "fuel") {
254  op = &ROEdge::getEmissionEffort<PollutantsInterface::FUEL>;
255  } else if (measure == "electricity") {
256  op = &ROEdge::getEmissionEffort<PollutantsInterface::ELEC>;
257  } else if (measure == "noise") {
259  } else {
260  throw ProcessError("Unknown measure (weight attribute '" + measure + "')!");
261  }
262  if (net.hasPermissions()) {
263  if (oc.getInt("paths") > 1) {
266  } else {
268  ROEdge::getAllEdges(), oc.getBool("ignore-errors"), op, &ROEdge::getTravelTimeStatic);
269  }
270  } else {
271  if (oc.getInt("paths") > 1) {
274  } else {
276  ROEdge::getAllEdges(), oc.getBool("ignore-errors"), op, &ROEdge::getTravelTimeStatic);
277  }
278  }
279  }
280  try {
281  const RORouterProvider provider(router, nullptr, nullptr);
282  // prepare the output
283  net.openOutput(oc);
284  // process route definitions
285  if (oc.isSet("timeline")) {
286  matrix.applyCurve(matrix.parseTimeLine(oc.getStringVector("timeline"), oc.getBool("timeline.day-in-hours")));
287  }
288  matrix.sortByBeginTime();
289  ROVehicle defaultVehicle(SUMOVehicleParameter(), nullptr, net.getVehicleTypeSecure(DEFAULT_VTYPE_ID), &net);
290  ROMAAssignments a(begin, end, oc.getBool("additive-traffic"), oc.getFloat("weight-adaption"), oc.getInt("max-alternatives"), net, matrix, *router);
291  a.resetFlows();
292 #ifdef HAVE_FOX
293  const int maxNumThreads = oc.getInt("routing-threads");
294  while ((int)net.getThreadPool().size() < maxNumThreads) {
295  new RONet::WorkerThread(net.getThreadPool(), provider);
296  }
297 #endif
298  std::string assignMethod = oc.getString("assignment-method");
299  if (assignMethod == "UE") {
300  WRITE_WARNING("Deterministic user equilibrium ('UE') is not implemented yet, using stochastic method ('SUE').");
301  assignMethod = "SUE";
302  }
303  if (assignMethod == "incremental") {
304  a.incremental(oc.getInt("max-iterations"), oc.getBool("verbose"));
305  } else if (assignMethod == "SUE") {
306  a.sue(oc.getInt("max-iterations"), oc.getInt("max-inner-iterations"),
307  oc.getInt("paths"), oc.getFloat("paths.penalty"), oc.getFloat("tolerance"), oc.getString("route-choice-method"));
308  }
309  // update path costs and output
310  bool haveOutput = false;
311  OutputDevice* dev = net.getRouteOutput();
312  if (dev != nullptr) {
313  std::vector<std::string> tazParamKeys;
314  if (oc.isSet("taz-param")) {
315  tazParamKeys = oc.getStringVector("taz-param");
316  }
317  std::map<SUMOTime, std::string> sortedOut;
318  SUMOTime lastEnd = -1;
319  int num = 0;
320  for (const ODCell* const c : matrix.getCells()) {
321  if (c->begin >= end || c->end <= begin ||
322  c->pathsVector.empty() || c->pathsVector.front()->getEdgeVector().empty()) {
323  continue;
324  }
325  if (lastEnd >= 0 && lastEnd <= c->begin) {
326  for (std::map<SUMOTime, std::string>::const_iterator desc = sortedOut.begin(); desc != sortedOut.end(); ++desc) {
327  dev->writePreformattedTag(desc->second);
328  }
329  sortedOut.clear();
330  }
331  if (c->departures.empty()) {
332  const SUMOTime b = MAX2(begin, c->begin);
333  const SUMOTime e = MIN2(end, c->end);
334  const int numVehs = int(c->vehicleNumber * (e - b) / (c->end - c->begin));
335  OutputDevice_String od(dev->isBinary(), 1);
336  od.openTag(SUMO_TAG_FLOW).writeAttr(SUMO_ATTR_ID, oc.getString("prefix") + toString(num++));
338  od.writeAttr(SUMO_ATTR_NUMBER, numVehs);
339  matrix.writeDefaultAttrs(od, oc.getBool("ignore-vehicle-type"), c);
341  for (RORoute* const r : c->pathsVector) {
342  r->setCosts(router->recomputeCosts(r->getEdgeVector(), &defaultVehicle, begin));
343  r->writeXMLDefinition(od, nullptr, true, false);
344  }
345  od.closeTag();
346  od.closeTag();
347  sortedOut[c->begin] += od.getString();
348  } else {
349  for (std::map<SUMOTime, std::vector<std::string> >::const_iterator deps = c->departures.begin(); deps != c->departures.end(); ++deps) {
350  if (deps->first >= end || deps->first < begin) {
351  continue;
352  }
353  const std::string routeDistId = c->origin + "_" + c->destination + "_" + time2string(c->begin) + "_" + time2string(c->end);
354  for (const std::string& id : deps->second) {
355  OutputDevice_String od(dev->isBinary(), 1);
357  matrix.writeDefaultAttrs(od, oc.getBool("ignore-vehicle-type"), c);
359  for (RORoute* const r : c->pathsVector) {
360  r->setCosts(router->recomputeCosts(r->getEdgeVector(), &defaultVehicle, begin));
361  r->writeXMLDefinition(od, nullptr, true, false);
362  }
363  od.closeTag();
364  if (!tazParamKeys.empty()) {
365  od.openTag(SUMO_TAG_PARAM).writeAttr(SUMO_ATTR_KEY, tazParamKeys[0]).writeAttr(SUMO_ATTR_VALUE, c->origin).closeTag();
366  if (tazParamKeys.size() > 1) {
367  od.openTag(SUMO_TAG_PARAM).writeAttr(SUMO_ATTR_KEY, tazParamKeys[1]).writeAttr(SUMO_ATTR_VALUE, c->destination).closeTag();
368  }
369  }
370  od.closeTag();
371  sortedOut[deps->first] += od.getString();
372  }
373  }
374  }
375  for (std::vector<RORoute*>::const_iterator j = c->pathsVector.begin(); j != c->pathsVector.end(); ++j) {
376  delete *j;
377  }
378  if (c->end > lastEnd) {
379  lastEnd = c->end;
380  }
381  }
382  for (std::map<SUMOTime, std::string>::const_iterator desc = sortedOut.begin(); desc != sortedOut.end(); ++desc) {
383  dev->writePreformattedTag(desc->second);
384  }
385  haveOutput = true;
386  }
387  if (OutputDevice::createDeviceByOption("netload-output", "meandata")) {
388  if (oc.getBool("additive-traffic")) {
389  writeInterval(OutputDevice::getDeviceByOption("netload-output"), begin, end, net, a.getDefaultVehicle());
390  } else {
391  SUMOTime lastCell = 0;
392  for (std::vector<ODCell*>::const_iterator i = matrix.getCells().begin(); i != matrix.getCells().end(); ++i) {
393  if ((*i)->end > lastCell) {
394  lastCell = (*i)->end;
395  }
396  }
397  const SUMOTime interval = string2time(OptionsCont::getOptions().getString("aggregation-interval"));
398  for (SUMOTime start = begin; start < MIN2(end, lastCell); start += interval) {
399  writeInterval(OutputDevice::getDeviceByOption("netload-output"), start, start + interval, net, a.getDefaultVehicle());
400  }
401  }
402  haveOutput = true;
403  }
404  if (!haveOutput) {
405  throw ProcessError("No output file given.");
406  }
407  // end the processing
408  net.cleanup();
409  } catch (ProcessError&) {
410  for (std::vector<ODCell*>::const_iterator i = matrix.getCells().begin(); i != matrix.getCells().end(); ++i) {
411  for (std::vector<RORoute*>::const_iterator j = (*i)->pathsVector.begin(); j != (*i)->pathsVector.end(); ++j) {
412  delete *j;
413  }
414  }
415  net.cleanup();
416  throw;
417  }
418 }
419 
420 
421 /* -------------------------------------------------------------------------
422  * main
423  * ----------------------------------------------------------------------- */
424 int
425 main(int argc, char** argv) {
427  oc.setApplicationDescription("Import O/D-matrices for macroscopic traffic assignment to generate SUMO routes");
428  oc.setApplicationName("marouter", "Eclipse SUMO marouter Version " VERSION_STRING);
429  int ret = 0;
430  RONet* net = nullptr;
431  try {
432  XMLSubSys::init();
434  OptionsIO::setArgs(argc, argv);
436  if (oc.processMetaOptions(argc < 2)) {
438  return 0;
439  }
440  XMLSubSys::setValidation(oc.getString("xml-validation"), oc.getString("xml-validation.net"));
443  throw ProcessError();
444  }
446  // load data
447  ROLoader loader(oc, false, false);
448  net = new RONet();
449  initNet(*net, loader, oc);
450  if (oc.isSet("all-pairs-output")) {
451  computeAllPairs(*net, oc);
452  if (net->getDistricts().empty()) {
453  delete net;
455  if (ret == 0) {
456  std::cout << "Success." << std::endl;
457  }
458  return ret;
459  }
460  }
461  if (net->getDistricts().empty()) {
462  WRITE_WARNING("No districts loaded, will use edge ids!");
463  }
464  // load districts
465  ODDistrictCont districts;
466  districts.makeDistricts(net->getDistricts());
467  // load the matrix
468  ODMatrix matrix(districts);
469  matrix.loadMatrix(oc);
470  ROMARouteHandler handler(matrix);
471  matrix.loadRoutes(oc, handler);
472  if (matrix.getNumLoaded() == matrix.getNumDiscarded()) {
473  throw ProcessError("No valid vehicles loaded.");
474  }
475  if (MsgHandler::getErrorInstance()->wasInformed() && !oc.getBool("ignore-errors")) {
476  throw ProcessError("Loading failed.");
477  }
479  WRITE_MESSAGE(toString(matrix.getNumLoaded() - matrix.getNumDiscarded()) + " valid vehicles loaded (total seen: " + toString(matrix.getNumLoaded()) + ").");
480 
481  // build routes and parse the incremental rates if the incremental method is choosen.
482  try {
483  computeRoutes(*net, oc, matrix);
484  } catch (XERCES_CPP_NAMESPACE::SAXParseException& e) {
485  WRITE_ERROR(toString(e.getLineNumber()));
486  ret = 1;
487  } catch (XERCES_CPP_NAMESPACE::SAXException& e) {
488  WRITE_ERROR(StringUtils::transcode(e.getMessage()));
489  ret = 1;
490  }
491  if (MsgHandler::getErrorInstance()->wasInformed() || ret != 0) {
492  throw ProcessError();
493  }
494  } catch (const ProcessError& e) {
495  if (std::string(e.what()) != std::string("Process Error") && std::string(e.what()) != std::string("")) {
496  WRITE_ERROR(e.what());
497  }
498  MsgHandler::getErrorInstance()->inform("Quitting (on error).", false);
499  ret = 1;
500  }
501 
502  delete net;
504  if (ret == 0) {
505  std::cout << "Success." << std::endl;
506  }
507  return ret;
508 }
509 
510 
511 
512 /****************************************************************************/
513 
Computes the shortest path through a contracted network.
Definition: CHRouter.h:63
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:256
int getEdgeNumber() const
Returns the total number of edges the network contains including internal edges.
Definition: RONet.cpp:649
const std::vector< ODCell * > & getCells()
Definition: ODMatrix.h:246
static void init()
Initialises the xml-subsystem.
Definition: XMLSubSys.cpp:48
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
Definition: MsgHandler.cpp:81
long long int SUMOTime
Definition: SUMOTime.h:35
OutputDevice * getRouteOutput(const bool alternative=false)
Definition: RONet.h:403
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:76
int getInternalEdgeNumber() const
Returns the number of internal edges the network contains.
Definition: RONet.cpp:655
assignment methods
a flow definitio nusing a from-to edges instead of a route (used by router)
static void setValidation(const std::string &validationScheme, const std::string &netValidationScheme)
Enables or disables validation.
Definition: XMLSubSys.cpp:59
distribution of a route
Interface for building instances of duarouter-edges.
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:302
std::string time2string(SUMOTime t)
Definition: SUMOTime.cpp:65
Computes the shortest path through a network using the A* algorithm.
Definition: AStarRouter.h:78
weights: time range begin
static bool checkOptions()
Checks set options from the OptionsCont-singleton for being valid for usage within duarouter...
Definition: ROMAFrame.cpp:285
T MAX2(T a, T b)
Definition: StdDefs.h:80
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:141
void computeAllPairs(RONet &net, OptionsCont &oc)
bool hasPermissions() const
Definition: RONet.cpp:693
double getLength() const
Returns the length of the edge.
Definition: ROEdge.h:203
std::vector< const ROEdge * > ConstROEdgeVector
Definition: ROEdge.h:57
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:77
const std::string DEFAULT_VTYPE_ID
static void close()
Closes all of an applications subsystems.
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:239
static void setArgs(int argc, char **argv)
Stores the command line arguments for later parsing.
Definition: OptionsIO.cpp:55
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
void loadMatrix(OptionsCont &oc)
read a matrix in one of several formats
Definition: ODMatrix.cpp:606
static std::string transcode(const XMLCh *const data)
converts a 0-terminated XMLCh* array (usually UTF-16, stemming from Xerces) into std::string in UTF-8...
Definition: StringUtils.h:132
void openOutput(const OptionsCont &options)
Opens the output for computed routes.
Definition: RONet.cpp:215
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:53
void cleanup()
closes the file output for computed routes and deletes associated threads if necessary ...
Definition: RONet.cpp:255
static double getTravelTimeStatic(const ROEdge *const edge, const ROVehicle *const veh, double time)
Returns the travel time for the given edge.
Definition: ROEdge.h:396
A single O/D-matrix cell.
Definition: ODCell.h:51
void initNet(RONet &net, ROLoader &loader, OptionsCont &oc)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:48
Computes the shortest path through a network using the Dijkstra algorithm.
double recomputeCosts(const std::vector< const E *> &edges, const V *const v, SUMOTime msTime, double *lengthp=nullptr) const
parameter associated to a certain key
An O/D (origin/destination) matrix.
Definition: ODMatrix.h:69
The data loader.
Definition: ROLoader.h:56
SumoXMLEdgeFunc getFunction() const
Returns the function of the edge.
Definition: ROEdge.h:187
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:57
double getTravelTime(const ROEdge *const edge, const ROVehicle *const, double)
void loadRoutes(OptionsCont &oc, SUMOSAXHandler &handler)
read SUMO routes
Definition: ODMatrix.cpp:652
SUMOTime string2time(const std::string &r)
Definition: SUMOTime.cpp:42
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:74
static bool checkOptions()
checks shared options and sets StdDefs
void writeInterval(OutputDevice &dev, const SUMOTime begin, const SUMOTime end, const RONet &net, const ROVehicle *const veh)
void sortByBeginTime()
Definition: ODMatrix.cpp:694
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:559
virtual void loadNet(RONet &toFill, ROAbstractEdgeBuilder &eb)
Loads the network.
Definition: ROLoader.cpp:114
A basic edge for routing applications.
Definition: ROEdge.h:73
begin/end of the description of an edge
#define VERSION_STRING
Definition: config.h:207
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:245
static void fillOptions()
Inserts options used by duarouter into the OptionsCont-singleton.
Definition: ROMAFrame.cpp:46
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:64
Structure representing possible vehicle parameter.
const NamedObjectCont< ROEdge * > & getEdgeMap() const
Definition: RONet.h:393
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:336
double getTravelTime(const ROVehicle *const veh, double time) const
Returns the travel time for this edge.
Definition: ROEdge.cpp:184
void setCosts(double costs)
Sets the costs of the route.
Definition: RORoute.cpp:66
const ConstROEdgeVector & getEdgeVector() const
Returns the list of edges this route consists of.
Definition: RORoute.h:155
virtual void inform(std::string msg, bool addType=true)
adds a new error to the list
Definition: MsgHandler.cpp:118
A storage for options typed value containers)
Definition: OptionsCont.h:90
double getSpeedLimit() const
Returns the speed allowed on this edge.
Definition: ROEdge.h:218
static void initRandGlobal(std::mt19937 *which=0)
Reads the given random number options and initialises the random number generator in accordance...
Definition: RandHelper.cpp:72
void applyCurve(const Distribution_Points &ps)
Splits the stored cells dividing them on the given time line.
Definition: ODMatrix.cpp:593
static double getNoiseEffort(const ROEdge *const edge, const ROVehicle *const veh, double time)
Definition: ROEdge.cpp:209
static void setGlobalOptions(const bool interpolate)
Definition: ROEdge.h:450
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:86
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
SUMOVTypeParameter * getVehicleTypeSecure(const std::string &id)
Retrieves the named vehicle type.
Definition: RONet.cpp:279
double getNumDiscarded() const
Returns the number of discarded vehicles.
Definition: ODMatrix.cpp:571
IDMap::const_iterator end() const
Returns a reference to the end iterator for the internal map.
virtual void clear()
Clears information whether an error occurred previously.
Definition: MsgHandler.cpp:160
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:240
static void initOutputOptions()
init output options
Definition: MsgHandler.cpp:208
A basic edge for routing applications.
Definition: ROMAEdge.h:58
bool isBinary() const
Returns whether we have a binary output.
Definition: OutputDevice.h:244
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:247
OutputDevice & writeXMLDefinition(OutputDevice &dev, const ROVehicle *const veh, const bool withCosts, const bool withExitTimes) const
Definition: RORoute.cpp:89
vehicles ignoring classes
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
A complete router&#39;s route.
Definition: RORoute.h:55
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:669
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.