37 #include <xercesc/sax/SAXException.hpp>
38 #include <xercesc/sax/SAXParseException.hpp>
67 #ifdef CHECK_MEMORY_LEAKS
69 #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 ==
"bulkstar") {
144 }
else if (routingAlgorithm ==
"CH") {
155 }
else if (routingAlgorithm ==
"CHWrapper") {
164 throw ProcessError(
"Unknown routing Algorithm '" + routingAlgorithm +
"'!");
168 if (measure ==
"CO") {
169 op = &ROEdge::getEmissionEffort<PollutantsInterface::CO>;
170 }
else if (measure ==
"CO2") {
171 op = &ROEdge::getEmissionEffort<PollutantsInterface::CO2>;
172 }
else if (measure ==
"PMx") {
173 op = &ROEdge::getEmissionEffort<PollutantsInterface::PM_X>;
174 }
else if (measure ==
"HC") {
175 op = &ROEdge::getEmissionEffort<PollutantsInterface::HC>;
176 }
else if (measure ==
"NOx") {
177 op = &ROEdge::getEmissionEffort<PollutantsInterface::NO_X>;
178 }
else if (measure ==
"fuel") {
179 op = &ROEdge::getEmissionEffort<PollutantsInterface::FUEL>;
180 }
else if (measure ==
"noise") {
183 throw ProcessError(
"Unknown measure (weight attribute '" + measure +
"')!");
196 if (routingAlgorithm ==
"bulkstar") {
244 }
catch (XERCES_CPP_NAMESPACE::SAXParseException& e) {
247 }
catch (XERCES_CPP_NAMESPACE::SAXException& e) {
255 if (std::string(e.what()) != std::string(
"Process Error") && std::string(e.what()) != std::string(
"")) {
261 }
catch (
const std::exception& e) {
262 if (std::string(e.what()) != std::string(
"")) {
275 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 main(int argc, char **argv)
static void getOptions(bool loadConfig, int argc=0, char **argv=0)
Parses the command line arguments and loads the configuration optionally.
size_t getEdgeNo() const
Returns the total number of edges the network contains including internal edges.
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)
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)
bool loadWeights(RONet &net, const std::string &optionName, const std::string &measure, bool useLanes)
Loads the net weights.
Computes the shortest path through a network using the Dijkstra algorithm.
static void close()
Closes all of an applications subsystems.
Computes the shortest path through a network using the Dijkstra algorithm.
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.
static std::string _2str(const E *const data)
bool processMetaOptions(bool missingOptions)
Checks for help and configuration output, returns whether we should exit.
const std::string getBuildName(const std::string &version)
attach some build flags to the version string
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.
The router's network representation.
void inform(std::string msg, bool addType=true)
adds a new error to the list
A storage for options typed value containers)
bool hasRestrictions() const
void processAllRoutesWithBulkRouter(SUMOTime start, SUMOTime end, RONet &net, SUMOAbstractRouter< ROEdge, ROVehicle > &router)
Loads all routes and processes them with BulkStarRouter.
SUMOReal getMinimumTravelTime(const ROVehicle *const veh) const
Returns a lower bound for the travel time on this edge without using any stored timeLine.
void processRoutes(const SUMOTime start, const SUMOTime end, const SUMOTime increment, RONet &net, SUMOAbstractRouter< ROEdge, ROVehicle > &router)
Loads routes from all previously build route loaders.
void cleanup(SUMOAbstractRouter< ROEdge, ROVehicle > *router)
closes the file output for computed routes and deletes routers and associated threads if necessary ...
static void initOutputOptions()
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.