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-2026 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>
55#include <utils/xml/XMLSubSys.h>
56#include <od/ODCell.h>
57#include <od/ODDistrict.h>
58#include <od/ODDistrictCont.h>
60#include <od/ODMatrix.h>
61#include <router/ROCCHMetrics.h>
62#include <router/ROEdge.h>
63#include <router/ROLoader.h>
64#include <router/RONet.h>
65#include <router/RORoute.h>
66#include <router/RORoutable.h>
67
68#include "ROMAFrame.h"
69#include "ROMAAssignments.h"
70#include "ROMAEdgeBuilder.h"
71#include "ROMARouteHandler.h"
72#include "ROMAEdge.h"
73
74
75// ===========================================================================
76// Method implementation
77// ===========================================================================
78/* -------------------------------------------------------------------------
79 * data processing methods
80 * ----------------------------------------------------------------------- */
86void
87initNet(RONet& net, ROLoader& loader, OptionsCont& oc) {
88 // load the net
89 ROMAEdgeBuilder builder;
90 ROEdge::setGlobalOptions(oc.getBool("weights.interpolate"));
91 loader.loadNet(net, builder);
92 // load the weights when wished/available
93 if (oc.isSet("weight-files")) {
94 loader.loadWeights(net, "weight-files", oc.getString("weight-attribute"), false, oc.getBool("weights.expand"));
95 }
96 if (oc.isSet("lane-weight-files")) {
97 loader.loadWeights(net, "lane-weight-files", oc.getString("weight-attribute"), true, oc.getBool("weights.expand"));
98 }
99}
100
101
102double
103getTravelTime(const ROEdge* const edge, const ROVehicle* const /* veh */, double /* time */) {
104 return edge->getLength() / edge->getSpeedLimit();
105}
106
107
111void
113 OptionsCont::createDeviceByOption("all-pairs-output");
114 OutputDevice& outFile = OptionsCont::getDeviceByOption("all-pairs-output");
115 // build the router
116 typedef DijkstraRouter<ROEdge, ROVehicle> Dijkstra;
117 Dijkstra router(ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &getTravelTime);
119 const int numInternalEdges = net.getInternalEdgeNumber();
120 const int numTotalEdges = (int)net.getEdgeNumber();
121 for (int i = numInternalEdges; i < numTotalEdges; i++) {
122 const Dijkstra::EdgeInfo& ei = router.getEdgeInfo(i);
123 if (!ei.edge->isInternal()) {
124 router.compute(ei.edge, nullptr, nullptr, 0, into);
125 double fromEffort = router.getEffort(ei.edge, nullptr, 0);
126 for (int j = numInternalEdges; j < numTotalEdges; j++) {
127 double heuTT = router.getEdgeInfo(j).effort - fromEffort;
128 outFile << heuTT;
129 /*
130 if (heuTT >
131 ei.edge->getDistanceTo(router.getEdgeInfo(j).edge)
132 && router.getEdgeInfo(j).traveltime != std::numeric_limits<double>::max()
133 ) {
134 std::cout << " heuristic failure: from=" << ei.edge->getID() << " to=" << router.getEdgeInfo(j).edge->getID()
135 << " fromEffort=" << fromEffort << " heuTT=" << heuTT << " airDist=" << ei.edge->getDistanceTo(router.getEdgeInfo(j).edge) << "\n";
136 }
137 */
138 }
139 }
140 }
141}
142
143
147void
149 // build the router
151 const std::string measure = oc.getString("weight-attribute");
152 const std::string routingAlgorithm = oc.getString("routing-algorithm");
153 const double priorityFactor = oc.getFloat("weights.priority-factor");
154 SUMOTime begin = string2time(oc.getString("begin"));
155 SUMOTime end = string2time(oc.getString("end"));
156 if (oc.isDefault("begin") && matrix.getBegin() >= 0) {
157 begin = matrix.getBegin();
158 }
159 if (oc.isDefault("end")) {
160 end = matrix.getEnd() >= 0 ? matrix.getEnd() : SUMOTime_MAX;
161 }
163 if (measure == "traveltime" && priorityFactor == 0) {
164 if (routingAlgorithm == "dijkstra") {
165 router = new DijkstraRouter<ROEdge, ROVehicle>(ROEdge::getAllEdges(), oc.getBool("ignore-errors"), ttOp, nullptr, false, nullptr, net.hasPermissions());
166 } else if (routingAlgorithm == "astar") {
167 router = new AStarRouter<ROEdge, ROVehicle, ROMapMatcher>(ROEdge::getAllEdges(), oc.getBool("ignore-errors"), ttOp, nullptr, net.hasPermissions());
168 } else if (routingAlgorithm == "CH" && !net.hasPermissions()) {
169 const SUMOTime weightPeriod = (oc.isSet("weight-files") ?
170 string2time(oc.getString("weight-period")) :
172 router = new CHRouter<ROEdge, ROVehicle>(ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &ROEdge::getTravelTimeStatic, SVC_IGNORING, weightPeriod, net.hasPermissions(), false);
173 } else if (routingAlgorithm == "CHWrapper" || routingAlgorithm == "CH") {
174 // use CHWrapper instead of CH if the net has permissions
175 const SUMOTime weightPeriod = (oc.isSet("weight-files") ?
176 string2time(oc.getString("weight-period")) :
180 begin, end, weightPeriod, net.hasPermissions(), oc.getInt("routing-threads"));
181 } else if (routingAlgorithm == "CCH") {
182 // One weight-independent hierarchy over the union graph and one
183 // customized metric for the default vehicle's type, filled from
184 // the travel times of the current assignment iteration.
185 // ROMAAssignments resets the router after every iteration (where
186 // CH rebuilds its whole hierarchy); the reset hook flags the
187 // metric for re-customization at the next query, so every
188 // iteration routes on exactly the travel times a Dijkstra query
189 // would see. Like CH, the metric cannot follow the k shortest
190 // path penalties (see ROMAFrame::checkOptions).
191 ROCCHGraph* cchGraph = new ROCCHGraph(ROEdge::getAllEdges());
194 ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &ROEdge::getTravelTimeStatic, nullptr, net.hasPermissions());
197 oc.getBool("ignore-errors"), fallback, nullptr, &ROCCHMetrics::reset);
198 } else {
199 throw ProcessError(TLF("Unknown routing Algorithm '%'!", routingAlgorithm));
200 }
201 } else {
203 if (measure == "traveltime") {
204 if (ROEdge::initPriorityFactor(priorityFactor)) {
206 } else {
208 }
209 } else if (measure == "CO") {
210 op = &ROEdge::getEmissionEffort<PollutantsInterface::CO>;
211 } else if (measure == "CO2") {
212 op = &ROEdge::getEmissionEffort<PollutantsInterface::CO2>;
213 } else if (measure == "PMx") {
214 op = &ROEdge::getEmissionEffort<PollutantsInterface::PM_X>;
215 } else if (measure == "HC") {
216 op = &ROEdge::getEmissionEffort<PollutantsInterface::HC>;
217 } else if (measure == "NOx") {
218 op = &ROEdge::getEmissionEffort<PollutantsInterface::NO_X>;
219 } else if (measure == "fuel") {
220 op = &ROEdge::getEmissionEffort<PollutantsInterface::FUEL>;
221 } else if (measure == "electricity") {
222 op = &ROEdge::getEmissionEffort<PollutantsInterface::ELEC>;
223 } else if (measure == "noise") {
225 } else {
227 }
228 if (measure != "traveltime" && !net.hasLoadedEffort()) {
229 WRITE_WARNINGF(TL("No weight data was loaded for attribute '%'."), measure);
230 }
231 router = new DijkstraRouter<ROEdge, ROVehicle>(ROEdge::getAllEdges(), oc.getBool("ignore-errors"), op, ttOp, false, nullptr, net.hasPermissions());
232 }
233 try {
234 const RORouterProvider provider(router, nullptr, nullptr, nullptr);
235 // prepare the output
236 net.openOutput(oc);
237 // process route definitions
238 if (oc.isSet("timeline")) {
239 matrix.applyCurve(matrix.parseTimeLine(oc.getStringVector("timeline"), oc.getBool("timeline.day-in-hours")));
240 }
241 matrix.sortByBeginTime();
242 bool haveOutput = OptionsCont::createDeviceByOption("netload-output", "meandata");
243 ROVehicle defaultVehicle(SUMOVehicleParameter(), nullptr, net.getVehicleTypeSecure(DEFAULT_VTYPE_ID), &net);
244 ROMAAssignments a(begin, end, oc.getBool("additive-traffic"), oc.getFloat("weight-adaption"),
245 oc.getInt("max-alternatives"), oc.getBool("capacities.default"), net, matrix, *router,
246 haveOutput ? &OptionsCont::getDeviceByOption("netload-output") : nullptr);
247 a.resetFlows();
248#ifdef HAVE_FOX
249 // this is just to init the CHRouter with the default vehicle
250 router->reset(&defaultVehicle);
251 const int maxNumThreads = oc.getInt("routing-threads");
252 while ((int)net.getThreadPool().size() < maxNumThreads) {
253 new RONet::WorkerThread(net.getThreadPool(), provider);
254 }
255#endif
256 std::string assignMethod = oc.getString("assignment-method");
257 if (assignMethod == "UE") {
258 WRITE_WARNING(TL("Deterministic user equilibrium ('UE') is not implemented yet, using stochastic method ('SUE')."));
259 assignMethod = "SUE";
260 }
261 if (assignMethod == "incremental") {
262 a.incremental(oc.getInt("max-iterations"), oc.getBool("verbose"));
263 } else if (assignMethod == "SUE") {
264 a.sue(oc.getInt("max-iterations"), oc.getInt("max-inner-iterations"),
265 oc.getInt("paths"), oc.getFloat("paths.penalty"), oc.getFloat("tolerance"), oc.getString("route-choice-method"));
266 }
267 // update path costs and output
268 OutputDevice* dev = net.getRouteOutput();
269 if (dev != nullptr) {
270 std::vector<std::string> tazParamKeys;
271 if (oc.isSet("taz-param")) {
272 tazParamKeys = oc.getStringVector("taz-param");
273 }
274 std::map<SUMOTime, std::string> sortedOut;
275 SUMOTime lastEnd = -1;
276 int num = 0;
277 for (const ODCell* const c : matrix.getCells()) {
278 if (c->begin >= end || c->end <= begin ||
279 c->pathsVector.empty() || c->pathsVector.front()->getEdgeVector().empty()) {
280 continue;
281 }
282 if (lastEnd >= 0 && lastEnd <= c->begin) {
283 for (std::map<SUMOTime, std::string>::const_iterator desc = sortedOut.begin(); desc != sortedOut.end(); ++desc) {
284 dev->writePreformattedTag(desc->second);
285 }
286 sortedOut.clear();
287 }
288 if (c->departures.empty()) {
289 const SUMOTime b = MAX2(begin, c->begin);
290 const SUMOTime e = MIN2(end, c->end);
291 const int numVehs = int(c->vehicleNumber * (double)(e - b) / (double)(c->end - c->begin));
293 od.openTag(SUMO_TAG_FLOW).writeAttr(SUMO_ATTR_ID, oc.getString("prefix") + toString(num++));
295 od.writeAttr(SUMO_ATTR_NUMBER, numVehs);
296 matrix.writeDefaultAttrs(od, oc.getBool("ignore-vehicle-type"), c);
298 for (const std::shared_ptr<RORoute>& 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 od.closeTag();
304 sortedOut[c->begin] += od.getString();
305 } else {
306 const bool ignoreType = oc.getBool("ignore-vehicle-type");
307 for (auto deps : c->departures) {
308 if (deps.first >= end || deps.first < begin) {
309 continue;
310 }
311 const std::string routeDistId = c->origin + "_" + c->destination + "_" + time2string(c->begin) + "_" + time2string(c->end);
312 for (const SUMOVehicleParameter& veh : deps.second) {
314
315 veh.write(od, OptionsCont::getOptions(), SUMO_TAG_VEHICLE, ignoreType || veh.vtypeid == DEFAULT_VTYPE_ID ? "" : veh.vtypeid);
317 for (const std::shared_ptr<RORoute>& r : c->pathsVector) {
318 r->setCosts(router->recomputeCosts(r->getEdgeVector(), &defaultVehicle, begin));
319 r->writeXMLDefinition(od, nullptr, true, true, false, false);
320 }
321 od.closeTag();
322 if (!tazParamKeys.empty()) {
324 if (tazParamKeys.size() > 1) {
325 od.openTag(SUMO_TAG_PARAM).writeAttr(SUMO_ATTR_KEY, tazParamKeys[1]).writeAttr(SUMO_ATTR_VALUE, c->destination).closeTag();
326 }
327 }
328 od.closeTag();
329 sortedOut[deps.first] += od.getString();
330 }
331 }
332 }
333 if (c->end > lastEnd) {
334 lastEnd = c->end;
335 }
336 }
337 for (std::map<SUMOTime, std::string>::const_iterator desc = sortedOut.begin(); desc != sortedOut.end(); ++desc) {
338 dev->writePreformattedTag(desc->second);
339 }
340 haveOutput = true;
341 }
342 if (!haveOutput) {
343 throw ProcessError(TL("No output file given."));
344 }
345 // end the processing
346 net.cleanup();
347 } catch (ProcessError&) {
348 net.cleanup();
349 throw;
350 }
351}
352
353
354/* -------------------------------------------------------------------------
355 * main
356 * ----------------------------------------------------------------------- */
357int
358main(int argc, char** argv) {
360 oc.setApplicationDescription(TL("Import O/D-matrices for macroscopic traffic assignment to generate SUMO routes."));
361 oc.setApplicationName("marouter", "Eclipse SUMO marouter " VERSION_STRING);
362 int ret = 0;
363 RONet* net = nullptr;
364 try {
367 OptionsIO::setArgs(argc, argv);
369 if (oc.processMetaOptions(argc < 2)) {
371 return 0;
372 }
374 XMLSubSys::setValidation(oc.getString("xml-validation"), oc.getString("xml-validation.net"), oc.getString("xml-validation.routes"));
377 throw ProcessError();
378 }
380 // load data
381 ROLoader loader(oc, false, false);
382 net = new RONet();
383 initNet(*net, loader, oc);
384 if (oc.isSet("all-pairs-output")) {
385 computeAllPairs(*net, oc);
386 if (net->getDistricts().empty()) {
387 delete net;
389 if (ret == 0) {
390 std::cout << "Success." << std::endl;
391 }
392 return ret;
393 }
394 }
395 if (net->getDistricts().empty()) {
396 WRITE_WARNING(TL("No districts loaded, will use edge ids!"));
397 }
398 // load districts
399 ODDistrictCont districts;
400 districts.makeDistricts(net->getDistricts());
401 // load the matrix
402 ODMatrix matrix(districts, oc.getFloat("scale"));
403 matrix.loadMatrix(oc);
404 ROMARouteHandler handler(matrix);
405 matrix.loadRoutes(oc, handler);
406 if (matrix.getNumLoaded() == matrix.getNumDiscarded()) {
407 throw ProcessError(TL("No valid vehicles loaded."));
408 }
409 if (MsgHandler::getErrorInstance()->wasInformed() && !oc.getBool("ignore-errors")) {
410 throw ProcessError(TL("Loading failed."));
411 }
413 WRITE_MESSAGE(toString(matrix.getNumLoaded() - matrix.getNumDiscarded()) + " valid vehicles loaded (total seen: " + toString(matrix.getNumLoaded()) + ").");
414
415 // build routes and parse the incremental rates if the incremental method is choosen.
416 try {
417 computeRoutes(*net, oc, matrix);
418 } catch (XERCES_CPP_NAMESPACE::SAXParseException& e) {
419 WRITE_ERROR(toString(e.getLineNumber()));
420 ret = 1;
421 } catch (XERCES_CPP_NAMESPACE::SAXException& e) {
422 WRITE_ERROR(XMLSubSys::transcode(e.getMessage()));
423 ret = 1;
424 }
425 if (MsgHandler::getErrorInstance()->wasInformed() || ret != 0) {
426 throw ProcessError();
427 }
428 } catch (const ProcessError& e) {
429 if (std::string(e.what()) != std::string("Process Error") && std::string(e.what()) != std::string("")) {
430 WRITE_ERROR(e.what());
431 }
432 MsgHandler::getErrorInstance()->inform("Quitting (on error).", false);
433 ret = 1;
434 }
435
436 delete net;
438 if (ret == 0) {
439 std::cout << "Success." << std::endl;
440 }
441 return ret;
442}
443
444
445/****************************************************************************/
long long int SUMOTime
Definition GUI.h:36
#define WRITE_WARNINGF(...)
Definition MsgHandler.h:299
#define WRITE_MESSAGE(msg)
Definition MsgHandler.h:300
#define WRITE_ERROR(msg)
Definition MsgHandler.h:307
#define WRITE_WARNING(msg)
Definition MsgHandler.h:298
#define TL(string)
Definition MsgHandler.h:316
#define TLF(string,...)
Definition MsgHandler.h:318
CCHGraph< ROEdge, ROVehicle > ROCCHGraph
the ROEdge instantiation of the CCH graph mapping
std::vector< const ROEdge * > ConstROEdgeVector
Definition ROEdge.h:57
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition SUMOTime.cpp:47
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
Definition SUMOTime.cpp:107
#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:80
T MAX2(T a, T b)
Definition StdDefs.h:86
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:57
Computes the shortest path through a network using the A* algorithm.
Definition AStarRouter.h:76
Metric-independent RoutingKit CCH topology over the PURE road graph.
Definition CCHGraph.h:97
Contraction-hierarchy router over the edge graph mapped by GRAPH.
Definition CCHRouter.h:83
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
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:247
double getNumLoaded() const
Returns the number of loaded vehicles.
Definition ODMatrix.cpp:607
void sortByBeginTime()
Definition ODMatrix.cpp:764
void applyCurve(const Distribution_Points &ps)
Splits the stored cells dividing them on the given time line.
Definition ODMatrix.cpp:641
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:739
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:204
SUMOTime getBegin() const
Definition ODMatrix.h:253
void loadMatrix(OptionsCont &oc)
read a matrix in one of several formats
Definition ODMatrix.cpp:654
void loadRoutes(OptionsCont &oc, SUMOSAXHandler &handler)
read SUMO routes
Definition ODMatrix.cpp:722
double getNumDiscarded() const
Returns the number of discarded vehicles.
Definition ODMatrix.cpp:619
A storage for options typed value containers)
Definition OptionsCont.h:92
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)
static OutputDevice & getDeviceByOption(const std::string &name)
Returns the device described by the option.
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.
static bool createDeviceByOption(const std::string &optionName, const std::string &rootElement="", const std::string &schemaFile="", const int maximumDepth=2)
Creates the device using the output definition stored in the named option.
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:59
static void getOptions(const bool commandLineOnly=false)
Parses the command line arguments and loads the configuration.
Definition OptionsIO.cpp:75
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 & 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.
OutputDevice & writeAttr(const ATTR_TYPE &attr, const T &val, const bool isNull=false, const bool escape=false)
writes a named attribute
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
static void reset(const ROVehicle *veh)
the edge weights changed behind the metrics (marouter after an assignment iteration,...
static void init(const ROCCHGraph *graph, ROCCHGraph::EffortOperation effort, SUMOTime begin, SUMOTime weightPeriod)
install the shared graph, effort function and weight-period grid (call once, before routing); weightP...
static const RoutingKit::CustomizableContractionHierarchyMetric * get(SUMOVehicleClass vClass, SUMOTime time, const ROVehicle *veh)
the metric for the vehicle's type at a query time, built on first use; matches CCHRouter::MetricProvi...
A basic edge for routing applications.
Definition ROEdge.h:73
static double getStoredEffort(const ROEdge *const edge, const ROVehicle *const, double time)
Definition ROEdge.h:512
static bool initPriorityFactor(double priorityFactor)
initialize priority factor range
Definition ROEdge.cpp:471
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:439
double getSpeedLimit() const
Returns the speed allowed on this edge.
Definition ROEdge.h:240
static double getNoiseEffort(const ROEdge *const edge, const ROVehicle *const veh, double time)
Definition ROEdge.cpp:241
double getLength() const
Returns the length of the edge.
Definition ROEdge.h:225
static void setGlobalOptions(const bool interpolate)
Definition ROEdge.h:527
static double getTravelTimeStatic(const ROEdge *const edge, const ROVehicle *const veh, double time)
Returns the travel time for the given edge.
Definition ROEdge.h:423
static const ROEdgeVector & getAllEdges()
Returns all ROEdges.
Definition ROEdge.cpp:377
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:264
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:410
void cleanup()
closes the file output for computed routes and deletes associated threads if necessary
Definition RONet.cpp:386
void openOutput(const OptionsCont &options)
Opens the output for computed routes.
Definition RONet.cpp:341
int getInternalEdgeNumber() const
Returns the number of internal edges the network contains.
Definition RONet.cpp:893
OutputDevice * getRouteOutput(const bool alternative=false)
Definition RONet.h:495
bool hasPermissions() const
Definition RONet.cpp:957
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:167
int getEdgeNumber() const
Returns the total number of edges the network contains including internal edges.
Definition RONet.cpp:887
bool hasLoadedEffort() const
whether efforts were loaded from file
Definition RONet.cpp:968
A vehicle as used by router.
Definition ROVehicle.h:51
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 void close()
Closes all of an applications subsystems.
static bool checkOptions(OptionsCont &oc)
checks shared options and sets StdDefs
static void initRandGlobal(SumoRNG *which=nullptr)
Reads the given random number options and initialises the random number generator in accordance.
static void initOutputOptions()
init message output (console and log files) according to the options
static void setValidation(const std::string &validationScheme, const std::string &netValidationScheme, const std::string &routeValidationScheme)
Enables or disables validation.
Definition XMLSubSys.cpp:87
static std::string transcode(const XMLCh *const data, int length=-1)
converts a 0-terminated XMLCh* array (usually UTF-16, stemming from Xerces) into std::string in UTF-8
static void init()
Initialises the xml-subsystem.
Definition XMLSubSys.cpp:60
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