 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
34 #include <xercesc/sax/SAXException.hpp>
35 #include <xercesc/sax/SAXParseException.hpp>
77 if (oc.
isSet(
"weight-files")) {
80 if (oc.
isSet(
"lane-weight-files")) {
97 const std::string measure = oc.
getString(
"weight-attribute");
98 const std::string routingAlgorithm = oc.
getString(
"routing-algorithm");
101 if (measure ==
"traveltime") {
102 if (routingAlgorithm ==
"dijkstra") {
104 }
else if (routingAlgorithm ==
"astar") {
106 std::shared_ptr<const AStar::LookupTable> lookup;
107 if (oc.
isSet(
"astar.all-distances")) {
109 }
else if (oc.
isSet(
"astar.landmark-distances")) {
112 begin, end, std::numeric_limits<int>::max(), 1);
114 lookup = std::make_shared<const AStar::LMLT>(oc.
getString(
"astar.landmark-distances"),
ROEdge::getAllEdges(), &chrouter, &defaultVehicle,
115 oc.
isSet(
"astar.save-landmark-distances") ? oc.
getString(
"astar.save-landmark-distances") :
"", oc.
getInt(
"routing-threads"));
118 }
else if (routingAlgorithm ==
"CH") {
121 std::numeric_limits<int>::max());
124 }
else if (routingAlgorithm ==
"CHWrapper") {
127 std::numeric_limits<int>::max());
130 begin, end, weightPeriod, oc.
getInt(
"routing-threads"));
132 throw ProcessError(
"Unknown routing Algorithm '" + routingAlgorithm +
"'!");
136 if (measure ==
"CO") {
137 op = &ROEdge::getEmissionEffort<PollutantsInterface::CO>;
138 }
else if (measure ==
"CO2") {
139 op = &ROEdge::getEmissionEffort<PollutantsInterface::CO2>;
140 }
else if (measure ==
"PMx") {
141 op = &ROEdge::getEmissionEffort<PollutantsInterface::PM_X>;
142 }
else if (measure ==
"HC") {
143 op = &ROEdge::getEmissionEffort<PollutantsInterface::HC>;
144 }
else if (measure ==
"NOx") {
145 op = &ROEdge::getEmissionEffort<PollutantsInterface::NO_X>;
146 }
else if (measure ==
"fuel") {
147 op = &ROEdge::getEmissionEffort<PollutantsInterface::FUEL>;
148 }
else if (measure ==
"electricity") {
149 op = &ROEdge::getEmissionEffort<PollutantsInterface::ELEC>;
150 }
else if (measure ==
"noise") {
153 throw ProcessError(
"Unknown measure (weight attribute '" + measure +
"')!");
159 for (
const std::string& opt : oc.
getStringVector(
"persontrip.transfer.car-walk")) {
160 if (opt ==
"parkingAreas") {
162 }
else if (opt ==
"ptStops") {
164 }
else if (opt ==
"allJunctions") {
191 oc.
setApplicationDescription(
"Shortest path router and DUE computer for the microscopic, multi-modal traffic simulation SUMO.");
194 RONet* net =
nullptr;
217 }
catch (XERCES_CPP_NAMESPACE::SAXParseException& e) {
220 }
catch (XERCES_CPP_NAMESPACE::SAXException& e) {
228 if (std::string(e.what()) != std::string(
"Process Error") && std::string(e.what()) != std::string(
"")) {
234 }
catch (
const std::exception& e) {
235 if (std::string(e.what()) != std::string(
"")) {
248 std::cout <<
"Success." << std::endl;
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
static const ROEdgeVector & getAllEdges()
Returns all ROEdges.
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
bool processMetaOptions(bool missingOptions)
Checks for help and configuration output, returns whether we should exit.
void openOutput(const OptionsCont &options)
Opens the output for computed routes.
static void close()
Closes all of an applications subsystems.
static void initOutputOptions()
init output options
void openRoutes(RONet &net)
Builds and opens all route loaders.
junctions with edges allowing the additional mode
static double getTravelTimeStatic(const ROEdge *const edge, const ROVehicle *const veh, double time)
Returns the travel time for the given edge.
bool hasPermissions() const
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
virtual void inform(std::string msg, bool addType=true)
adds a new error to the list
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
void writeIntermodal(const OptionsCont &options, ROIntermodalRouter &router) const
Writes the intermodal network and weights if requested.
static OptionsCont & getOptions()
Retrieves the options.
static void adaptIntermodalRouter(ROIntermodalRouter &router)
The router's network representation.
A vehicle as used by router.
Structure representing possible vehicle parameter.
IntermodalRouter< ROEdge, ROLane, RONode, ROVehicle > ROIntermodalRouter
static double getNoiseEffort(const ROEdge *const edge, const ROVehicle *const veh, double time)
Computes the shortest path through a network using the Dijkstra algorithm.
static void setGlobalOptions(const bool interpolate)
double gWeightsRandomFactor
const StringVector & getStringVector(const std::string &name) const
Returns the list of string-value of the named option (only for Option_StringVector)
int main(int argc, char **argv)
void setApplicationName(const std::string &appName, const std::string &fullName)
Sets the application name.
static double getTravelTimeStaticRandomized(const ROEdge *const edge, const ROVehicle *const veh, double time)
static void setValidation(const std::string &validationScheme, const std::string &netValidationScheme)
Enables or disables validation.
const std::string DEFAULT_VTYPE_ID
Computes the shortest path through a contracted network.
public transport stops and access
static void init()
Initialises the xml-subsystem.
A storage for options typed value containers)
virtual void loadNet(RONet &toFill, ROAbstractEdgeBuilder &eb)
Loads the network.
void initNet(RONet &net, ROLoader &loader, OptionsCont &oc)
SUMOTime string2time(const std::string &r)
static bool checkOptions()
Checks set options from the OptionsCont-singleton for being valid for usage within duarouter.
static void initRandGlobal(std::mt19937 *which=0)
Reads the given random number options and initialises the random number generator in accordance.
static void getOptions(const bool commandLineOnly=false)
Parses the command line arguments and loads the configuration.
void setApplicationDescription(const std::string &appDesc)
Sets the application description.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
void cleanup()
closes the file output for computed routes and deletes associated threads if necessary
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.
Computes the shortest path through a contracted network.
IntermodalRouter< E, L, N, V > & getIntermodalRouter() const
Computes the shortest path through a network using the A* algorithm.
static void setArgs(int argc, char **argv)
Stores the command line arguments for later parsing.
void processRoutes(const SUMOTime start, const SUMOTime end, const SUMOTime increment, RONet &net, const RORouterProvider &provider)
Loads routes from all previously build route loaders.
static bool checkOptions()
checks shared options and sets StdDefs
void computeRoutes(RONet &net, ROLoader &loader, OptionsCont &oc)
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
vehicles ignoring classes
SUMOVTypeParameter * getVehicleTypeSecure(const std::string &id)
Retrieves the named vehicle type.
static void fillOptions()
Inserts options used by duarouter into the OptionsCont-singleton.
bool loadWeights(RONet &net, const std::string &optionName, const std::string &measure, const bool useLanes, const bool boundariesOverride)
Loads the net weights.