Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
marouter_main.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2024 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>
54#include <utils/xml/XMLSubSys.h>
55#include <od/ODCell.h>
56#include <od/ODDistrict.h>
57#include <od/ODDistrictCont.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 * ----------------------------------------------------------------------- */
84void
85initNet(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
100double
101getTravelTime(const ROEdge* const edge, const ROVehicle* const /* veh */, double /* time */) {
102 return edge->getLength() / edge->getSpeedLimit();
103}
104
105
109void
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);
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
145void
147 // build the router
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, ROMapMatcher>(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")) :
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")) :
178 begin, end, weightPeriod, net.hasPermissions(), oc.getInt("routing-threads"));
179 } else {
180 throw ProcessError(TLF("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_WARNINGF(TL("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(TL("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 * (double)(e - b) / (double)(c->end - c->begin));
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 const bool ignoreType = oc.getBool("ignore-vehicle-type");
288 for (auto deps : c->departures) {
289 if (deps.first >= end || deps.first < begin) {
290 continue;
291 }
292 const std::string routeDistId = c->origin + "_" + c->destination + "_" + time2string(c->begin) + "_" + time2string(c->end);
293 for (const SUMOVehicleParameter& veh : deps.second) {
295
296 veh.write(od, OptionsCont::getOptions(), SUMO_TAG_VEHICLE, ignoreType || veh.vtypeid == DEFAULT_VTYPE_ID ? "" : veh.vtypeid);
298 for (RORoute* const r : c->pathsVector) {
299 r->setCosts(router->recomputeCosts(r->getEdgeVector(), &defaultVehicle, begin));
300 r->writeXMLDefinition(od, nullptr, true, true, false, false);
301 }
302 od.closeTag();
303 if (!tazParamKeys.empty()) {
305 if (tazParamKeys.size() > 1) {
306 od.openTag(SUMO_TAG_PARAM).writeAttr(SUMO_ATTR_KEY, tazParamKeys[1]).writeAttr(SUMO_ATTR_VALUE, c->destination).closeTag();
307 }
308 }
309 od.closeTag();
310 sortedOut[deps.first] += od.getString();
311 }
312 }
313 }
314 if (c->end > lastEnd) {
315 lastEnd = c->end;
316 }
317 }
318 for (std::map<SUMOTime, std::string>::const_iterator desc = sortedOut.begin(); desc != sortedOut.end(); ++desc) {
319 dev->writePreformattedTag(desc->second);
320 }
321 haveOutput = true;
322 }
323 if (!haveOutput) {
324 throw ProcessError(TL("No output file given."));
325 }
326 // end the processing
327 net.cleanup();
328 } catch (ProcessError&) {
329 net.cleanup();
330 throw;
331 }
332}
333
334
335/* -------------------------------------------------------------------------
336 * main
337 * ----------------------------------------------------------------------- */
338int
339main(int argc, char** argv) {
341 oc.setApplicationDescription(TL("Import O/D-matrices for macroscopic traffic assignment to generate SUMO routes."));
342 oc.setApplicationName("marouter", "Eclipse SUMO marouter Version " VERSION_STRING);
343 int ret = 0;
344 RONet* net = nullptr;
345 try {
348 OptionsIO::setArgs(argc, argv);
350 if (oc.processMetaOptions(argc < 2)) {
352 return 0;
353 }
355 XMLSubSys::setValidation(oc.getString("xml-validation"), oc.getString("xml-validation.net"), oc.getString("xml-validation.routes"));
358 throw ProcessError();
359 }
361 // load data
362 ROLoader loader(oc, false, false);
363 net = new RONet();
364 initNet(*net, loader, oc);
365 if (oc.isSet("all-pairs-output")) {
366 computeAllPairs(*net, oc);
367 if (net->getDistricts().empty()) {
368 delete net;
370 if (ret == 0) {
371 std::cout << "Success." << std::endl;
372 }
373 return ret;
374 }
375 }
376 if (net->getDistricts().empty()) {
377 WRITE_WARNING(TL("No districts loaded, will use edge ids!"));
378 }
379 // load districts
380 ODDistrictCont districts;
381 districts.makeDistricts(net->getDistricts());
382 // load the matrix
383 ODMatrix matrix(districts, oc.getFloat("scale"));
384 matrix.loadMatrix(oc);
385 ROMARouteHandler handler(matrix);
386 matrix.loadRoutes(oc, handler);
387 if (matrix.getNumLoaded() == matrix.getNumDiscarded()) {
388 throw ProcessError(TL("No valid vehicles loaded."));
389 }
390 if (MsgHandler::getErrorInstance()->wasInformed() && !oc.getBool("ignore-errors")) {
391 throw ProcessError(TL("Loading failed."));
392 }
394 WRITE_MESSAGE(toString(matrix.getNumLoaded() - matrix.getNumDiscarded()) + " valid vehicles loaded (total seen: " + toString(matrix.getNumLoaded()) + ").");
395
396 // build routes and parse the incremental rates if the incremental method is choosen.
397 try {
398 computeRoutes(*net, oc, matrix);
399 } catch (XERCES_CPP_NAMESPACE::SAXParseException& e) {
400 WRITE_ERROR(toString(e.getLineNumber()));
401 ret = 1;
402 } catch (XERCES_CPP_NAMESPACE::SAXException& e) {
403 WRITE_ERROR(StringUtils::transcode(e.getMessage()));
404 ret = 1;
405 }
406 if (MsgHandler::getErrorInstance()->wasInformed() || ret != 0) {
407 throw ProcessError();
408 }
409 } catch (const ProcessError& e) {
410 if (std::string(e.what()) != std::string("Process Error") && std::string(e.what()) != std::string("")) {
411 WRITE_ERROR(e.what());
412 }
413 MsgHandler::getErrorInstance()->inform("Quitting (on error).", false);
414 ret = 1;
415 }
416
417 delete net;
419 if (ret == 0) {
420 std::cout << "Success." << std::endl;
421 }
422 return ret;
423}
424
425
426/****************************************************************************/
long long int SUMOTime
Definition GUI.h:36
#define WRITE_WARNINGF(...)
Definition MsgHandler.h:296
#define WRITE_MESSAGE(msg)
Definition MsgHandler.h:297
#define WRITE_ERROR(msg)
Definition MsgHandler.h:304
#define WRITE_WARNING(msg)
Definition MsgHandler.h:295
#define TL(string)
Definition MsgHandler.h:315
#define TLF(string,...)
Definition MsgHandler.h:317
std::vector< const ROEdge * > ConstROEdgeVector
Definition ROEdge.h:56
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition SUMOTime.cpp:46
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
Definition SUMOTime.cpp:69
#define SUMOTime_MAX
Definition SUMOTime.h:34
const std::string DEFAULT_VTYPE_ID
@ SVC_IGNORING
vehicles ignoring classes
@ SUMO_TAG_VEHICLE
description of a vehicle
@ SUMO_TAG_ROUTE_DISTRIBUTION
distribution of a route
@ SUMO_TAG_FLOW
a flow definition using from and to edges or a route
@ SUMO_TAG_PARAM
parameter associated to a certain key
@ SUMO_ATTR_NUMBER
@ 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:76
T MAX2(T a, T b)
Definition StdDefs.h:82
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.
virtual void inform(std::string msg, bool addType=true)
adds a new error to the list
static void initOutputOptions()
init output options
virtual void clear(bool resetInformed=true)
Clears information whether an error occurred previously and print aggregated message summary.
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
const std::vector< ODCell * > & getCells()
Definition ODMatrix.h:245
double getNumLoaded() const
Returns the number of loaded vehicles.
Definition ODMatrix.cpp:603
void sortByBeginTime()
Definition ODMatrix.cpp:760
void applyCurve(const Distribution_Points &ps)
Splits the stored cells dividing them on the given time line.
Definition ODMatrix.cpp:637
SUMOTime getEnd() const
Definition ODMatrix.h:255
Distribution_Points parseTimeLine(const std::vector< std::string > &def, bool timelineDayInHours)
split the given timeline
Definition ODMatrix.cpp:735
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:207
SUMOTime getBegin() const
Definition ODMatrix.h:251
void loadMatrix(OptionsCont &oc)
read a matrix in one of several formats
Definition ODMatrix.cpp:650
void loadRoutes(OptionsCont &oc, SUMOSAXHandler &handler)
read SUMO routes
Definition ODMatrix.cpp:718
double getNumDiscarded() const
Returns the number of discarded vehicles.
Definition ODMatrix.cpp:615
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.
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:74
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.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
OutputDevice & writePreformattedTag(const std::string &val)
writes a preformatted tag to the device but ensures that any pending tags are closed
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.
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:72
static double getStoredEffort(const ROEdge *const edge, const ROVehicle *const, double time)
Definition ROEdge.h:486
static bool initPriorityFactor(double priorityFactor)
initialize priority factor range
Definition ROEdge.cpp:464
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:446
double getSpeedLimit() const
Returns the speed allowed on this edge.
Definition ROEdge.h:239
static double getNoiseEffort(const ROEdge *const edge, const ROVehicle *const veh, double time)
Definition ROEdge.cpp:235
double getLength() const
Returns the length of the edge.
Definition ROEdge.h:224
static void setGlobalOptions(const bool interpolate)
Definition ROEdge.h:501
static double getTravelTimeStatic(const ROEdge *const edge, const ROVehicle *const veh, double time)
Returns the travel time for the given edge.
Definition ROEdge.h:432
static const ROEdgeVector & getAllEdges()
Returns all ROEdges.
Definition ROEdge.cpp:372
The data loader.
Definition ROLoader.h:54
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:254
virtual void loadNet(RONet &toFill, ROAbstractEdgeBuilder &eb)
Loads the network.
Definition ROLoader.cpp:108
assignment methods
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.
Parser and container for routes during their loading.
The router's network representation.
Definition RONet.h:63
SUMOVTypeParameter * getVehicleTypeSecure(const std::string &id)
Retrieves the named vehicle type.
Definition RONet.cpp:364
void cleanup()
closes the file output for computed routes and deletes associated threads if necessary
Definition RONet.cpp:340
void openOutput(const OptionsCont &options)
Opens the output for computed routes.
Definition RONet.cpp:292
int getInternalEdgeNumber() const
Returns the number of internal edges the network contains.
Definition RONet.cpp:801
OutputDevice * getRouteOutput(const bool alternative=false)
Definition RONet.h:441
bool hasPermissions() const
Definition RONet.cpp:865
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:146
int getEdgeNumber() const
Returns the total number of edges the network contains including internal edges.
Definition RONet.cpp:795
bool hasLoadedEffort() const
whether efforts were loaded from file
Definition RONet.cpp:876
A complete router's route.
Definition RORoute.h:52
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.
virtual void reset(const V *const vehicle)
reset internal caches, used by CHRouter
virtual double recomputeCosts(const std::vector< const E * > &edges, const V *const v, SUMOTime msTime, double *lengthp=nullptr) const
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
static void close()
Closes all of an applications subsystems.
static bool checkOptions(OptionsCont &oc)
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:83
static void init()
Initialises the xml-subsystem.
Definition XMLSubSys.cpp:56
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:49