35 #include <xercesc/sax/SAXException.hpp> 36 #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");
102 if (measure ==
"traveltime") {
103 if (routingAlgorithm ==
"dijkstra") {
111 }
else if (routingAlgorithm ==
"astar") {
114 std::shared_ptr<const AStar::LookupTable> lookup;
115 if (oc.
isSet(
"astar.all-distances")) {
117 }
else if (oc.
isSet(
"astar.landmark-distances")) {
120 begin, end, std::numeric_limits<int>::max(), 1);
123 oc.
isSet(
"astar.save-landmark-distances") ? oc.
getString(
"astar.save-landmark-distances") :
"", oc.
getInt(
"routing-threads"));
128 std::shared_ptr<const AStar::LookupTable> lookup;
129 if (oc.
isSet(
"astar.all-distances")) {
131 }
else if (oc.
isSet(
"astar.landmark-distances")) {
134 begin, end, std::numeric_limits<int>::max(), 1);
137 oc.
isSet(
"astar.save-landmark-distances") ? oc.
getString(
"astar.save-landmark-distances") :
"", oc.
getInt(
"routing-threads"));
141 }
else if (routingAlgorithm ==
"CH") {
144 std::numeric_limits<int>::max());
152 }
else if (routingAlgorithm ==
"CHWrapper") {
155 std::numeric_limits<int>::max());
158 begin, end, weightPeriod, oc.
getInt(
"routing-threads"));
160 throw ProcessError(
"Unknown routing Algorithm '" + routingAlgorithm +
"'!");
164 if (measure ==
"CO") {
165 op = &ROEdge::getEmissionEffort<PollutantsInterface::CO>;
166 }
else if (measure ==
"CO2") {
167 op = &ROEdge::getEmissionEffort<PollutantsInterface::CO2>;
168 }
else if (measure ==
"PMx") {
169 op = &ROEdge::getEmissionEffort<PollutantsInterface::PM_X>;
170 }
else if (measure ==
"HC") {
171 op = &ROEdge::getEmissionEffort<PollutantsInterface::HC>;
172 }
else if (measure ==
"NOx") {
173 op = &ROEdge::getEmissionEffort<PollutantsInterface::NO_X>;
174 }
else if (measure ==
"fuel") {
175 op = &ROEdge::getEmissionEffort<PollutantsInterface::FUEL>;
176 }
else if (measure ==
"electricity") {
177 op = &ROEdge::getEmissionEffort<PollutantsInterface::ELEC>;
178 }
else if (measure ==
"noise") {
181 throw ProcessError(
"Unknown measure (weight attribute '" + measure +
"')!");
192 for (
const std::string& opt : oc.
getStringVector(
"persontrip.transfer.car-walk")) {
193 if (opt ==
"parkingAreas") {
195 }
else if (opt ==
"ptStops") {
197 }
else if (opt ==
"allJunctions") {
224 oc.
setApplicationDescription(
"Shortest path router and DUE computer for the microscopic, multi-modal traffic simulation SUMO.");
227 RONet* net =
nullptr;
250 }
catch (XERCES_CPP_NAMESPACE::SAXParseException& e) {
253 }
catch (XERCES_CPP_NAMESPACE::SAXException& e) {
261 if (std::string(e.what()) != std::string(
"Process Error") && std::string(e.what()) != std::string(
"")) {
267 }
catch (
const std::exception& e) {
268 if (std::string(e.what()) != std::string(
"")) {
281 std::cout <<
"Success." << std::endl;
Computes the shortest path through a contracted network.
IntermodalRouter< E, L, N, V > & getIntermodalRouter() const
static void init()
Initialises the xml-subsystem.
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
public transport stops and access
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
static void getOptions(const bool commandLineOnly=false)
Parses the command line arguments and loads the configuration.
int main(int argc, char **argv)
void writeIntermodal(const OptionsCont &options, ROIntermodalRouter &router) const
Writes the intermodal network and weights if requested.
void openRoutes(RONet &net)
Builds and opens all route loaders.
static bool checkOptions()
Checks set options from the OptionsCont-singleton for being valid for usage within duarouter...
static void setValidation(const std::string &validationScheme, const std::string &netValidationScheme)
Enables or disables validation.
void initNet(RONet &net, ROLoader &loader, OptionsCont &oc)
static void adaptIntermodalRouter(ROIntermodalRouter &router)
void setApplicationDescription(const std::string &appDesc)
Sets the application description.
Computes the shortest path through a network using the A* algorithm.
bool hasPermissions() const
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
const std::string DEFAULT_VTYPE_ID
static void close()
Closes all of an applications subsystems.
static void setArgs(int argc, char **argv)
Stores the command line arguments for later parsing.
IntermodalRouter< ROEdge, ROLane, RONode, ROVehicle > ROIntermodalRouter
static OptionsCont & getOptions()
Retrieves the options.
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...
Interface for building instances of duarouter-edges.
void openOutput(const OptionsCont &options)
Opens the output for computed routes.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
A vehicle as used by router.
static void fillOptions()
Inserts options used by duarouter into the OptionsCont-singleton.
void cleanup()
closes the file output for computed routes and deletes associated threads if necessary ...
static double getTravelTimeStatic(const ROEdge *const edge, const ROVehicle *const veh, double time)
Returns the travel time for the given edge.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Computes the shortest path through a network using the Dijkstra algorithm.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
bool processMetaOptions(bool missingOptions)
Checks for help and configuration output, returns whether we should exit.
SUMOTime string2time(const std::string &r)
std::vector< std::string > getStringVector(const std::string &name) const
Returns the list of string-vector-value of the named option (only for Option_String) ...
static bool checkOptions()
checks shared options and sets StdDefs
void computeRoutes(RONet &net, ROLoader &loader, OptionsCont &oc)
virtual void loadNet(RONet &toFill, ROAbstractEdgeBuilder &eb)
Loads the network.
junctions with edges allowing the additional mode
The router's network representation.
Structure representing possible vehicle parameter.
static const ROEdgeVector & getAllEdges()
Returns all ROEdges.
void processRoutes(const SUMOTime start, const SUMOTime end, const SUMOTime increment, RONet &net, const RORouterProvider &provider)
Loads routes from all previously build route loaders.
void inform(std::string msg, bool addType=true)
adds a new error to the list
A storage for options typed value containers)
static void initRandGlobal(std::mt19937 *which=0)
Reads the given random number options and initialises the random number generator in accordance...
static double getNoiseEffort(const ROEdge *const edge, const ROVehicle *const veh, double time)
static void setGlobalOptions(const bool interpolate)
SUMOVTypeParameter * getVehicleTypeSecure(const std::string &id)
Retrieves the named vehicle type.
static void initOutputOptions()
init output options
bool loadWeights(RONet &net, const std::string &optionName, const std::string &measure, const bool useLanes, const bool boundariesOverride)
Loads the net weights.
vehicles ignoring classes
Computes the shortest path through a contracted network.
void setApplicationName(const std::string &appName, const std::string &fullName)
Sets the application name.