33#include <xercesc/sax/SAXException.hpp>
34#include <xercesc/sax/SAXParseException.hpp>
80 if (oc.
isSet(
"weight-files")) {
83 if (oc.
isSet(
"lane-weight-files")) {
99 const std::string measure = oc.
getString(
"weight-attribute");
100 const std::string routingAlgorithm = oc.
getString(
"routing-algorithm");
101 const double priorityFactor = oc.
getFloat(
"weights.priority-factor");
106 if (oc.
isSet(
"restriction-params") &&
107 (routingAlgorithm ==
"CH" || routingAlgorithm ==
"CHWrapper")) {
108 throw ProcessError(
TLF(
"Routing algorithm '%' does not support restriction-params", routingAlgorithm));
111 if (measure ==
"traveltime" && priorityFactor == 0) {
112 if (routingAlgorithm ==
"dijkstra") {
114 }
else if (routingAlgorithm ==
"astar") {
116 std::shared_ptr<const AStar::LookupTable> lookup;
117 if (oc.
isSet(
"astar.all-distances")) {
119 }
else if (oc.
isSet(
"astar.landmark-distances")) {
124 std::vector<ReversedEdge<ROEdge, ROVehicle>*> reversed;
126 reversed.push_back(edge->getReversedRoutingEdge());
133 lookup = std::make_shared<const AStar::LMLT>(oc.
getString(
"astar.landmark-distances"),
ROEdge::getAllEdges(), &forward, &backward, &defaultVehicle,
134 oc.
isSet(
"astar.save-landmark-distances") ? oc.
getString(
"astar.save-landmark-distances") :
"", oc.
getInt(
"routing-threads"));
143 }
else if (routingAlgorithm ==
"CHWrapper" || routingAlgorithm ==
"CH") {
152 throw ProcessError(
TLF(
"Unknown routing Algorithm '%'!", routingAlgorithm));
155 if (measure ==
"traveltime") {
159 }
else if (measure ==
"CO") {
160 op = &ROEdge::getEmissionEffort<PollutantsInterface::CO>;
161 }
else if (measure ==
"CO2") {
162 op = &ROEdge::getEmissionEffort<PollutantsInterface::CO2>;
163 }
else if (measure ==
"PMx") {
164 op = &ROEdge::getEmissionEffort<PollutantsInterface::PM_X>;
165 }
else if (measure ==
"HC") {
166 op = &ROEdge::getEmissionEffort<PollutantsInterface::HC>;
167 }
else if (measure ==
"NOx") {
168 op = &ROEdge::getEmissionEffort<PollutantsInterface::NO_X>;
169 }
else if (measure ==
"fuel") {
170 op = &ROEdge::getEmissionEffort<PollutantsInterface::FUEL>;
171 }
else if (measure ==
"electricity") {
172 op = &ROEdge::getEmissionEffort<PollutantsInterface::ELEC>;
173 }
else if (measure ==
"noise") {
179 WRITE_WARNINGF(
TL(
"No weight data was loaded for attribute '%'."), measure);
190 oc.
isSet(
"restriction-params"),
191 oc.
getFloat(
"railway.max-train-length"));
216 oc.
setApplicationDescription(
TL(
"Shortest path router and DUE computer for the microscopic, multi-modal traffic simulation SUMO."));
219 RONet* net =
nullptr;
232 if (oc.
getInt(
"routing-threads") > 1) {
249 }
catch (XERCES_CPP_NAMESPACE::SAXParseException& e) {
252 }
catch (XERCES_CPP_NAMESPACE::SAXException& e) {
260 if (std::string(e.what()) != std::string(
"Process Error") && std::string(e.what()) != std::string(
"")) {
266 }
catch (
const std::exception& e) {
267 if (std::string(e.what()) != std::string(
"")) {
280 std::cout <<
"Success." << std::endl;
#define WRITE_WARNINGF(...)
IntermodalRouter< ROEdge, ROLane, RONode, ROVehicle > ROIntermodalRouter
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
const std::string DEFAULT_VTYPE_ID
@ SVC_IGNORING
vehicles ignoring classes
double gWeightsRandomFactor
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Computes the shortest path through a network using the A* algorithm.
Computes the shortest path through a contracted network.
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
static void setFactory(Factory func)
Sets the factory function to use for new MsgHandlers.
static MsgHandler * create(MsgType type)
A storage for options typed value containers)
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)
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.
static void getOptions(const bool commandLineOnly=false)
Parses the command line arguments and loads the configuration.
Interface for building instances of duarouter-edges.
static void fillOptions()
Inserts options used by duarouter into the OptionsCont-singleton.
static bool checkOptions()
Checks set options from the OptionsCont-singleton for being valid for usage within duarouter.
A basic edge for routing applications.
static double getStoredEffort(const ROEdge *const edge, const ROVehicle *const, double time)
static bool initPriorityFactor(double priorityFactor)
initialize priority factor range
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)
static double getNoiseEffort(const ROEdge *const edge, const ROVehicle *const veh, double time)
static double getTravelTimeStaticRandomized(const ROEdge *const edge, const ROVehicle *const veh, double time)
static void setGlobalOptions(const bool interpolate)
static double getTravelTimeStatic(const ROEdge *const edge, const ROVehicle *const veh, double time)
Returns the travel time for the given edge.
static const ROEdgeVector & getAllEdges()
Returns all ROEdges.
bool loadWeights(RONet &net, const std::string &optionName, const std::string &measure, const bool useLanes, const bool boundariesOverride)
Loads the net weights.
void processRoutes(const SUMOTime start, const SUMOTime end, const SUMOTime increment, RONet &net, const RORouterProvider &provider)
Loads routes from all previously build route loaders.
virtual void loadNet(RONet &toFill, ROAbstractEdgeBuilder &eb)
Loads the network.
void openRoutes(RONet &net)
Builds and opens all route loaders.
The router's network representation.
SUMOVTypeParameter * getVehicleTypeSecure(const std::string &id)
Retrieves the named vehicle type.
bool hasBidiEdges() const
return whether the network contains bidirectional rail edges
void cleanup()
closes the file output for computed routes and deletes associated threads if necessary
void openOutput(const OptionsCont &options)
Opens the output for computed routes.
void writeIntermodal(const OptionsCont &options, ROIntermodalRouter &router) const
Writes the intermodal network and weights if requested.
static void adaptIntermodalRouter(ROIntermodalRouter &router)
bool hasPermissions() const
bool hasLoadedEffort() const
whether efforts were loaded from file
A vehicle as used by router.
static void initRandGlobal(SumoRNG *which=nullptr)
Reads the given random number options and initialises the random number generator in accordance.
the edge type representing backward edges
IntermodalRouter< E, L, N, V > & getIntermodalRouter() const
Structure representing possible vehicle parameter.
static int parseCarWalkTransfer(const OptionsCont &oc, const bool hasTaxi=false)
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.
static void init()
Initialises the xml-subsystem.
int main(int argc, char **argv)
void initNet(RONet &net, ROLoader &loader, OptionsCont &oc)
void computeRoutes(RONet &net, ROLoader &loader, OptionsCont &oc)