37 #include <xercesc/sax/SAXException.hpp> 38 #include <xercesc/sax/SAXParseException.hpp> 85 if (oc.
isSet(
"weight-files")) {
88 if (oc.
isSet(
"lane-weight-files")) {
103 const std::string& filename = oc.
getString(
"output-file");
104 std::string altFilename = filename +
".alt";
105 const int len = (int)filename.length();
106 if (len > 4 && filename.substr(len - 4) ==
".xml") {
107 altFilename = filename.substr(0, len - 4) +
".alt.xml";
108 }
else if (len > 4 && filename.substr(len - 4) ==
".sbx") {
109 altFilename = filename.substr(0, len - 4) +
".alt.sbx";
113 const std::string measure = oc.
getString(
"weight-attribute");
114 const std::string routingAlgorithm = oc.
getString(
"routing-algorithm");
117 if (measure ==
"traveltime") {
118 if (routingAlgorithm ==
"dijkstra") {
126 }
else if (routingAlgorithm ==
"astar") {
129 const AStar::LookupTable* lookup = 0;
130 if (oc.
isSet(
"astar.all-distances")) {
132 }
else if (oc.
isSet(
"astar.landmark-distances")) {
138 oc.
isSet(
"astar.save-landmark-distances") ? oc.
getString(
"astar.save-landmark-distances") :
"", oc.
getInt(
"routing-threads"));
143 const AStar::LookupTable* lookup = 0;
144 if (oc.
isSet(
"astar.all-distances")) {
146 }
else if (oc.
isSet(
"astar.landmark-distances")) {
152 oc.
isSet(
"astar.save-landmark-distances") ? oc.
getString(
"astar.save-landmark-distances") :
"", oc.
getInt(
"routing-threads"));
156 }
else if (routingAlgorithm ==
"CH") {
167 }
else if (routingAlgorithm ==
"CHWrapper") {
173 begin, end, weightPeriod, oc.
getInt(
"routing-threads"));
175 throw ProcessError(
"Unknown routing Algorithm '" + routingAlgorithm +
"'!");
179 if (measure ==
"CO") {
180 op = &ROEdge::getEmissionEffort<PollutantsInterface::CO>;
181 }
else if (measure ==
"CO2") {
182 op = &ROEdge::getEmissionEffort<PollutantsInterface::CO2>;
183 }
else if (measure ==
"PMx") {
184 op = &ROEdge::getEmissionEffort<PollutantsInterface::PM_X>;
185 }
else if (measure ==
"HC") {
186 op = &ROEdge::getEmissionEffort<PollutantsInterface::HC>;
187 }
else if (measure ==
"NOx") {
188 op = &ROEdge::getEmissionEffort<PollutantsInterface::NO_X>;
189 }
else if (measure ==
"fuel") {
190 op = &ROEdge::getEmissionEffort<PollutantsInterface::FUEL>;
191 }
else if (measure ==
"electricity") {
192 op = &ROEdge::getEmissionEffort<PollutantsInterface::ELEC>;
193 }
else if (measure ==
"noise") {
196 throw ProcessError(
"Unknown measure (weight attribute '" + measure +
"')!");
254 }
catch (XERCES_CPP_NAMESPACE::SAXParseException& e) {
257 }
catch (XERCES_CPP_NAMESPACE::SAXException& e) {
265 if (std::string(e.what()) != std::string(
"Process Error") && std::string(e.what()) != std::string(
"")) {
271 }
catch (
const std::exception& e) {
272 if (std::string(e.what()) != std::string(
"")) {
285 std::cout <<
"Success." << std::endl;
Computes the shortest path through a contracted network.
bool hasPermissions() const
static void init()
Initialises the xml-subsystem.
Computes the shortest path through a network using the Dijkstra algorithm.
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
static void getOptions(const bool commandLineOnly=false)
Parses the command line arguments and loads the configuration.
int main(int argc, char **argv)
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.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
Computes the shortest path through a network using the A* algorithm.
const std::string DEFAULT_VTYPE_ID
static void close()
Closes all of an applications subsystems.
Computes the shortest path through a network using the Dijkstra algorithm.
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.
void openOutput(const OptionsCont &options, const std::string altFilename="")
Opens the output for computed routes.
Interface for building instances of duarouter-edges.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
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)
bool processMetaOptions(bool missingOptions)
Checks for help and configuration output, returns whether we should exit.
SUMOTime string2time(const std::string &r)
void computeRoutes(RONet &net, ROLoader &loader, OptionsCont &oc)
virtual void loadNet(RONet &toFill, ROAbstractEdgeBuilder &eb)
Loads the network.
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.
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
static void initOutputOptions()
static std::string _2str(const int var)
convert int to string
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
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
Computes the shortest path through a contracted network.
void setApplicationName(const std::string &appName, const std::string &fullName)
Sets the application name.