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 /****************************************************************************/
17 // Main for MAROUTER
18 /****************************************************************************/
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #ifdef HAVE_VERSION_H
27 #include <version.h>
28 #endif
29 
30 #include <iostream>
31 #include <string>
32 #include <limits.h>
33 #include <ctime>
34 #include <vector>
35 #include <xercesc/sax/SAXException.hpp>
36 #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 // functions
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  // initialize the travel times
91  /* const SUMOTime begin = string2time(oc.getString("begin"));
92  const SUMOTime end = string2time(oc.getString("end"));
93  for (std::map<std::string, ROEdge*>::const_iterator i = net.getEdgeMap().begin(); i != net.getEdgeMap().end(); ++i) {
94  (*i).second->addTravelTime(STEPS2TIME(begin), STEPS2TIME(end), (*i).second->getLength() / (*i).second->getSpeedLimit());
95  }*/
96  // load the weights when wished/available
97  if (oc.isSet("weight-files")) {
98  loader.loadWeights(net, "weight-files", oc.getString("weight-attribute"), false, oc.getBool("weights.expand"));
99  }
100  if (oc.isSet("lane-weight-files")) {
101  loader.loadWeights(net, "lane-weight-files", oc.getString("weight-attribute"), true, oc.getBool("weights.expand"));
102  }
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
119  typedef DijkstraRouter<ROEdge, ROVehicle> Dijkstra;
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  SUMOTime begin = string2time(oc.getString("begin"));
180  SUMOTime end = string2time(oc.getString("end"));
181  if (oc.isDefault("begin") && matrix.getBegin() >= 0) {
182  begin = matrix.getBegin();
183  }
184  if (oc.isDefault("end") && matrix.getEnd() >= 0) {
185  end = matrix.getEnd();
186  }
188  if (measure == "traveltime") {
189  if (routingAlgorithm == "dijkstra") {
190  router = new DijkstraRouter<ROEdge, ROVehicle>(ROEdge::getAllEdges(), oc.getBool("ignore-errors"), ttOp, nullptr, false, nullptr, net.hasPermissions());
191  } else if (routingAlgorithm == "astar") {
192  router = new AStarRouter<ROEdge, ROVehicle>(ROEdge::getAllEdges(), oc.getBool("ignore-errors"), ttOp, nullptr, net.hasPermissions());
193  } else if (routingAlgorithm == "CH") {
194  const SUMOTime weightPeriod = (oc.isSet("weight-files") ?
195  string2time(oc.getString("weight-period")) :
196  std::numeric_limits<int>::max());
197  router = new CHRouter<ROEdge, ROVehicle>(ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &ROEdge::getTravelTimeStatic, SVC_IGNORING, weightPeriod, net.hasPermissions(), false);
198  } else if (routingAlgorithm == "CHWrapper") {
199  const SUMOTime weightPeriod = (oc.isSet("weight-files") ?
200  string2time(oc.getString("weight-period")) :
201  std::numeric_limits<int>::max());
204  begin, end, weightPeriod, oc.getInt("routing-threads"));
205  } else {
206  throw ProcessError("Unknown routing Algorithm '" + routingAlgorithm + "'!");
207  }
208  } else {
210  if (measure == "CO") {
211  op = &ROEdge::getEmissionEffort<PollutantsInterface::CO>;
212  } else if (measure == "CO2") {
213  op = &ROEdge::getEmissionEffort<PollutantsInterface::CO2>;
214  } else if (measure == "PMx") {
215  op = &ROEdge::getEmissionEffort<PollutantsInterface::PM_X>;
216  } else if (measure == "HC") {
217  op = &ROEdge::getEmissionEffort<PollutantsInterface::HC>;
218  } else if (measure == "NOx") {
219  op = &ROEdge::getEmissionEffort<PollutantsInterface::NO_X>;
220  } else if (measure == "fuel") {
221  op = &ROEdge::getEmissionEffort<PollutantsInterface::FUEL>;
222  } else if (measure == "electricity") {
223  op = &ROEdge::getEmissionEffort<PollutantsInterface::ELEC>;
224  } else if (measure == "noise") {
226  } else {
227  throw ProcessError("Unknown measure (weight attribute '" + measure + "')!");
228  }
229  router = new DijkstraRouter<ROEdge, ROVehicle>(ROEdge::getAllEdges(), oc.getBool("ignore-errors"), op, ttOp, false, nullptr, net.hasPermissions());
230  }
231  try {
232  const RORouterProvider provider(router, nullptr, nullptr);
233  // prepare the output
234  net.openOutput(oc);
235  // process route definitions
236  if (oc.isSet("timeline")) {
237  matrix.applyCurve(matrix.parseTimeLine(oc.getStringVector("timeline"), oc.getBool("timeline.day-in-hours")));
238  }
239  matrix.sortByBeginTime();
240  ROVehicle defaultVehicle(SUMOVehicleParameter(), nullptr, net.getVehicleTypeSecure(DEFAULT_VTYPE_ID), &net);
241  ROMAAssignments a(begin, end, oc.getBool("additive-traffic"), oc.getFloat("weight-adaption"), oc.getInt("max-alternatives"), net, matrix, *router);
242  a.resetFlows();
243 #ifdef HAVE_FOX
244  const int maxNumThreads = oc.getInt("routing-threads");
245  while ((int)net.getThreadPool().size() < maxNumThreads) {
246  new RONet::WorkerThread(net.getThreadPool(), provider);
247  }
248 #endif
249  std::string assignMethod = oc.getString("assignment-method");
250  if (assignMethod == "UE") {
251  WRITE_WARNING("Deterministic user equilibrium ('UE') is not implemented yet, using stochastic method ('SUE').");
252  assignMethod = "SUE";
253  }
254  if (assignMethod == "incremental") {
255  a.incremental(oc.getInt("max-iterations"), oc.getBool("verbose"));
256  } else if (assignMethod == "SUE") {
257  a.sue(oc.getInt("max-iterations"), oc.getInt("max-inner-iterations"),
258  oc.getInt("paths"), oc.getFloat("paths.penalty"), oc.getFloat("tolerance"), oc.getString("route-choice-method"));
259  }
260  // update path costs and output
261  bool haveOutput = false;
262  OutputDevice* dev = net.getRouteOutput();
263  if (dev != nullptr) {
264  std::vector<std::string> tazParamKeys;
265  if (oc.isSet("taz-param")) {
266  tazParamKeys = oc.getStringVector("taz-param");
267  }
268  std::map<SUMOTime, std::string> sortedOut;
269  SUMOTime lastEnd = -1;
270  int num = 0;
271  for (const ODCell* const c : matrix.getCells()) {
272  if (c->begin >= end || c->end <= begin ||
273  c->pathsVector.empty() || c->pathsVector.front()->getEdgeVector().empty()) {
274  continue;
275  }
276  if (lastEnd >= 0 && lastEnd <= c->begin) {
277  for (std::map<SUMOTime, std::string>::const_iterator desc = sortedOut.begin(); desc != sortedOut.end(); ++desc) {
278  dev->writePreformattedTag(desc->second);
279  }
280  sortedOut.clear();
281  }
282  if (c->departures.empty()) {
283  const SUMOTime b = MAX2(begin, c->begin);
284  const SUMOTime e = MIN2(end, c->end);
285  const int numVehs = int(c->vehicleNumber * (e - b) / (c->end - c->begin));
286  OutputDevice_String od(dev->isBinary(), 1);
287  od.openTag(SUMO_TAG_FLOW).writeAttr(SUMO_ATTR_ID, oc.getString("prefix") + toString(num++));
289  od.writeAttr(SUMO_ATTR_NUMBER, numVehs);
290  matrix.writeDefaultAttrs(od, oc.getBool("ignore-vehicle-type"), c);
292  for (RORoute* const r : c->pathsVector) {
293  r->setCosts(router->recomputeCosts(r->getEdgeVector(), &defaultVehicle, begin));
294  r->writeXMLDefinition(od, nullptr, true, false);
295  }
296  od.closeTag();
297  od.closeTag();
298  sortedOut[c->begin] += od.getString();
299  } else {
300  for (std::map<SUMOTime, std::vector<std::string> >::const_iterator deps = c->departures.begin(); deps != c->departures.end(); ++deps) {
301  if (deps->first >= end || deps->first < begin) {
302  continue;
303  }
304  const std::string routeDistId = c->origin + "_" + c->destination + "_" + time2string(c->begin) + "_" + time2string(c->end);
305  for (const std::string& id : deps->second) {
306  OutputDevice_String od(dev->isBinary(), 1);
308  matrix.writeDefaultAttrs(od, oc.getBool("ignore-vehicle-type"), c);
310  for (RORoute* const r : c->pathsVector) {
311  r->setCosts(router->recomputeCosts(r->getEdgeVector(), &defaultVehicle, begin));
312  r->writeXMLDefinition(od, nullptr, true, false);
313  }
314  od.closeTag();
315  if (!tazParamKeys.empty()) {
316  od.openTag(SUMO_TAG_PARAM).writeAttr(SUMO_ATTR_KEY, tazParamKeys[0]).writeAttr(SUMO_ATTR_VALUE, c->origin).closeTag();
317  if (tazParamKeys.size() > 1) {
318  od.openTag(SUMO_TAG_PARAM).writeAttr(SUMO_ATTR_KEY, tazParamKeys[1]).writeAttr(SUMO_ATTR_VALUE, c->destination).closeTag();
319  }
320  }
321  od.closeTag();
322  sortedOut[deps->first] += od.getString();
323  }
324  }
325  }
326  for (std::vector<RORoute*>::const_iterator j = c->pathsVector.begin(); j != c->pathsVector.end(); ++j) {
327  delete *j;
328  }
329  if (c->end > lastEnd) {
330  lastEnd = c->end;
331  }
332  }
333  for (std::map<SUMOTime, std::string>::const_iterator desc = sortedOut.begin(); desc != sortedOut.end(); ++desc) {
334  dev->writePreformattedTag(desc->second);
335  }
336  haveOutput = true;
337  }
338  if (OutputDevice::createDeviceByOption("netload-output", "meandata")) {
339  if (oc.getBool("additive-traffic")) {
340  writeInterval(OutputDevice::getDeviceByOption("netload-output"), begin, end, net, a.getDefaultVehicle());
341  } else {
342  SUMOTime lastCell = 0;
343  for (std::vector<ODCell*>::const_iterator i = matrix.getCells().begin(); i != matrix.getCells().end(); ++i) {
344  if ((*i)->end > lastCell) {
345  lastCell = (*i)->end;
346  }
347  }
348  const SUMOTime interval = string2time(OptionsCont::getOptions().getString("aggregation-interval"));
349  for (SUMOTime start = begin; start < MIN2(end, lastCell); start += interval) {
350  writeInterval(OutputDevice::getDeviceByOption("netload-output"), start, start + interval, net, a.getDefaultVehicle());
351  }
352  }
353  haveOutput = true;
354  }
355  if (!haveOutput) {
356  throw ProcessError("No output file given.");
357  }
358  // end the processing
359  net.cleanup();
360  } catch (ProcessError&) {
361  for (std::vector<ODCell*>::const_iterator i = matrix.getCells().begin(); i != matrix.getCells().end(); ++i) {
362  for (std::vector<RORoute*>::const_iterator j = (*i)->pathsVector.begin(); j != (*i)->pathsVector.end(); ++j) {
363  delete *j;
364  }
365  }
366  net.cleanup();
367  throw;
368  }
369 }
370 
371 
372 /* -------------------------------------------------------------------------
373  * main
374  * ----------------------------------------------------------------------- */
375 int
376 main(int argc, char** argv) {
378  oc.setApplicationDescription("Import O/D-matrices for macroscopic traffic assignment to generate SUMO routes");
379  oc.setApplicationName("marouter", "Eclipse SUMO marouter Version " VERSION_STRING);
380  int ret = 0;
381  RONet* net = nullptr;
382  try {
383  XMLSubSys::init();
385  OptionsIO::setArgs(argc, argv);
387  if (oc.processMetaOptions(argc < 2)) {
389  return 0;
390  }
391  XMLSubSys::setValidation(oc.getString("xml-validation"), oc.getString("xml-validation.net"));
394  throw ProcessError();
395  }
397  // load data
398  ROLoader loader(oc, false, false);
399  net = new RONet();
400  initNet(*net, loader, oc);
401  if (oc.isSet("all-pairs-output")) {
402  computeAllPairs(*net, oc);
403  if (net->getDistricts().empty()) {
404  delete net;
406  if (ret == 0) {
407  std::cout << "Success." << std::endl;
408  }
409  return ret;
410  }
411  }
412  if (net->getDistricts().empty()) {
413  WRITE_WARNING("No districts loaded, will use edge ids!");
414  }
415  // load districts
416  ODDistrictCont districts;
417  districts.makeDistricts(net->getDistricts());
418  // load the matrix
419  ODMatrix matrix(districts);
420  matrix.loadMatrix(oc);
421  ROMARouteHandler handler(matrix);
422  matrix.loadRoutes(oc, handler);
423  if (matrix.getNumLoaded() == matrix.getNumDiscarded()) {
424  throw ProcessError("No valid vehicles loaded.");
425  }
426  if (MsgHandler::getErrorInstance()->wasInformed() && !oc.getBool("ignore-errors")) {
427  throw ProcessError("Loading failed.");
428  }
430  WRITE_MESSAGE(toString(matrix.getNumLoaded() - matrix.getNumDiscarded()) + " valid vehicles loaded (total seen: " + toString(matrix.getNumLoaded()) + ").");
431 
432  // build routes and parse the incremental rates if the incremental method is choosen.
433  try {
434  computeRoutes(*net, oc, matrix);
435  } catch (XERCES_CPP_NAMESPACE::SAXParseException& e) {
436  WRITE_ERROR(toString(e.getLineNumber()));
437  ret = 1;
438  } catch (XERCES_CPP_NAMESPACE::SAXException& e) {
439  WRITE_ERROR(StringUtils::transcode(e.getMessage()));
440  ret = 1;
441  }
442  if (MsgHandler::getErrorInstance()->wasInformed() || ret != 0) {
443  throw ProcessError();
444  }
445  } catch (const ProcessError& e) {
446  if (std::string(e.what()) != std::string("Process Error") && std::string(e.what()) != std::string("")) {
447  WRITE_ERROR(e.what());
448  }
449  MsgHandler::getErrorInstance()->inform("Quitting (on error).", false);
450  ret = 1;
451  }
452 
453  delete net;
455  if (ret == 0) {
456  std::cout << "Success." << std::endl;
457  }
458  return ret;
459 }
460 
461 
462 
463 /****************************************************************************/
464 
RONet::getRouteOutput
OutputDevice * getRouteOutput(const bool alternative=false)
Definition: RONet.h:402
OptionsCont::isSet
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
Definition: OptionsCont.cpp:135
ROLoader
The data loader.
Definition: ROLoader.h:55
ROEdge::getAllEdges
static const ROEdgeVector & getAllEdges()
Returns all ROEdges.
Definition: ROEdge.cpp:344
OutputDevice::createDeviceByOption
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.
Definition: OutputDevice.cpp:101
ODMatrix::parseTimeLine
Distribution_Points parseTimeLine(const std::vector< std::string > &def, bool timelineDayInHours)
split the given timeline
Definition: ODMatrix.cpp:668
OptionsCont::getInt
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
Definition: OptionsCont.cpp:215
OptionsCont::processMetaOptions
bool processMetaOptions(bool missingOptions)
Checks for help and configuration output, returns whether we should exit.
Definition: OptionsCont.cpp:557
ToString.h
SUMO_ATTR_DEPART
@ SUMO_ATTR_DEPART
Definition: SUMOXMLDefinitions.h:431
RONet::openOutput
void openOutput(const OptionsCont &options)
Opens the output for computed routes.
Definition: RONet.cpp:214
OutputDevice::writePreformattedTag
OutputDevice & writePreformattedTag(const std::string &val)
writes a preformatted tag to the device but ensures that any pending tags are closed
Definition: OutputDevice.h:301
MIN2
T MIN2(T a, T b)
Definition: StdDefs.h:73
RONet::getEdgeNumber
int getEdgeNumber() const
Returns the total number of edges the network contains including internal edges.
Definition: RONet.cpp:648
ROMAEdgeBuilder.h
SystemFrame::close
static void close()
Closes all of an applications subsystems.
Definition: SystemFrame.cpp:133
WRITE_WARNING
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:275
MsgHandler::initOutputOptions
static void initOutputOptions()
init output options
Definition: MsgHandler.cpp:216
ROEdge::getTravelTime
double getTravelTime(const ROVehicle *const veh, double time) const
Returns the travel time for this edge.
Definition: ROEdge.cpp:183
ROMAAssignments::incremental
void incremental(const int numIter, const bool verbose)
Definition: ROMAAssignments.cpp:246
OutputDevice_String
An output device that encapsulates an ofstream.
Definition: OutputDevice_String.h:39
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:63
ROMAAssignments.h
RouteCostCalculator.h
SUMO_TAG_ROUTE_DISTRIBUTION
@ SUMO_TAG_ROUTE_DISTRIBUTION
distribution of a route
Definition: SUMOXMLDefinitions.h:214
OptionsCont.h
SUMO_TAG_PARAM
@ SUMO_TAG_PARAM
parameter associated to a certain key
Definition: SUMOXMLDefinitions.h:169
ODMatrix::getEnd
SUMOTime getEnd() const
Definition: ODMatrix.h:256
MsgHandler.h
ROMAFrame::checkOptions
static bool checkOptions()
Checks set options from the OptionsCont-singleton for being valid for usage within duarouter.
Definition: ROMAFrame.cpp:284
initNet
void initNet(RONet &net, ROLoader &loader, OptionsCont &oc)
Definition: marouter_main.cpp:85
ODMatrix::getBegin
SUMOTime getBegin() const
Definition: ODMatrix.h:252
ROMAFrame.h
ROMAEdgeBuilder
Interface for building instances of duarouter-edges.
Definition: ROMAEdgeBuilder.h:49
ROEdge::getTravelTimeStatic
static double getTravelTimeStatic(const ROEdge *const edge, const ROVehicle *const veh, double time)
Returns the travel time for the given edge.
Definition: ROEdge.h:412
OutputDevice::isBinary
bool isBinary() const
Returns whether we have a binary output.
Definition: OutputDevice.h:243
RONet::hasPermissions
bool hasPermissions() const
Definition: RONet.cpp:692
OptionsCont::getString
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
Definition: OptionsCont.cpp:201
MsgHandler::inform
virtual void inform(std::string msg, bool addType=true)
adds a new error to the list
Definition: MsgHandler.cpp:118
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
RORoute::getEdgeVector
const ConstROEdgeVector & getEdgeVector() const
Returns the list of edges this route consists of.
Definition: RORoute.h:154
OptionsCont::getBool
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
Definition: OptionsCont.cpp:222
OptionsCont::getOptions
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:57
RORoute::setCosts
void setCosts(double costs)
Sets the costs of the route.
Definition: RORoute.cpp:65
writeInterval
void writeInterval(OutputDevice &dev, const SUMOTime begin, const SUMOTime end, const RONet &net, const ROVehicle *const veh)
Definition: marouter_main.cpp:151
ROMAEdge
A basic edge for routing applications.
Definition: ROMAEdge.h:57
RONet
The router's network representation.
Definition: RONet.h:63
SUMO_ATTR_ID
@ SUMO_ATTR_ID
Definition: SUMOXMLDefinitions.h:378
ODMatrix.h
ROVehicle
A vehicle as used by router.
Definition: ROVehicle.h:52
RORoutable.h
SUMOVehicleParameter
Structure representing possible vehicle parameter.
Definition: SUMOVehicleParameter.h:297
FileHelpers::writeFloat
static std::ostream & writeFloat(std::ostream &strm, double value)
Writes a float binary.
Definition: FileHelpers.cpp:191
ROLoader.h
RONet::getInternalEdgeNumber
int getInternalEdgeNumber() const
Returns the number of internal edges the network contains.
Definition: RONet.cpp:654
RORoute.h
CHRouterWrapper.h
ROEdge::getNoiseEffort
static double getNoiseEffort(const ROEdge *const edge, const ROVehicle *const veh, double time)
Definition: ROEdge.cpp:208
ODMatrix::loadMatrix
void loadMatrix(OptionsCont &oc)
read a matrix in one of several formats
Definition: ODMatrix.cpp:605
DijkstraRouter
Computes the shortest path through a network using the Dijkstra algorithm.
Definition: DijkstraRouter.h:61
ROEdge::setGlobalOptions
static void setGlobalOptions(const bool interpolate)
Definition: ROEdge.h:466
OutputDevice_String::getString
std::string getString() const
Returns the current content as a string.
Definition: OutputDevice_String.cpp:43
OutputDevice::closeTag
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
Definition: OutputDevice.cpp:253
OptionsCont::getStringVector
const StringVector & getStringVector(const std::string &name) const
Returns the list of string-value of the named option (only for Option_StringVector)
Definition: OptionsCont.cpp:235
MsgHandler::clear
virtual void clear()
Clears information whether an error occurred previously.
Definition: MsgHandler.cpp:160
SUMO_ATTR_BEGIN
@ SUMO_ATTR_BEGIN
weights: time range begin
Definition: SUMOXMLDefinitions.h:678
CHRouter.h
ROMAEdge::getFlow
double getFlow(const double time) const
Definition: ROMAEdge.h:85
MAX2
T MAX2(T a, T b)
Definition: StdDefs.h:79
OutputDevice::writeAttr
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:255
ODMatrix::loadRoutes
void loadRoutes(OptionsCont &oc, SUMOSAXHandler &handler)
read SUMO routes
Definition: ODMatrix.cpp:651
RONet::getDistricts
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:140
SUMO_TAG_FLOW
@ SUMO_TAG_FLOW
a flow definitio nusing a from-to edges instead of a route (used by router)
Definition: SUMOXMLDefinitions.h:149
ODCell
A single O/D-matrix cell.
Definition: ODCell.h:50
OptionsCont::setApplicationName
void setApplicationName(const std::string &appName, const std::string &fullName)
Sets the application name.
Definition: OptionsCont.cpp:481
ODDistrictHandler.h
SystemFrame.h
XMLSubSys::setValidation
static void setValidation(const std::string &validationScheme, const std::string &netValidationScheme)
Enables or disables validation.
Definition: XMLSubSys.cpp:58
computeRoutes
void computeRoutes(RONet &net, OptionsCont &oc, ODMatrix &matrix)
Definition: marouter_main.cpp:174
RONet.h
AStarRouter.h
DEFAULT_VTYPE_ID
const std::string DEFAULT_VTYPE_ID
NamedObjectCont::begin
IDMap::const_iterator begin() const
Returns a reference to the begin iterator for the internal map.
Definition: NamedObjectCont.h:144
STEPS2TIME
#define STEPS2TIME(x)
Definition: SUMOTime.h:56
CHRouterWrapper
Computes the shortest path through a contracted network.
Definition: CHRouterWrapper.h:63
computeAllPairs
void computeAllPairs(RONet &net, OptionsCont &oc)
Definition: marouter_main.cpp:116
OutputDevice.h
SUMO_TAG_EDGE
@ SUMO_TAG_EDGE
begin/end of the description of an edge
Definition: SUMOXMLDefinitions.h:47
ProcessError
Definition: UtilExceptions.h:39
time2string
std::string time2string(SUMOTime t)
Definition: SUMOTime.cpp:67
RORoute
A complete router's route.
Definition: RORoute.h:54
ROMAAssignments
assignment methods
Definition: ROMAAssignments.h:50
UtilExceptions.h
ROMARouteHandler
Parser and container for routes during their loading.
Definition: ROMARouteHandler.h:46
XMLSubSys::init
static void init()
Initialises the xml-subsystem.
Definition: XMLSubSys.cpp:47
OptionsCont
A storage for options typed value containers)
Definition: OptionsCont.h:89
main
int main(int argc, char **argv)
Definition: marouter_main.cpp:376
ROMAAssignments::getDefaultVehicle
ROVehicle * getDefaultVehicle()
Definition: ROMAAssignments.h:60
ROEdge::getFunction
SumoXMLEdgeFunc getFunction() const
Returns the function of the edge.
Definition: ROEdge.h:188
ROLoader::loadNet
virtual void loadNet(RONet &toFill, ROAbstractEdgeBuilder &eb)
Loads the network.
Definition: ROLoader.cpp:113
EDGEFUNC_NORMAL
@ EDGEFUNC_NORMAL
Definition: SUMOXMLDefinitions.h:1081
RouterProvider
Definition: RouterProvider.h:37
ODCell.h
SUMO_TAG_VEHICLE
@ SUMO_TAG_VEHICLE
description of a vehicle
Definition: SUMOXMLDefinitions.h:119
string2time
SUMOTime string2time(const std::string &r)
Definition: SUMOTime.cpp:44
RORoute::writeXMLDefinition
OutputDevice & writeXMLDefinition(OutputDevice &dev, const ROVehicle *const veh, const bool withCosts, const bool withExitTimes) const
Definition: RORoute.cpp:88
ODMatrix
An O/D (origin/destination) matrix.
Definition: ODMatrix.h:69
OptionsCont::isDefault
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
Definition: OptionsCont.cpp:163
RandHelper::initRandGlobal
static void initRandGlobal(std::mt19937 *which=0)
Reads the given random number options and initialises the random number generator in accordance.
Definition: RandHelper.cpp:77
ODDistrictCont
A container for districts.
Definition: ODDistrictCont.h:41
ROMAAssignments::resetFlows
void resetFlows()
Definition: ROMAAssignments.cpp:235
SUMOAbstractRouter< ROEdge, ROVehicle >
OptionsIO::getOptions
static void getOptions(const bool commandLineOnly=false)
Parses the command line arguments and loads the configuration.
Definition: OptionsIO.cpp:75
RONet::getEdgeMap
const NamedObjectCont< ROEdge * > & getEdgeMap() const
Definition: RONet.h:392
OptionsCont::setApplicationDescription
void setApplicationDescription(const std::string &appDesc)
Sets the application description.
Definition: OptionsCont.cpp:489
OptionsCont::getFloat
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
Definition: OptionsCont.cpp:208
OutputDevice::openTag
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
Definition: OutputDevice.cpp:239
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:47
StringUtils.h
RONet::cleanup
void cleanup()
closes the file output for computed routes and deletes associated threads if necessary
Definition: RONet.cpp:254
ROMAFrame::fillOptions
static void fillOptions()
Inserts options used by duarouter into the OptionsCont-singleton.
Definition: ROMAFrame.cpp:45
StringUtils::transcode
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:136
ODMatrix::getNumLoaded
double getNumLoaded() const
Returns the number of loaded vehicles.
Definition: ODMatrix.cpp:558
ROMAAssignments::getCapacity
static double getCapacity(const ROEdge *edge)
Definition: ROMAAssignments.cpp:64
ODDistrictCont.h
Option.h
CHRouter
Computes the shortest path through a contracted network.
Definition: CHRouter.h:61
SUMOAbstractRouter::recomputeCosts
double recomputeCosts(const std::vector< const E * > &edges, const V *const v, SUMOTime msTime, double *lengthp=nullptr) const
Definition: SUMOAbstractRouter.h:195
NamedObjectCont::end
IDMap::const_iterator end() const
Returns a reference to the end iterator for the internal map.
Definition: NamedObjectCont.h:149
ROEdge::getLength
double getLength() const
Returns the length of the edge.
Definition: ROEdge.h:204
SUMO_ATTR_KEY
@ SUMO_ATTR_KEY
Definition: SUMOXMLDefinitions.h:408
Distribution_Points.h
OutputDevice_String.h
ODMatrix::sortByBeginTime
void sortByBeginTime()
Definition: ODMatrix.cpp:693
SUMO_ATTR_VALUE
@ SUMO_ATTR_VALUE
Definition: SUMOXMLDefinitions.h:779
AStarRouter
Computes the shortest path through a network using the A* algorithm.
Definition: AStarRouter.h:77
ROEdge
A basic edge for routing applications.
Definition: ROEdge.h:72
OptionsIO::setArgs
static void setArgs(int argc, char **argv)
Stores the command line arguments for later parsing.
Definition: OptionsIO.cpp:54
ODMatrix::getNumDiscarded
double getNumDiscarded() const
Returns the number of discarded vehicles.
Definition: ODMatrix.cpp:570
config.h
RandHelper.h
DijkstraRouter.h
SystemFrame::checkOptions
static bool checkOptions()
checks shared options and sets StdDefs
Definition: SystemFrame.cpp:120
ODMatrix::applyCurve
void applyCurve(const Distribution_Points &ps)
Splits the stored cells dividing them on the given time line.
Definition: ODMatrix.cpp:592
SUMO_ATTR_END
@ SUMO_ATTR_END
weights: time range end
Definition: SUMOXMLDefinitions.h:680
ROEdge::getSpeedLimit
double getSpeedLimit() const
Returns the speed allowed on this edge.
Definition: ROEdge.h:219
SUMO_TAG_INTERVAL
@ SUMO_TAG_INTERVAL
an aggreagated-output interval
Definition: SUMOXMLDefinitions.h:159
MsgHandler::getErrorInstance
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
Definition: MsgHandler.cpp:81
ODDistrict.h
getTravelTime
double getTravelTime(const ROEdge *const edge, const ROVehicle *const, double)
Definition: marouter_main.cpp:107
SVC_IGNORING
@ SVC_IGNORING
vehicles ignoring classes
Definition: SUMOVehicleClass.h:135
RONet::getVehicleTypeSecure
SUMOVTypeParameter * getVehicleTypeSecure(const std::string &id)
Retrieves the named vehicle type.
Definition: RONet.cpp:278
VERSION_STRING
#define VERSION_STRING
Definition: config.h:210
SUMO_ATTR_NUMBER
@ SUMO_ATTR_NUMBER
Definition: SUMOXMLDefinitions.h:666
Named::getID
const std::string & getID() const
Returns the id.
Definition: Named.h:76
WRITE_ERROR
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:283
ROMARouteHandler.h
ROEdge.h
ODDistrictCont::makeDistricts
void makeDistricts(const std::map< std::string, std::pair< std::vector< std::string >, std::vector< std::string > > > &districts)
create districts from description
Definition: ODDistrictCont.cpp:88
OutputDevice::getDeviceByOption
static OutputDevice & getDeviceByOption(const std::string &name)
Returns the device described by the option.
Definition: OutputDevice.cpp:116
WRITE_MESSAGE
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:277
OptionsIO.h
ConstROEdgeVector
std::vector< const ROEdge * > ConstROEdgeVector
Definition: ROEdge.h:56
ODMatrix::writeDefaultAttrs
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:183
XMLSubSys.h
ROMAEdge.h
ODMatrix::getCells
const std::vector< ODCell * > & getCells()
Definition: ODMatrix.h:246
ROMAAssignments::getPenalizedTT
static double getPenalizedTT(const ROEdge *const e, const ROVehicle *const v, double t)
Returns the traveltime on an edge including penalties.
Definition: ROMAAssignments.cpp:450
ROMAAssignments::sue
void sue(const int maxOuterIteration, const int maxInnerIteration, const int kPaths, const double penalty, const double tolerance, const std::string routeChoiceMethod)
Definition: ROMAAssignments.cpp:342
ROLoader::loadWeights
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:252