38 #include <xercesc/sax/SAXException.hpp>
39 #include <xercesc/sax/SAXParseException.hpp>
81 #ifdef CHECK_MEMORY_LEAKS
83 #endif // CHECK_MEMORY_LEAKS
103 if (oc.
isSet(
"weight-files")) {
106 if (oc.
isSet(
"lane-weight-files")) {
122 std::ofstream outFile(oc.
getString(
"all-pairs-output").c_str(), std::ios::binary);
128 const int numTotalEdges = (int)net.
getEdgeNo();
129 for (
int i = numInternalEdges; i < numTotalEdges; i++) {
130 const Dijkstra::EdgeInfo& ei = router.getEdgeInfo(i);
132 router.compute(ei.edge, 0, 0, 0, into);
133 for (
int j = numInternalEdges; j < numTotalEdges; j++) {
147 const std::string measure = oc.
getString(
"weight-attribute");
148 const std::string routingAlgorithm = oc.
getString(
"routing-algorithm");
149 if (measure ==
"traveltime") {
150 if (routingAlgorithm ==
"dijkstra") {
152 if (oc.
getInt(
"paths") > 1) {
160 if (oc.
getInt(
"paths") > 1) {
168 }
else if (routingAlgorithm ==
"astar") {
170 if (oc.
getInt(
"paths") > 1) {
178 if (oc.
getInt(
"paths") > 1) {
186 }
else if (routingAlgorithm ==
"bulkstar") {
194 }
else if (routingAlgorithm ==
"CH") {
205 }
else if (routingAlgorithm ==
"CHWrapper") {
214 throw ProcessError(
"Unknown routing Algorithm '" + routingAlgorithm +
"'!");
219 if (measure ==
"CO") {
220 op = &ROEdge::getEmissionEffort<PollutantsInterface::CO>;
221 }
else if (measure ==
"CO2") {
222 op = &ROEdge::getEmissionEffort<PollutantsInterface::CO2>;
223 }
else if (measure ==
"PMx") {
224 op = &ROEdge::getEmissionEffort<PollutantsInterface::PM_X>;
225 }
else if (measure ==
"HC") {
226 op = &ROEdge::getEmissionEffort<PollutantsInterface::HC>;
227 }
else if (measure ==
"NOx") {
228 op = &ROEdge::getEmissionEffort<PollutantsInterface::NO_X>;
229 }
else if (measure ==
"fuel") {
230 op = &ROEdge::getEmissionEffort<PollutantsInterface::FUEL>;
231 }
else if (measure ==
"noise") {
234 throw ProcessError(
"Unknown measure (weight attribute '" + measure +
"')!");
237 if (oc.
getInt(
"paths") > 1) {
245 if (oc.
getInt(
"paths") > 1) {
259 if (oc.
isSet(
"timeline")) {
264 const std::string assignMethod = oc.
getString(
"assignment-method");
265 if (assignMethod ==
"incremental") {
266 a.incremental(oc.
getInt(
"max-iterations"));
267 }
else if (assignMethod ==
"SUE") {
268 a.sue(oc.
getInt(
"max-iterations"), oc.
getInt(
"max-inner-iterations"),
272 bool haveOutput =
false;
275 for (std::vector<ODCell*>::const_iterator i = matrix.
getCells().begin(); i != matrix.
getCells().end(); ++i) {
276 const ODCell*
const c = *i;
280 (*j)->writeXMLDefinition(*dev, 0,
true,
false);
289 for (std::vector<ODCell*>::const_iterator i = matrix.
getCells().begin(); i != matrix.
getCells().end(); ++i) {
290 const ODCell*
const c = *i;
298 (*j)->writeXMLDefinition(*dev, 0,
true,
false);
345 if (oc.
isSet(
"all-pairs-output")) {
351 std::cout <<
"Success." << std::endl;
377 }
catch (XERCES_CPP_NAMESPACE::SAXParseException& e) {
380 }
catch (XERCES_CPP_NAMESPACE::SAXException& e) {
388 if (std::string(e.what()) != std::string(
"Process Error") && std::string(e.what()) != std::string(
"")) {
398 std::cout <<
"Success." << std::endl;
SUMOReal getNoLoaded() const
Returns the number of loaded vehicles.
Computes the shortest path through a contracted network.
void writeDefaultAttrs(OutputDevice &dev, const bool noVtype, const ODCell *const cell)
Helper function for flow and trip output writing the depart and arrival attributes.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
std::vector< std::string > getStringVector(const std::string &name) const
Returns the list of string-vector-value of the named option (only for Option_String) ...
const std::vector< ODCell * > & getCells()
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.
OutputDevice * getRouteOutput(const bool alternative=false)
const std::map< std::string, std::pair< std::vector< std::string >, std::vector< std::string > > > & getDistricts() const
Retrieves all TAZ (districts) from the network.
void computeRoutes(RONet &net, OptionsCont &oc, ODMatrix &matrix)
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.
static SUMOReal getNoiseEffort(const ROEdge *const edge, const ROVehicle *const veh, SUMOReal time)
static void setValidation(const std::string &validationScheme, const std::string &netValidationScheme)
Enables or disables validation.
Interface for building instances of duarouter-edges.
void makeDistricts(const std::map< std::string, std::pair< std::vector< std::string >, std::vector< std::string > > > &districts)
create districts from description
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)
int main(int argc, char **argv)
bool loadWeights(RONet &net, const std::string &optionName, const std::string &measure, bool useLanes)
Loads the net weights.
SUMOReal getTravelTime(const ROEdge *const edge, const ROVehicle *const , SUMOReal)
static std::ostream & writeFloat(std::ostream &strm, SUMOReal value)
Writes a float binary.
std::string time2string(SUMOTime t)
Computes the shortest path through a network using the Dijkstra algorithm.
static bool checkOptions()
Checks set options from the OptionsCont-singleton for being valid for usage within duarouter...
void computeAllPairs(RONet &net, OptionsCont &oc)
An internal edge which models vehicles driving across a junction. This is currently not used for rout...
SUMOReal getFloat(const std::string &name) const
Returns the SUMOReal-value of the named option (only for Option_Float)
std::vector< const ROEdge * > ConstROEdgeVector
std::vector< RORoute * > pathsVector
the list of paths / routes
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 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 loadMatrix(OptionsCont &oc)
read a VISUM-matrix with the V Format
void openOutput(const std::string &filename, const std::string altFilename, const std::string typeFilename)
Opens the output for computed routes.
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.
A single O/D-matrix cell.
void initNet(RONet &net, ROLoader &loader, OptionsCont &oc)
std::string origin
Name of the origin district.
static SUMOReal getPenalizedTT(const ROEdge *const e, const ROVehicle *const v, SUMOReal t)
Returns the traveltime on an edge including penalties.
static std::string _2str(const E *const data)
An O/D (origin/destination) matrix.
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)
A container for districts.
SUMOReal vehicleNumber
The number of vehicles.
static SUMOReal getTravelTime(const ROEdge *const e, const ROVehicle *const v, SUMOReal t)
Returns the traveltime on an edge without penalties.
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
static SUMOReal getPenalizedEffort(const ROEdge *const e, const ROVehicle *const v, SUMOReal t)
Returns the effort to pass an edge including penalties.
SUMOTime begin
The begin time this cell describes.
virtual void loadNet(RONet &toFill, ROAbstractEdgeBuilder &eb)
Loads the network.
A basic edge for routing applications.
int getInternalEdgeNumber() const
Returns the number of internal edges the network contains.
static void fillOptions()
Inserts options used by duarouter into the OptionsCont-singleton.
The router's network representation.
Structure representing possible vehicle parameter.
SUMOReal getLength() const
Returns the length of the edge.
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 applyCurve(const Distribution_Points &ps)
Splits the stored cells dividing them on the given time line.
Static storage of an output device and its base (abstract) implementation.
virtual SUMOReal recomputeCosts(const std::vector< const E * > &edges, const V *const v, SUMOTime msTime) const =0
std::string destination
Name of the destination district.
bool closeTag()
Closes the most recently opened tag.
SUMOVTypeParameter * getVehicleTypeSecure(const std::string &id)
Retrieves the named vehicle type.
SUMOTime end
The end time this cell describes.
SUMOReal getMinimumTravelTime(const ROVehicle *const veh) const
Returns a lower bound for the travel time on this edge without using any stored timeLine.
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
void clear()
Clears information whether an error occured previously.
#define WRITE_MESSAGE(msg)
void cleanup(SUMOAbstractRouter< ROEdge, ROVehicle > *router)
closes the file output for computed routes and deletes routers and associated threads if necessary ...
static void initOutputOptions()
SUMOReal getSpeed() const
Returns the speed allowed on this edge.
vehicles ignoring classes
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
Distribution_Points parseTimeLine(const std::vector< std::string > &def, bool timelineDayInHours)
split the given timeline
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.