37 #include <xercesc/sax/SAXException.hpp> 38 #include <xercesc/sax/SAXParseException.hpp> 66 #ifdef CHECK_MEMORY_LEAKS 68 #endif // CHECK_MEMORY_LEAKS 89 if (oc.
isSet(
"weight-files")) {
92 if (oc.
isSet(
"lane-weight-files")) {
107 const std::string& filename = oc.
getString(
"output-file");
108 std::string altFilename = filename +
".alt";
109 const size_t len = filename.length();
110 if (len > 4 && filename.substr(len - 4) ==
".xml") {
111 altFilename = filename.substr(0, len - 4) +
".alt.xml";
112 }
else if (len > 4 && filename.substr(len - 4) ==
".sbx") {
113 altFilename = filename.substr(0, len - 4) +
".alt.sbx";
117 const std::string measure = oc.
getString(
"weight-attribute");
118 const std::string routingAlgorithm = oc.
getString(
"routing-algorithm");
119 if (measure ==
"traveltime") {
120 if (routingAlgorithm ==
"dijkstra") {
128 }
else if (routingAlgorithm ==
"astar") {
136 }
else if (routingAlgorithm ==
"CH") {
147 }
else if (routingAlgorithm ==
"CHWrapper") {
156 throw ProcessError(
"Unknown routing Algorithm '" + routingAlgorithm +
"'!");
160 if (measure ==
"CO") {
161 op = &ROEdge::getEmissionEffort<PollutantsInterface::CO>;
162 }
else if (measure ==
"CO2") {
163 op = &ROEdge::getEmissionEffort<PollutantsInterface::CO2>;
164 }
else if (measure ==
"PMx") {
165 op = &ROEdge::getEmissionEffort<PollutantsInterface::PM_X>;
166 }
else if (measure ==
"HC") {
167 op = &ROEdge::getEmissionEffort<PollutantsInterface::HC>;
168 }
else if (measure ==
"NOx") {
169 op = &ROEdge::getEmissionEffort<PollutantsInterface::NO_X>;
170 }
else if (measure ==
"fuel") {
171 op = &ROEdge::getEmissionEffort<PollutantsInterface::FUEL>;
172 }
else if (measure ==
"electricity") {
173 op = &ROEdge::getEmissionEffort<PollutantsInterface::ELEC>;
174 }
else if (measure ==
"noise") {
177 throw ProcessError(
"Unknown measure (weight attribute '" + measure +
"')!");
236 }
catch (XERCES_CPP_NAMESPACE::SAXParseException& e) {
239 }
catch (XERCES_CPP_NAMESPACE::SAXException& e) {
247 if (std::string(e.what()) != std::string(
"Process Error") && std::string(e.what()) != std::string(
"")) {
253 }
catch (
const std::exception& e) {
254 if (std::string(e.what()) != std::string(
"")) {
267 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.
int main(int argc, char **argv)
void openRoutes(RONet &net)
Builds and opens all route loaders.
static SUMOReal getNoiseEffort(const ROEdge *const edge, const ROVehicle *const veh, SUMOReal time)
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.
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.
static void initRandGlobal(MTRand *which=0)
Reads the given random number options and initialises the random number generator in accordance...
void openOutput(const std::string &filename, const std::string altFilename, const std::string typeFilename)
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)
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 std::string _2str(const E *const data)
bool processMetaOptions(bool missingOptions)
Checks for help and configuration output, returns whether we should exit.
SUMOTime string2time(const std::string &r)
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
void computeRoutes(RONet &net, ROLoader &loader, OptionsCont &oc)
virtual void loadNet(RONet &toFill, ROAbstractEdgeBuilder &eb)
Loads the network.
static void getOptions()
Parses the command line arguments and loads the configuration.
The router's network representation.
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 setGlobalOptions(const bool interpolate)
static void initOutputOptions()
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.
static SUMOReal getTravelTimeStatic(const ROEdge *const edge, const ROVehicle *const veh, SUMOReal time)
Returns the travel time for the given edge.
void setApplicationName(const std::string &appName, const std::string &fullName)
Sets the application name.