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") {
134 }
else if (routingAlgorithm ==
"CH") {
145 }
else if (routingAlgorithm ==
"CHWrapper") {
151 begin, end, weightPeriod, oc.
getInt(
"routing-threads"));
153 throw ProcessError(
"Unknown routing Algorithm '" + routingAlgorithm +
"'!");
157 if (measure ==
"CO") {
158 op = &ROEdge::getEmissionEffort<PollutantsInterface::CO>;
159 }
else if (measure ==
"CO2") {
160 op = &ROEdge::getEmissionEffort<PollutantsInterface::CO2>;
161 }
else if (measure ==
"PMx") {
162 op = &ROEdge::getEmissionEffort<PollutantsInterface::PM_X>;
163 }
else if (measure ==
"HC") {
164 op = &ROEdge::getEmissionEffort<PollutantsInterface::HC>;
165 }
else if (measure ==
"NOx") {
166 op = &ROEdge::getEmissionEffort<PollutantsInterface::NO_X>;
167 }
else if (measure ==
"fuel") {
168 op = &ROEdge::getEmissionEffort<PollutantsInterface::FUEL>;
169 }
else if (measure ==
"electricity") {
170 op = &ROEdge::getEmissionEffort<PollutantsInterface::ELEC>;
171 }
else if (measure ==
"noise") {
174 throw ProcessError(
"Unknown measure (weight attribute '" + measure +
"')!");
232 }
catch (XERCES_CPP_NAMESPACE::SAXParseException& e) {
235 }
catch (XERCES_CPP_NAMESPACE::SAXException& e) {
243 if (std::string(e.what()) != std::string(
"Process Error") && std::string(e.what()) != std::string(
"")) {
249 }
catch (
const std::exception& e) {
250 if (std::string(e.what()) != std::string(
"")) {
263 std::cout <<
"Success." << std::endl;
Computes the shortest path through a contracted network.
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 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 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)
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.
static void initRandGlobal(MTRand *which=0)
Reads the given random number options and initialises the random number generator in accordance...
Interface for building instances of duarouter-edges.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
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)
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)
void computeRoutes(RONet &net, ROLoader &loader, OptionsCont &oc)
virtual void loadNet(RONet &toFill, ROAbstractEdgeBuilder &eb)
Loads the network.
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 double getNoiseEffort(const ROEdge *const edge, const ROVehicle *const veh, double time)
static void setGlobalOptions(const bool interpolate)
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
Computes the shortest path through a contracted network.
void setApplicationName(const std::string &appName, const std::string &fullName)
Sets the application name.