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-2018 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/vehicle/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 double
107 getTravelTime(const ROEdge* const edge, const ROVehicle* const /* veh */, double /* time */) {
108  return edge->getLength() / edge->getSpeedLimit();
109 }
110 
111 
115 void
117  std::ofstream outFile(oc.getString("all-pairs-output").c_str(), std::ios::binary);
118  // build the router
120  Dijkstra router(ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &getTravelTime);
121  ConstROEdgeVector into;
122  const int numInternalEdges = net.getInternalEdgeNumber();
123  const int numTotalEdges = (int)net.getEdgeNumber();
124  for (int i = numInternalEdges; i < numTotalEdges; i++) {
125  const Dijkstra::EdgeInfo& ei = router.getEdgeInfo(i);
126  if (!ei.edge->isInternal()) {
127  router.compute(ei.edge, nullptr, nullptr, 0, into);
128  double fromEffort = router.getEffort(ei.edge, nullptr, 0);
129  for (int j = numInternalEdges; j < numTotalEdges; j++) {
130  double heuTT = router.getEdgeInfo(j).effort - fromEffort;
131  FileHelpers::writeFloat(outFile, heuTT);
132  /*
133  if (heuTT >
134  ei.edge->getDistanceTo(router.getEdgeInfo(j).edge)
135  && router.getEdgeInfo(j).traveltime != std::numeric_limits<double>::max()
136  ) {
137  std::cout << " heuristic failure: from=" << ei.edge->getID() << " to=" << router.getEdgeInfo(j).edge->getID()
138  << " fromEffort=" << fromEffort << " heuTT=" << heuTT << " airDist=" << ei.edge->getDistanceTo(router.getEdgeInfo(j).edge) << "\n";
139  }
140  */
141  }
142  }
143  }
144 }
145 
146 
150 void
151 writeInterval(OutputDevice& dev, const SUMOTime begin, const SUMOTime end, const RONet& net, const ROVehicle* const veh) {
153  for (std::map<std::string, ROEdge*>::const_iterator i = net.getEdgeMap().begin(); i != net.getEdgeMap().end(); ++i) {
154  ROMAEdge* edge = static_cast<ROMAEdge*>(i->second);
155  if (edge->getFunction() == EDGEFUNC_NORMAL) {
157  const double traveltime = edge->getTravelTime(veh, STEPS2TIME(begin));
158  const double flow = edge->getFlow(STEPS2TIME(begin));
159  dev.writeAttr("traveltime", traveltime);
160  dev.writeAttr("speed", edge->getLength() / traveltime);
161  dev.writeAttr("entered", flow);
162  dev.writeAttr("flowCapacityRatio", 100. * flow / ROMAAssignments::getCapacity(edge));
163  dev.closeTag();
164  }
165  }
166  dev.closeTag();
167 }
168 
169 
173 void
175  // build the router
176  SUMOAbstractRouter<ROEdge, ROVehicle>* router = nullptr;
177  const std::string measure = oc.getString("weight-attribute");
178  const std::string routingAlgorithm = oc.getString("routing-algorithm");
179  const SUMOTime begin = string2time(oc.getString("begin"));
180  const SUMOTime end = string2time(oc.getString("end"));
181  if (measure == "traveltime") {
182  if (routingAlgorithm == "dijkstra") {
183  if (net.hasPermissions()) {
184  if (oc.getInt("paths") > 1) {
187  } else {
189  ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &ROEdge::getTravelTimeStatic);
190  }
191  } else {
192  if (oc.getInt("paths") > 1) {
195  } else {
197  ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &ROEdge::getTravelTimeStatic);
198  }
199  }
200  } else if (routingAlgorithm == "astar") {
201  if (net.hasPermissions()) {
202  if (oc.getInt("paths") > 1) {
205  } else {
207  ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &ROEdge::getTravelTimeStatic);
208  }
209  } else {
210  if (oc.getInt("paths") > 1) {
213  } else {
215  ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &ROEdge::getTravelTimeStatic);
216  }
217  }
218  } else if (routingAlgorithm == "CH") {
219  const SUMOTime weightPeriod = (oc.isSet("weight-files") ?
220  string2time(oc.getString("weight-period")) :
221  std::numeric_limits<int>::max());
222  if (net.hasPermissions()) {
224  ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &ROEdge::getTravelTimeStatic, SVC_IGNORING, weightPeriod, true);
225  } else {
227  ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &ROEdge::getTravelTimeStatic, SVC_IGNORING, weightPeriod, false);
228  }
229  } else if (routingAlgorithm == "CHWrapper") {
230  const SUMOTime weightPeriod = (oc.isSet("weight-files") ?
231  string2time(oc.getString("weight-period")) :
232  std::numeric_limits<int>::max());
235  begin, end, weightPeriod, oc.getInt("routing-threads"));
236  } else {
237  throw ProcessError("Unknown routing Algorithm '" + routingAlgorithm + "'!");
238  }
239 
240  } else {
242  if (measure == "CO") {
243  op = &ROEdge::getEmissionEffort<PollutantsInterface::CO>;
244  } else if (measure == "CO2") {
245  op = &ROEdge::getEmissionEffort<PollutantsInterface::CO2>;
246  } else if (measure == "PMx") {
247  op = &ROEdge::getEmissionEffort<PollutantsInterface::PM_X>;
248  } else if (measure == "HC") {
249  op = &ROEdge::getEmissionEffort<PollutantsInterface::HC>;
250  } else if (measure == "NOx") {
251  op = &ROEdge::getEmissionEffort<PollutantsInterface::NO_X>;
252  } else if (measure == "fuel") {
253  op = &ROEdge::getEmissionEffort<PollutantsInterface::FUEL>;
254  } else if (measure == "electricity") {
255  op = &ROEdge::getEmissionEffort<PollutantsInterface::ELEC>;
256  } else if (measure == "noise") {
258  } else {
259  throw ProcessError("Unknown measure (weight attribute '" + measure + "')!");
260  }
261  if (net.hasPermissions()) {
262  if (oc.getInt("paths") > 1) {
265  } else {
267  ROEdge::getAllEdges(), oc.getBool("ignore-errors"), op, &ROEdge::getTravelTimeStatic);
268  }
269  } else {
270  if (oc.getInt("paths") > 1) {
273  } else {
275  ROEdge::getAllEdges(), oc.getBool("ignore-errors"), op, &ROEdge::getTravelTimeStatic);
276  }
277  }
278  }
279  try {
280  const RORouterProvider provider(router, nullptr, nullptr);
281  // prepare the output
282  net.openOutput(oc);
283  // process route definitions
284  if (oc.isSet("timeline")) {
285  matrix.applyCurve(matrix.parseTimeLine(oc.getStringVector("timeline"), oc.getBool("timeline.day-in-hours")));
286  }
287  matrix.sortByBeginTime();
288  ROVehicle defaultVehicle(SUMOVehicleParameter(), nullptr, net.getVehicleTypeSecure(DEFAULT_VTYPE_ID), &net);
289  ROMAAssignments a(begin, end, oc.getBool("additive-traffic"), oc.getFloat("weight-adaption"), net, matrix, *router);
290  a.resetFlows();
291 #ifdef HAVE_FOX
292  const int maxNumThreads = oc.getInt("routing-threads");
293  while ((int)net.getThreadPool().size() < maxNumThreads) {
294  new RONet::WorkerThread(net.getThreadPool(), provider);
295  }
296 #endif
297  const std::string assignMethod = oc.getString("assignment-method");
298  if (assignMethod == "incremental") {
299  a.incremental(oc.getInt("max-iterations"), oc.getBool("verbose"));
300  } else if (assignMethod == "SUE") {
301  a.sue(oc.getInt("max-iterations"), oc.getInt("max-inner-iterations"),
302  oc.getInt("paths"), oc.getFloat("paths.penalty"), oc.getFloat("tolerance"), oc.getString("route-choice-method"));
303  }
304  // update path costs and output
305  bool haveOutput = false;
306  OutputDevice* dev = net.getRouteOutput();
307  if (dev != nullptr) {
308  std::vector<std::string> tazParamKeys;
309  if (oc.isSet("taz-param")) {
310  tazParamKeys = oc.getStringVector("taz-param");
311  }
312  std::map<SUMOTime, std::string> sortedOut;
313  SUMOTime lastEnd = -1;
314  int num = 0;
315  for (std::vector<ODCell*>::const_iterator i = matrix.getCells().begin(); i != matrix.getCells().end(); ++i) {
316  const ODCell* const c = *i;
317  if (lastEnd >= 0 && lastEnd <= c->begin) {
318  for (std::map<SUMOTime, std::string>::const_iterator desc = sortedOut.begin(); desc != sortedOut.end(); ++desc) {
319  dev->writePreformattedTag(desc->second);
320  }
321  sortedOut.clear();
322  }
323  if (c->departures.empty()) {
324  OutputDevice_String od(dev->isBinary(), 1);
325  od.openTag(SUMO_TAG_FLOW).writeAttr(SUMO_ATTR_ID, oc.getString("prefix") + toString(num++));
328  matrix.writeDefaultAttrs(od, oc.getBool("ignore-vehicle-type"), c);
330  for (std::vector<RORoute*>::const_iterator j = c->pathsVector.begin(); j != c->pathsVector.end(); ++j) {
331  (*j)->setCosts(router->recomputeCosts((*j)->getEdgeVector(), &defaultVehicle, string2time(oc.getString("begin"))));
332  (*j)->writeXMLDefinition(od, nullptr, true, false);
333  }
334  od.closeTag();
335  od.closeTag();
336  sortedOut[c->begin] += od.getString();
337  } else {
338  for (std::map<SUMOTime, std::vector<std::string> >::const_iterator deps = c->departures.begin(); deps != c->departures.end(); ++deps) {
339  const std::string routeDistId = c->origin + "_" + c->destination + "_" + time2string(c->begin) + "_" + time2string(c->end);
340  for (std::vector<std::string>::const_iterator id = deps->second.begin(); id != deps->second.end(); ++id) {
341  OutputDevice_String od(dev->isBinary(), 1);
343  matrix.writeDefaultAttrs(od, oc.getBool("ignore-vehicle-type"), c);
345  for (std::vector<RORoute*>::const_iterator j = c->pathsVector.begin(); j != c->pathsVector.end(); ++j) {
346  (*j)->setCosts(router->recomputeCosts((*j)->getEdgeVector(), &defaultVehicle, string2time(oc.getString("begin"))));
347  (*j)->writeXMLDefinition(od, nullptr, true, false);
348  }
349  od.closeTag();
350  if (!tazParamKeys.empty()) {
351  od.openTag(SUMO_TAG_PARAM).writeAttr(SUMO_ATTR_KEY, tazParamKeys[0]).writeAttr(SUMO_ATTR_VALUE, c->origin).closeTag();
352  if (tazParamKeys.size() > 1) {
353  od.openTag(SUMO_TAG_PARAM).writeAttr(SUMO_ATTR_KEY, tazParamKeys[1]).writeAttr(SUMO_ATTR_VALUE, c->destination).closeTag();
354  }
355  }
356  od.closeTag();
357  sortedOut[deps->first] += od.getString();
358  }
359  }
360  }
361  for (std::vector<RORoute*>::const_iterator j = c->pathsVector.begin(); j != c->pathsVector.end(); ++j) {
362  delete *j;
363  }
364  if (c->end > lastEnd) {
365  lastEnd = c->end;
366  }
367  }
368  for (std::map<SUMOTime, std::string>::const_iterator desc = sortedOut.begin(); desc != sortedOut.end(); ++desc) {
369  dev->writePreformattedTag(desc->second);
370  }
371  haveOutput = true;
372  }
373  if (OutputDevice::createDeviceByOption("netload-output", "meandata")) {
374  if (oc.getBool("additive-traffic")) {
375  writeInterval(OutputDevice::getDeviceByOption("netload-output"), begin, end, net, a.getDefaultVehicle());
376  } else {
377  SUMOTime lastCell = 0;
378  for (std::vector<ODCell*>::const_iterator i = matrix.getCells().begin(); i != matrix.getCells().end(); ++i) {
379  if ((*i)->end > lastCell) {
380  lastCell = (*i)->end;
381  }
382  }
383  const SUMOTime interval = string2time(OptionsCont::getOptions().getString("aggregation-interval"));
384  for (SUMOTime start = begin; start < MIN2(end, lastCell); start += interval) {
385  writeInterval(OutputDevice::getDeviceByOption("netload-output"), start, start + interval, net, a.getDefaultVehicle());
386  }
387  }
388  haveOutput = true;
389  }
390  if (!haveOutput) {
391  throw ProcessError("No output file given.");
392  }
393  // end the processing
394  net.cleanup();
395  } catch (ProcessError&) {
396  for (std::vector<ODCell*>::const_iterator i = matrix.getCells().begin(); i != matrix.getCells().end(); ++i) {
397  for (std::vector<RORoute*>::const_iterator j = (*i)->pathsVector.begin(); j != (*i)->pathsVector.end(); ++j) {
398  delete *j;
399  }
400  }
401  net.cleanup();
402  throw;
403  }
404 }
405 
406 
407 /* -------------------------------------------------------------------------
408  * main
409  * ----------------------------------------------------------------------- */
410 int
411 main(int argc, char** argv) {
413  oc.setApplicationDescription("Import O/D-matrices for macroscopic traffic assignment to generate SUMO routes");
414  oc.setApplicationName("marouter", "Eclipse SUMO marouter Version " VERSION_STRING);
415  int ret = 0;
416  RONet* net = nullptr;
417  try {
418  XMLSubSys::init();
420  OptionsIO::setArgs(argc, argv);
422  if (oc.processMetaOptions(argc < 2)) {
424  return 0;
425  }
426  XMLSubSys::setValidation(oc.getString("xml-validation"), oc.getString("xml-validation.net"));
429  throw ProcessError();
430  }
432  // load data
433  ROLoader loader(oc, false, false);
434  net = new RONet();
435  initNet(*net, loader, oc);
436  if (oc.isSet("all-pairs-output")) {
437  computeAllPairs(*net, oc);
438  if (net->getDistricts().empty()) {
439  delete net;
441  if (ret == 0) {
442  std::cout << "Success." << std::endl;
443  }
444  return ret;
445  }
446  }
447  if (net->getDistricts().empty()) {
448  throw ProcessError("No districts loaded.");
449  }
450  // load districts
451  ODDistrictCont districts;
452  districts.makeDistricts(net->getDistricts());
453  // load the matrix
454  ODMatrix matrix(districts);
455  matrix.loadMatrix(oc);
456  ROMARouteHandler handler(matrix);
457  matrix.loadRoutes(oc, handler);
458  if (matrix.getNumLoaded() == 0) {
459  throw ProcessError("No vehicles loaded.");
460  }
461  if (MsgHandler::getErrorInstance()->wasInformed() && !oc.getBool("ignore-errors")) {
462  throw ProcessError("Loading failed.");
463  }
465  WRITE_MESSAGE(toString(matrix.getNumLoaded()) + " vehicles loaded.");
466 
467  // build routes and parse the incremental rates if the incremental method is choosen.
468  try {
469  computeRoutes(*net, oc, matrix);
470  } catch (XERCES_CPP_NAMESPACE::SAXParseException& e) {
471  WRITE_ERROR(toString(e.getLineNumber()));
472  ret = 1;
473  } catch (XERCES_CPP_NAMESPACE::SAXException& e) {
474  WRITE_ERROR(StringUtils::transcode(e.getMessage()));
475  ret = 1;
476  }
477  if (MsgHandler::getErrorInstance()->wasInformed() || ret != 0) {
478  throw ProcessError();
479  }
480  } catch (const ProcessError& e) {
481  if (std::string(e.what()) != std::string("Process Error") && std::string(e.what()) != std::string("")) {
482  WRITE_ERROR(e.what());
483  }
484  MsgHandler::getErrorInstance()->inform("Quitting (on error).", false);
485  ret = 1;
486  }
487 
488  delete net;
490  if (ret == 0) {
491  std::cout << "Success." << std::endl;
492  }
493  return ret;
494 }
495 
496 
497 
498 /****************************************************************************/
499 
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:647
const std::vector< ODCell * > & getCells()
Definition: ODMatrix.h:240
static void init()
Initialises the xml-subsystem.
Definition: XMLSubSys.cpp:48
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
Definition: MsgHandler.cpp:76
long long int SUMOTime
Definition: SUMOTime.h:36
OutputDevice * getRouteOutput(const bool alternative=false)
Definition: RONet.h:407
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:653
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: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
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:145
void computeAllPairs(RONet &net, OptionsCont &oc)
bool hasPermissions() const
Definition: RONet.cpp:691
double getLength() const
Returns the length of the edge.
Definition: ROEdge.h:199
std::vector< const ROEdge * > ConstROEdgeVector
Definition: ROEdge.h:56
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:78
std::vector< RORoute * > pathsVector
the list of paths / routes
Definition: ODCell.h:71
const std::string DEFAULT_VTYPE_ID
static void close()
Closes all of an applications subsystems.
double vehicleNumber
The number of vehicles.
Definition: ODCell.h:53
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:557
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:133
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:53
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:398
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:49
std::string origin
Name of the origin district.
Definition: ODCell.h:62
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:69
The data loader.
Definition: ROLoader.h:56
SumoXMLEdgeFunc getFunction() const
Returns the function of the edge.
Definition: ROEdge.h:183
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:58
double getTravelTime(const ROEdge *const edge, const ROVehicle *const, double)
void loadRoutes(OptionsCont &oc, SUMOSAXHandler &handler)
read SUMO routes
Definition: ODMatrix.cpp:603
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:70
std::map< SUMOTime, std::vector< std::string > > departures
mapping of departure times to departing vehicles, if already fixed
Definition: ODCell.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:645
SUMOTime begin
The begin time this cell describes.
Definition: ODCell.h:56
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:510
virtual void loadNet(RONet &toFill, ROAbstractEdgeBuilder &eb)
Loads the network.
Definition: ROLoader.cpp:113
A basic edge for routing applications.
Definition: ROEdge.h:72
begin/end of the description of an edge
#define VERSION_STRING
Definition: config.h:207
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:247
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:68
Structure representing possible vehicle parameter.
const NamedObjectCont< ROEdge * > & getEdgeMap() const
Definition: RONet.h:397
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:320
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:113
A storage for options typed value containers)
Definition: OptionsCont.h:92
double getSpeedLimit() const
Returns the speed allowed on this edge.
Definition: ROEdge.h:214
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:544
static double getNoiseEffort(const ROEdge *const edge, const ROVehicle *const veh, double time)
Definition: ROEdge.cpp:199
static void setGlobalOptions(const bool interpolate)
Definition: ROEdge.h:448
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.
std::string destination
Name of the destination district.
Definition: ODCell.h:65
double recomputeCosts(const std::vector< const E *> &edges, const V *const v, SUMOTime msTime) const
SUMOVTypeParameter * getVehicleTypeSecure(const std::string &id)
Retrieves the named vehicle type.
Definition: RONet.cpp:277
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:59
void clear()
Clears information whether an error occurred previously.
Definition: MsgHandler.cpp:173
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:242
static void initOutputOptions()
init output options
Definition: MsgHandler.cpp:239
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:245
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:620
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.