37 #include <xercesc/sax/SAXException.hpp>
38 #include <xercesc/sax/SAXParseException.hpp>
65 #ifdef HAVE_INTERNAL // catchall for internal stuff
66 #include <internal/BulkStarRouter.h>
67 #include <internal/CHRouter.h>
68 #include <internal/CHRouterWrapper.h>
69 #endif // have HAVE_INTERNAL
71 #ifdef CHECK_MEMORY_LEAKS
73 #endif // CHECK_MEMORY_LEAKS
93 if (oc.
isSet(
"weight-files")) {
96 if (oc.
isSet(
"lane-weight-files")) {
111 const std::string& filename = oc.
getString(
"output-file");
112 std::string altFilename = filename +
".alt";
113 const size_t len = filename.length();
114 if (len > 4 && filename.substr(len - 4) ==
".xml") {
115 altFilename = filename.substr(0, len - 4) +
".alt.xml";
116 }
else if (len > 4 && filename.substr(len - 4) ==
".sbx") {
117 altFilename = filename.substr(0, len - 4) +
".alt.sbx";
121 const std::string measure = oc.
getString(
"weight-attribute");
122 const std::string routingAlgorithm = oc.
getString(
"routing-algorithm");
123 if (measure ==
"traveltime") {
124 if (routingAlgorithm ==
"dijkstra") {
132 }
else if (routingAlgorithm ==
"astar") {
140 #ifdef HAVE_INTERNAL // catchall for internal stuff
141 }
else if (routingAlgorithm ==
"bulkstar") {
143 router =
new BulkStarRouterTT<ROEdge, ROVehicle, prohibited_withRestrictions<ROEdge, ROVehicle> >(
146 router =
new BulkStarRouterTT<ROEdge, ROVehicle, prohibited_noRestrictions<ROEdge, ROVehicle> >(
150 }
else if (routingAlgorithm ==
"CH") {
159 router =
new CHRouter<ROEdge, ROVehicle, prohibited_withRestrictions<ROEdge, ROVehicle> >(
162 router =
new CHRouter<ROEdge, ROVehicle, prohibited_noRestrictions<ROEdge, ROVehicle> >(
166 }
else if (routingAlgorithm ==
"CHWrapper") {
172 router =
new CHRouterWrapper<ROEdge, ROVehicle, prohibited_withRestrictions<ROEdge, ROVehicle> >(
175 #endif // have HAVE_INTERNAL
177 throw ProcessError(
"Unknown routing Algorithm '" + routingAlgorithm +
"'!");
182 if (measure ==
"CO") {
184 }
else if (measure ==
"CO2") {
186 }
else if (measure ==
"PMx") {
188 }
else if (measure ==
"HC") {
190 }
else if (measure ==
"NOx") {
192 }
else if (measure ==
"fuel") {
194 }
else if (measure ==
"noise") {
198 throw ProcessError(
"Unknown measure (weight attribute '" + measure +
"')!");
211 if (routingAlgorithm ==
"bulkstar") {
212 #ifdef HAVE_INTERNAL // catchall for internal stuff
264 }
catch (XERCES_CPP_NAMESPACE::SAXParseException& e) {
267 }
catch (XERCES_CPP_NAMESPACE::SAXException& e) {
275 if (std::string(e.what()) != std::string(
"Process Error") && std::string(e.what()) != std::string(
"")) {
281 }
catch (
const std::exception& e) {
282 if (std::string(e.what()) != std::string(
"")) {
295 std::cout <<
"Success." << std::endl;
void processRoutes(SUMOTime start, SUMOTime end, RONet &net, SUMOAbstractRouter< ROEdge, ROVehicle > &router)
Loads routes from all previously build route loaders.
static void init()
Initialises the xml-subsystem.
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
static void getOptions(bool loadConfig, int argc=0, char **argv=0)
Parses the command line arguments and loads the configuration optionally.
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...
void initNet(RONet &net, ROLoader &loader, OptionsCont &oc)
unsigned int getEdgeNo() const
Returns the number of edges thenetwork contains.
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.
SUMOReal getPMxEffort(const ROVehicle *const veh, SUMOReal time) const
SUMOReal getCO2Effort(const ROVehicle *const veh, SUMOReal time) const
const std::string DEFAULT_VTYPE_ID
static void close()
Closes all of an applications subsystems.
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)
A vehicle as used by router.
void closeOutput()
closes the file output for computed routes
static void fillOptions()
Inserts options used by duarouter into the OptionsCont-singleton.
static std::string _2str(const E *const data)
SUMOReal getHCEffort(const ROVehicle *const veh, SUMOReal time) const
SUMOReal getNOxEffort(const ROVehicle *const veh, SUMOReal time) const
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 setValidation(bool enableValidation)
Enables or disables validation.
The router's network representation.
Structure representing possible vehicle parameter.
SUMOReal getFuelEffort(const ROVehicle *const veh, SUMOReal time) const
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
SUMOReal getNoiseEffort(const ROVehicle *const veh, SUMOReal time) const
SUMOReal getCOEffort(const ROVehicle *const veh, SUMOReal time) const
SUMOVTypeParameter * getVehicleTypeSecure(const std::string &id)
Retrieves the named vehicle type.
SUMOReal getTravelTime(const ROVehicle *const veh, SUMOReal time) const
Returns the travel time for this edge.
SUMOReal getMinimumTravelTime(const ROVehicle *const veh) const
Returns the travel time for this edge without using any stored timeLine.
static void initOutputOptions()
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
int main(int argc, char *argv[])
void setApplicationName(const std::string &appName, const std::string &fullName)
Sets the application name.