33 #include <xercesc/sax/SAXException.hpp>
34 #include <xercesc/sax/SAXParseException.hpp>
79 if (oc.
isSet(
"weight-files")) {
82 if (oc.
isSet(
"lane-weight-files")) {
98 const std::string measure = oc.
getString(
"weight-attribute");
99 const std::string routingAlgorithm = oc.
getString(
"routing-algorithm");
100 const double priorityFactor = oc.
getFloat(
"weights.priority-factor");
105 if (oc.
isSet(
"restriction-params") &&
106 (routingAlgorithm ==
"CH" || routingAlgorithm ==
"CHWrapper")) {
107 throw ProcessError(
TLF(
"Routing algorithm '%' does not support restriction-params", routingAlgorithm));
110 if (measure ==
"traveltime" && priorityFactor == 0) {
111 if (routingAlgorithm ==
"dijkstra") {
113 }
else if (routingAlgorithm ==
"astar") {
115 std::shared_ptr<const AStar::LookupTable> lookup;
116 if (oc.
isSet(
"astar.all-distances")) {
118 }
else if (oc.
isSet(
"astar.landmark-distances")) {
123 std::vector<ReversedEdge<ROEdge, ROVehicle>*> reversed;
125 reversed.push_back(edge->getReversedRoutingEdge());
132 lookup = std::make_shared<const AStar::LMLT>(oc.
getString(
"astar.landmark-distances"),
ROEdge::getAllEdges(), &forward, &backward, &defaultVehicle,
133 oc.
isSet(
"astar.save-landmark-distances") ? oc.
getString(
"astar.save-landmark-distances") :
"", oc.
getInt(
"routing-threads"));
142 }
else if (routingAlgorithm ==
"CHWrapper" || routingAlgorithm ==
"CH") {
151 throw ProcessError(
TLF(
"Unknown routing Algorithm '%'!", routingAlgorithm));
154 if (measure ==
"traveltime") {
158 }
else if (measure ==
"CO") {
159 op = &ROEdge::getEmissionEffort<PollutantsInterface::CO>;
160 }
else if (measure ==
"CO2") {
161 op = &ROEdge::getEmissionEffort<PollutantsInterface::CO2>;
162 }
else if (measure ==
"PMx") {
163 op = &ROEdge::getEmissionEffort<PollutantsInterface::PM_X>;
164 }
else if (measure ==
"HC") {
165 op = &ROEdge::getEmissionEffort<PollutantsInterface::HC>;
166 }
else if (measure ==
"NOx") {
167 op = &ROEdge::getEmissionEffort<PollutantsInterface::NO_X>;
168 }
else if (measure ==
"fuel") {
169 op = &ROEdge::getEmissionEffort<PollutantsInterface::FUEL>;
170 }
else if (measure ==
"electricity") {
171 op = &ROEdge::getEmissionEffort<PollutantsInterface::ELEC>;
172 }
else if (measure ==
"noise") {
178 WRITE_WARNINGF(
TL(
"No weight data was loaded for attribute '%'."), measure);
184 for (
const std::string& opt : oc.
getStringVector(
"persontrip.transfer.car-walk")) {
185 if (opt ==
"parkingAreas") {
187 }
else if (opt ==
"ptStops") {
189 }
else if (opt ==
"allJunctions") {
193 for (
const std::string& opt : oc.
getStringVector(
"persontrip.transfer.taxi-walk")) {
194 if (opt ==
"ptStops") {
196 }
else if (opt ==
"allJunctions") {
200 for (
const std::string& opt : oc.
getStringVector(
"persontrip.transfer.walk-taxi")) {
201 if (opt ==
"ptStops") {
203 }
else if (opt ==
"allJunctions") {
212 oc.
isSet(
"restriction-params"),
213 oc.
getFloat(
"railway.max-train-length"));
238 oc.
setApplicationDescription(
TL(
"Shortest path router and DUE computer for the microscopic, multi-modal traffic simulation SUMO."));
241 RONet* net =
nullptr;
254 if (oc.
getInt(
"routing-threads") > 1) {
271 }
catch (XERCES_CPP_NAMESPACE::SAXParseException& e) {
274 }
catch (XERCES_CPP_NAMESPACE::SAXException& e) {
282 if (std::string(e.what()) != std::string(
"Process Error") && std::string(e.what()) != std::string(
"")) {
288 }
catch (
const std::exception& e) {
289 if (std::string(e.what()) != std::string(
"")) {
302 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.
@ TAXI_PICKUP_ANYWHERE
taxi customer may be picked up anywhere
@ TAXI_DROPOFF_ANYWHERE
taxi customer may exit anywhere
@ PARKING_AREAS
parking areas
@ ALL_JUNCTIONS
junctions with edges allowing the additional mode
@ TAXI_PICKUP_PT
taxi customer may be picked up at public transport stop
@ PT_STOPS
public transport stops and access
@ TAXI_DROPOFF_PT
taxi customer may be picked up at public transport stop
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)
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.
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.
IntermodalRouter< E, L, N, V > & getIntermodalRouter() 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.
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)