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-2022 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
21 // Main for MAROUTER
22 /****************************************************************************/
23 #include <config.h>
24 
25 #ifdef HAVE_VERSION_H
26 #include <version.h>
27 #endif
28 
29 #include <iostream>
30 #include <string>
31 #include <limits.h>
32 #include <ctime>
33 #include <vector>
34 #include <xercesc/sax/SAXException.hpp>
35 #include <xercesc/sax/SAXParseException.hpp>
42 #include <utils/common/ToString.h>
46 #include <utils/options/Option.h>
52 #include <utils/router/CHRouter.h>
54 #include <utils/xml/XMLSubSys.h>
55 #include <od/ODCell.h>
56 #include <od/ODDistrict.h>
57 #include <od/ODDistrictCont.h>
58 #include <od/ODDistrictHandler.h>
59 #include <od/ODMatrix.h>
60 #include <router/ROEdge.h>
61 #include <router/ROLoader.h>
62 #include <router/RONet.h>
63 #include <router/RORoute.h>
64 #include <router/RORoutable.h>
65 
66 #include "ROMAFrame.h"
67 #include "ROMAAssignments.h"
68 #include "ROMAEdgeBuilder.h"
69 #include "ROMARouteHandler.h"
70 #include "ROMAEdge.h"
71 
72 
73 // ===========================================================================
74 // Method implementation
75 // ===========================================================================
76 /* -------------------------------------------------------------------------
77  * data processing methods
78  * ----------------------------------------------------------------------- */
84 void
85 initNet(RONet& net, ROLoader& loader, OptionsCont& oc) {
86  // load the net
87  ROMAEdgeBuilder builder;
88  ROEdge::setGlobalOptions(oc.getBool("weights.interpolate"));
89  loader.loadNet(net, builder);
90  // load the weights when wished/available
91  if (oc.isSet("weight-files")) {
92  loader.loadWeights(net, "weight-files", oc.getString("weight-attribute"), false, oc.getBool("weights.expand"));
93  }
94  if (oc.isSet("lane-weight-files")) {
95  loader.loadWeights(net, "lane-weight-files", oc.getString("weight-attribute"), true, oc.getBool("weights.expand"));
96  }
97 }
98 
99 
100 double
101 getTravelTime(const ROEdge* const edge, const ROVehicle* const /* veh */, double /* time */) {
102  return edge->getLength() / edge->getSpeedLimit();
103 }
104 
105 
109 void
111  OutputDevice::createDeviceByOption("all-pairs-output");
112  OutputDevice& outFile = OutputDevice::getDeviceByOption("all-pairs-output");
113  // build the router
114  typedef DijkstraRouter<ROEdge, ROVehicle> Dijkstra;
115  Dijkstra router(ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &getTravelTime);
116  ConstROEdgeVector into;
117  const int numInternalEdges = net.getInternalEdgeNumber();
118  const int numTotalEdges = (int)net.getEdgeNumber();
119  for (int i = numInternalEdges; i < numTotalEdges; i++) {
120  const Dijkstra::EdgeInfo& ei = router.getEdgeInfo(i);
121  if (!ei.edge->isInternal()) {
122  router.compute(ei.edge, nullptr, nullptr, 0, into);
123  double fromEffort = router.getEffort(ei.edge, nullptr, 0);
124  for (int j = numInternalEdges; j < numTotalEdges; j++) {
125  double heuTT = router.getEdgeInfo(j).effort - fromEffort;
126  outFile << heuTT;
127  /*
128  if (heuTT >
129  ei.edge->getDistanceTo(router.getEdgeInfo(j).edge)
130  && router.getEdgeInfo(j).traveltime != std::numeric_limits<double>::max()
131  ) {
132  std::cout << " heuristic failure: from=" << ei.edge->getID() << " to=" << router.getEdgeInfo(j).edge->getID()
133  << " fromEffort=" << fromEffort << " heuTT=" << heuTT << " airDist=" << ei.edge->getDistanceTo(router.getEdgeInfo(j).edge) << "\n";
134  }
135  */
136  }
137  }
138  }
139 }
140 
141 
145 void
147  // build the router
148  SUMOAbstractRouter<ROEdge, ROVehicle>* router = nullptr;
149  const std::string measure = oc.getString("weight-attribute");
150  const std::string routingAlgorithm = oc.getString("routing-algorithm");
151  const double priorityFactor = oc.getFloat("weights.priority-factor");
152  SUMOTime begin = string2time(oc.getString("begin"));
153  SUMOTime end = string2time(oc.getString("end"));
154  if (oc.isDefault("begin") && matrix.getBegin() >= 0) {
155  begin = matrix.getBegin();
156  }
157  if (oc.isDefault("end")) {
158  end = matrix.getEnd() >= 0 ? matrix.getEnd() : SUMOTime_MAX;
159  }
161  if (measure == "traveltime" && priorityFactor == 0) {
162  if (routingAlgorithm == "dijkstra") {
163  router = new DijkstraRouter<ROEdge, ROVehicle>(ROEdge::getAllEdges(), oc.getBool("ignore-errors"), ttOp, nullptr, false, nullptr, net.hasPermissions());
164  } else if (routingAlgorithm == "astar") {
165  router = new AStarRouter<ROEdge, ROVehicle>(ROEdge::getAllEdges(), oc.getBool("ignore-errors"), ttOp, nullptr, net.hasPermissions());
166  } else if (routingAlgorithm == "CH" && !net.hasPermissions()) {
167  const SUMOTime weightPeriod = (oc.isSet("weight-files") ?
168  string2time(oc.getString("weight-period")) :
169  SUMOTime_MAX);
170  router = new CHRouter<ROEdge, ROVehicle>(ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &ROEdge::getTravelTimeStatic, SVC_IGNORING, weightPeriod, net.hasPermissions(), false);
171  } else if (routingAlgorithm == "CHWrapper" || routingAlgorithm == "CH") {
172  // use CHWrapper instead of CH if the net has permissions
173  const SUMOTime weightPeriod = (oc.isSet("weight-files") ?
174  string2time(oc.getString("weight-period")) :
175  SUMOTime_MAX);
178  begin, end, weightPeriod, net.hasPermissions(), oc.getInt("routing-threads"));
179  } else {
180  throw ProcessError("Unknown routing Algorithm '" + routingAlgorithm + "'!");
181  }
182  } else {
184  if (measure == "traveltime") {
185  if (ROEdge::initPriorityFactor(priorityFactor)) {
187  } else {
189  }
190  } else if (measure == "CO") {
191  op = &ROEdge::getEmissionEffort<PollutantsInterface::CO>;
192  } else if (measure == "CO2") {
193  op = &ROEdge::getEmissionEffort<PollutantsInterface::CO2>;
194  } else if (measure == "PMx") {
195  op = &ROEdge::getEmissionEffort<PollutantsInterface::PM_X>;
196  } else if (measure == "HC") {
197  op = &ROEdge::getEmissionEffort<PollutantsInterface::HC>;
198  } else if (measure == "NOx") {
199  op = &ROEdge::getEmissionEffort<PollutantsInterface::NO_X>;
200  } else if (measure == "fuel") {
201  op = &ROEdge::getEmissionEffort<PollutantsInterface::FUEL>;
202  } else if (measure == "electricity") {
203  op = &ROEdge::getEmissionEffort<PollutantsInterface::ELEC>;
204  } else if (measure == "noise") {
206  } else {
208  }
209  if (measure != "traveltime" && !net.hasLoadedEffort()) {
210  WRITE_WARNING("No weight data was loaded for attribute '" + measure + "'.");
211  }
212  router = new DijkstraRouter<ROEdge, ROVehicle>(ROEdge::getAllEdges(), oc.getBool("ignore-errors"), op, ttOp, false, nullptr, net.hasPermissions());
213  }
214  try {
215  const RORouterProvider provider(router, nullptr, nullptr, nullptr);
216  // prepare the output
217  net.openOutput(oc);
218  // process route definitions
219  if (oc.isSet("timeline")) {
220  matrix.applyCurve(matrix.parseTimeLine(oc.getStringVector("timeline"), oc.getBool("timeline.day-in-hours")));
221  }
222  matrix.sortByBeginTime();
223  bool haveOutput = OutputDevice::createDeviceByOption("netload-output", "meandata");
224  ROVehicle defaultVehicle(SUMOVehicleParameter(), nullptr, net.getVehicleTypeSecure(DEFAULT_VTYPE_ID), &net);
225  ROMAAssignments a(begin, end, oc.getBool("additive-traffic"), oc.getFloat("weight-adaption"),
226  oc.getInt("max-alternatives"), oc.getBool("capacities.default"), net, matrix, *router,
227  haveOutput ? &OutputDevice::getDeviceByOption("netload-output") : nullptr);
228  a.resetFlows();
229 #ifdef HAVE_FOX
230  // this is just to init the CHRouter with the default vehicle
231  router->reset(&defaultVehicle);
232  const int maxNumThreads = oc.getInt("routing-threads");
233  while ((int)net.getThreadPool().size() < maxNumThreads) {
234  new RONet::WorkerThread(net.getThreadPool(), provider);
235  }
236 #endif
237  std::string assignMethod = oc.getString("assignment-method");
238  if (assignMethod == "UE") {
239  WRITE_WARNING("Deterministic user equilibrium ('UE') is not implemented yet, using stochastic method ('SUE').");
240  assignMethod = "SUE";
241  }
242  if (assignMethod == "incremental") {
243  a.incremental(oc.getInt("max-iterations"), oc.getBool("verbose"));
244  } else if (assignMethod == "SUE") {
245  a.sue(oc.getInt("max-iterations"), oc.getInt("max-inner-iterations"),
246  oc.getInt("paths"), oc.getFloat("paths.penalty"), oc.getFloat("tolerance"), oc.getString("route-choice-method"));
247  }
248  // update path costs and output
249  OutputDevice* dev = net.getRouteOutput();
250  if (dev != nullptr) {
251  std::vector<std::string> tazParamKeys;
252  if (oc.isSet("taz-param")) {
253  tazParamKeys = oc.getStringVector("taz-param");
254  }
255  std::map<SUMOTime, std::string> sortedOut;
256  SUMOTime lastEnd = -1;
257  int num = 0;
258  for (const ODCell* const c : matrix.getCells()) {
259  if (c->begin >= end || c->end <= begin ||
260  c->pathsVector.empty() || c->pathsVector.front()->getEdgeVector().empty()) {
261  continue;
262  }
263  if (lastEnd >= 0 && lastEnd <= c->begin) {
264  for (std::map<SUMOTime, std::string>::const_iterator desc = sortedOut.begin(); desc != sortedOut.end(); ++desc) {
265  dev->writePreformattedTag(desc->second);
266  }
267  sortedOut.clear();
268  }
269  if (c->departures.empty()) {
270  const SUMOTime b = MAX2(begin, c->begin);
271  const SUMOTime e = MIN2(end, c->end);
272  const int numVehs = int(c->vehicleNumber * (e - b) / (c->end - c->begin));
273  OutputDevice_String od(1);
274  od.openTag(SUMO_TAG_FLOW).writeAttr(SUMO_ATTR_ID, oc.getString("prefix") + toString(num++));
276  od.writeAttr(SUMO_ATTR_NUMBER, numVehs);
277  matrix.writeDefaultAttrs(od, oc.getBool("ignore-vehicle-type"), c);
279  for (RORoute* const r : c->pathsVector) {
280  r->setCosts(router->recomputeCosts(r->getEdgeVector(), &defaultVehicle, begin));
281  r->writeXMLDefinition(od, nullptr, true, true, false, false);
282  }
283  od.closeTag();
284  od.closeTag();
285  sortedOut[c->begin] += od.getString();
286  } else {
287  for (std::map<SUMOTime, std::vector<std::string> >::const_iterator deps = c->departures.begin(); deps != c->departures.end(); ++deps) {
288  if (deps->first >= end || deps->first < begin) {
289  continue;
290  }
291  const std::string routeDistId = c->origin + "_" + c->destination + "_" + time2string(c->begin) + "_" + time2string(c->end);
292  for (const std::string& id : deps->second) {
293  OutputDevice_String od(1);
295  matrix.writeDefaultAttrs(od, oc.getBool("ignore-vehicle-type"), c);
297  for (RORoute* const r : c->pathsVector) {
298  r->setCosts(router->recomputeCosts(r->getEdgeVector(), &defaultVehicle, begin));
299  r->writeXMLDefinition(od, nullptr, true, true, false, false);
300  }
301  od.closeTag();
302  if (!tazParamKeys.empty()) {
303  od.openTag(SUMO_TAG_PARAM).writeAttr(SUMO_ATTR_KEY, tazParamKeys[0]).writeAttr(SUMO_ATTR_VALUE, c->origin).closeTag();
304  if (tazParamKeys.size() > 1) {
305  od.openTag(SUMO_TAG_PARAM).writeAttr(SUMO_ATTR_KEY, tazParamKeys[1]).writeAttr(SUMO_ATTR_VALUE, c->destination).closeTag();
306  }
307  }
308  od.closeTag();
309  sortedOut[deps->first] += od.getString();
310  }
311  }
312  }
313  if (c->end > lastEnd) {
314  lastEnd = c->end;
315  }
316  }
317  for (std::map<SUMOTime, std::string>::const_iterator desc = sortedOut.begin(); desc != sortedOut.end(); ++desc) {
318  dev->writePreformattedTag(desc->second);
319  }
320  haveOutput = true;
321  }
322  if (!haveOutput) {
323  throw ProcessError("No output file given.");
324  }
325  // end the processing
326  net.cleanup();
327  } catch (ProcessError&) {
328  net.cleanup();
329  throw;
330  }
331 }
332 
333 
334 /* -------------------------------------------------------------------------
335  * main
336  * ----------------------------------------------------------------------- */
337 int
338 main(int argc, char** argv) {
340  oc.setApplicationDescription("Import O/D-matrices for macroscopic traffic assignment to generate SUMO routes");
341  oc.setApplicationName("marouter", "Eclipse SUMO marouter Version " VERSION_STRING);
342  int ret = 0;
343  RONet* net = nullptr;
344  try {
345  XMLSubSys::init();
347  OptionsIO::setArgs(argc, argv);
349  if (oc.processMetaOptions(argc < 2)) {
351  return 0;
352  }
354  XMLSubSys::setValidation(oc.getString("xml-validation"), oc.getString("xml-validation.net"), oc.getString("xml-validation.routes"));
356  if (!ROMAFrame::checkOptions()) {
357  throw ProcessError();
358  }
360  // load data
361  ROLoader loader(oc, false, false);
362  net = new RONet();
363  initNet(*net, loader, oc);
364  if (oc.isSet("all-pairs-output")) {
365  computeAllPairs(*net, oc);
366  if (net->getDistricts().empty()) {
367  delete net;
369  if (ret == 0) {
370  std::cout << "Success." << std::endl;
371  }
372  return ret;
373  }
374  }
375  if (net->getDistricts().empty()) {
376  WRITE_WARNING("No districts loaded, will use edge ids!");
377  }
378  // load districts
379  ODDistrictCont districts;
380  districts.makeDistricts(net->getDistricts());
381  // load the matrix
382  ODMatrix matrix(districts);
383  matrix.loadMatrix(oc);
384  ROMARouteHandler handler(matrix);
385  matrix.loadRoutes(oc, handler);
386  if (matrix.getNumLoaded() == matrix.getNumDiscarded()) {
387  throw ProcessError("No valid vehicles loaded.");
388  }
389  if (MsgHandler::getErrorInstance()->wasInformed() && !oc.getBool("ignore-errors")) {
390  throw ProcessError("Loading failed.");
391  }
393  WRITE_MESSAGE(toString(matrix.getNumLoaded() - matrix.getNumDiscarded()) + " valid vehicles loaded (total seen: " + toString(matrix.getNumLoaded()) + ").");
394 
395  // build routes and parse the incremental rates if the incremental method is choosen.
396  try {
397  computeRoutes(*net, oc, matrix);
398  } catch (XERCES_CPP_NAMESPACE::SAXParseException& e) {
399  WRITE_ERROR(toString(e.getLineNumber()));
400  ret = 1;
401  } catch (XERCES_CPP_NAMESPACE::SAXException& e) {
402  WRITE_ERROR(StringUtils::transcode(e.getMessage()));
403  ret = 1;
404  }
405  if (MsgHandler::getErrorInstance()->wasInformed() || ret != 0) {
406  throw ProcessError();
407  }
408  } catch (const ProcessError& e) {
409  if (std::string(e.what()) != std::string("Process Error") && std::string(e.what()) != std::string("")) {
410  WRITE_ERROR(e.what());
411  }
412  MsgHandler::getErrorInstance()->inform("Quitting (on error).", false);
413  ret = 1;
414  }
415 
416  delete net;
418  if (ret == 0) {
419  std::cout << "Success." << std::endl;
420  }
421  return ret;
422 }
423 
424 
425 /****************************************************************************/
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:282
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:288
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:280
std::vector< const ROEdge * > ConstROEdgeVector
Definition: ROEdge.h:54
std::string time2string(SUMOTime t)
convert SUMOTime to string
Definition: SUMOTime.cpp:68
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition: SUMOTime.cpp:45
#define SUMOTime_MAX
Definition: SUMOTime.h:33
long long int SUMOTime
Definition: SUMOTime.h:32
@ SVC_IGNORING
vehicles ignoring classes
const std::string DEFAULT_VTYPE_ID
@ SUMO_TAG_VEHICLE
description of a vehicle
@ SUMO_TAG_ROUTE_DISTRIBUTION
distribution of a route
@ SUMO_TAG_FLOW
a flow definitio nusing a from-to edges instead of a route (used by router)
@ SUMO_TAG_PARAM
parameter associated to a certain key
@ SUMO_ATTR_NUMBER
@ SUMO_ATTR_DEPART
@ SUMO_ATTR_VALUE
@ SUMO_ATTR_BEGIN
weights: time range begin
@ SUMO_ATTR_END
weights: time range end
@ SUMO_ATTR_ID
@ SUMO_ATTR_KEY
T MIN2(T a, T b)
Definition: StdDefs.h:74
T MAX2(T a, T b)
Definition: StdDefs.h:80
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
Computes the shortest path through a network using the A* algorithm.
Definition: AStarRouter.h:76
Computes the shortest path through a contracted network.
Definition: CHRouter.h:59
Computes the shortest path through a contracted network.
Computes the shortest path through a network using the Dijkstra algorithm.
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
Definition: MsgHandler.cpp:80
virtual void inform(std::string msg, bool addType=true)
adds a new error to the list
Definition: MsgHandler.cpp:117
static void initOutputOptions()
init output options
Definition: MsgHandler.cpp:228
virtual void clear(bool resetInformed=true)
Clears information whether an error occurred previously and print aggregated message summary.
Definition: MsgHandler.cpp:162
A container for districts.
void makeDistricts(const std::map< std::string, std::pair< std::vector< std::string >, std::vector< std::string > > > &districts)
create districts from description
An O/D (origin/destination) matrix.
Definition: ODMatrix.h:68
double getNumLoaded() const
Returns the number of loaded vehicles.
Definition: ODMatrix.cpp:586
void sortByBeginTime()
Definition: ODMatrix.cpp:743
const std::vector< ODCell * > & getCells()
Definition: ODMatrix.h:247
void applyCurve(const Distribution_Points &ps)
Splits the stored cells dividing them on the given time line.
Definition: ODMatrix.cpp:620
SUMOTime getEnd() const
Definition: ODMatrix.h:257
Distribution_Points parseTimeLine(const std::vector< std::string > &def, bool timelineDayInHours)
split the given timeline
Definition: ODMatrix.cpp:718
void writeDefaultAttrs(OutputDevice &dev, const bool noVtype, const ODCell *const cell)
Helper function for flow and trip output writing the depart and arrival attributes.
Definition: ODMatrix.cpp:194
SUMOTime getBegin() const
Definition: ODMatrix.h:253
void loadMatrix(OptionsCont &oc)
read a matrix in one of several formats
Definition: ODMatrix.cpp:633
void loadRoutes(OptionsCont &oc, SUMOSAXHandler &handler)
read SUMO routes
Definition: ODMatrix.cpp:701
double getNumDiscarded() const
Returns the number of discarded vehicles.
Definition: ODMatrix.cpp:598
A storage for options typed value containers)
Definition: OptionsCont.h:89
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
void setApplicationName(const std::string &appName, const std::string &fullName)
Sets the application name.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
void setApplicationDescription(const std::string &appDesc)
Sets the application description.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
const StringVector & getStringVector(const std::string &name) const
Returns the list of string-value of the named option (only for Option_StringVector)
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
bool processMetaOptions(bool missingOptions)
Checks for help and configuration output, returns whether we should exit.
static void setArgs(int argc, char **argv)
Stores the command line arguments for later parsing.
Definition: OptionsIO.cpp:58
static void getOptions(const bool commandLineOnly=false)
Parses the command line arguments and loads the configuration.
Definition: OptionsIO.cpp:85
An output device that encapsulates an ofstream.
std::string getString() const
Returns the current content as a string.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
OutputDevice & writePreformattedTag(const std::string &val)
writes a preformatted tag to the device but ensures that any pending tags are closed
Definition: OutputDevice.h:305
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
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.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:248
static OutputDevice & getDeviceByOption(const std::string &name)
Returns the device described by the option.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
A basic edge for routing applications.
Definition: ROEdge.h:70
static double getStoredEffort(const ROEdge *const edge, const ROVehicle *const, double time)
Definition: ROEdge.h:472
static bool initPriorityFactor(double priorityFactor)
initialize priority factor range
Definition: ROEdge.cpp:442
static double getTravelTimeStaticPriorityFactor(const ROEdge *const edge, const ROVehicle *const veh, double time)
Return traveltime weighted by edge priority (scaled penalty for low-priority edges)
Definition: ROEdge.h:432
double getSpeedLimit() const
Returns the speed allowed on this edge.
Definition: ROEdge.h:225
static double getNoiseEffort(const ROEdge *const edge, const ROVehicle *const veh, double time)
Definition: ROEdge.cpp:213
double getLength() const
Returns the length of the edge.
Definition: ROEdge.h:210
static void setGlobalOptions(const bool interpolate)
Definition: ROEdge.h:492
static double getTravelTimeStatic(const ROEdge *const edge, const ROVehicle *const veh, double time)
Returns the travel time for the given edge.
Definition: ROEdge.h:418
static const ROEdgeVector & getAllEdges()
Returns all ROEdges.
Definition: ROEdge.cpp:350
The data loader.
Definition: ROLoader.h:53
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:256
virtual void loadNet(RONet &toFill, ROAbstractEdgeBuilder &eb)
Loads the network.
Definition: ROLoader.cpp:112
assignment methods
void sue(const int maxOuterIteration, const int maxInnerIteration, const int kPaths, const double penalty, const double tolerance, const std::string routeChoiceMethod)
void incremental(const int numIter, const bool verbose)
static double getPenalizedTT(const ROEdge *const e, const ROVehicle *const v, double t)
Returns the traveltime on an edge including penalties.
Interface for building instances of duarouter-edges.
static void fillOptions()
Inserts options used by duarouter into the OptionsCont-singleton.
Definition: ROMAFrame.cpp:44
static bool checkOptions()
Checks set options from the OptionsCont-singleton for being valid for usage within duarouter.
Definition: ROMAFrame.cpp:304
Parser and container for routes during their loading.
The router's network representation.
Definition: RONet.h:62
SUMOVTypeParameter * getVehicleTypeSecure(const std::string &id)
Retrieves the named vehicle type.
Definition: RONet.cpp:343
void cleanup()
closes the file output for computed routes and deletes associated threads if necessary
Definition: RONet.cpp:319
void openOutput(const OptionsCont &options)
Opens the output for computed routes.
Definition: RONet.cpp:271
int getInternalEdgeNumber() const
Returns the number of internal edges the network contains.
Definition: RONet.cpp:747
bool hasPermissions() const
Definition: RONet.cpp:809
OutputDevice * getRouteOutput(const bool alternative=false)
Definition: RONet.h:427
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
int getEdgeNumber() const
Returns the total number of edges the network contains including internal edges.
Definition: RONet.cpp:741
bool hasLoadedEffort() const
whether efforts were loaded from file
Definition: RONet.cpp:820
A complete router's route.
Definition: RORoute.h:52
const ConstROEdgeVector & getEdgeVector() const
Returns the list of edges this route consists of.
Definition: RORoute.h:152
void setCosts(double costs)
Sets the costs of the route.
Definition: RORoute.cpp:64
OutputDevice & writeXMLDefinition(OutputDevice &dev, const ROVehicle *const veh, const bool withCosts, const bool withProb, const bool withExitTimes, const bool withLength, const std::string &id="") const
Definition: RORoute.cpp:99
A vehicle as used by router.
Definition: ROVehicle.h:50
static void initRandGlobal(SumoRNG *which=nullptr)
Reads the given random number options and initialises the random number generator in accordance.
Definition: RandHelper.cpp:75
double recomputeCosts(const std::vector< const E * > &edges, const V *const v, SUMOTime msTime, double *lengthp=nullptr) const
virtual void reset(const V *const vehicle)
reset internal caches, used by CHRouter
Structure representing possible vehicle parameter.
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:137
static void close()
Closes all of an applications subsystems.
static bool checkOptions()
checks shared options and sets StdDefs
static void setValidation(const std::string &validationScheme, const std::string &netValidationScheme, const std::string &routeValidationScheme)
Enables or disables validation.
Definition: XMLSubSys.cpp:65
static void init()
Initialises the xml-subsystem.
Definition: XMLSubSys.cpp:54
int main(int argc, char **argv)
void initNet(RONet &net, ROLoader &loader, OptionsCont &oc)
void computeAllPairs(RONet &net, OptionsCont &oc)
void computeRoutes(RONet &net, OptionsCont &oc, ODMatrix &matrix)
double getTravelTime(const ROEdge *const edge, const ROVehicle *const, double)
A single O/D-matrix cell.
Definition: ODCell.h:48