55 double val,
double beg,
double end)
const {
64 WRITE_ERRORF(
TL(
"Trying to set a weight for the unknown edge '%'."),
id);
76 double val,
double beg,
double end)
const {
85 WRITE_ERRORF(
TL(
"Trying to set a weight for the unknown edge '%'."),
id);
99 myLoaders(oc.exists(
"unsorted-input") && oc.getBool(
"unsorted-input") ? 0 :
DELTA_T) {
109 std::string file =
myOptions.getString(
"net-file");
114 throw ProcessError(
TLF(
"The network file '%' is not accessible.", file));
118 myOptions.exists(
"weights.minor-penalty") ?
myOptions.getFloat(
"weights.minor-penalty") : 0,
119 myOptions.exists(
"weights.tls-penalty") ?
myOptions.getFloat(
"weights.tls-penalty") : 0,
120 myOptions.exists(
"weights.turnaround-penalty") ?
myOptions.getFloat(
"weights.turnaround-penalty") : 0);
132 if (
myOptions.isSet(
"additional-files",
false)) {
133 std::vector<std::string> files =
myOptions.getStringVector(
"additional-files");
134 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
136 throw ProcessError(
TLF(
"The additional file '%' is not accessible.", *fileIt));
153 if (
myOptions.exists(
"restriction-params") &&
myOptions.isSet(
"restriction-params")) {
154 const std::vector<std::string> paramKeys =
myOptions.getStringVector(
"restriction-params");
156 edgeIt.second->cacheParamRestrictions(paramKeys);
161 edgeIt.second->setRestrictions(toFill.
getRestrictions(edgeIt.second->getType()));
181 const std::string error =
"No route input specified or all routes were invalid.";
182 if (
myOptions.getBool(
"ignore-errors")) {
190 if (!
myOptions.getBool(
"unsorted-input")) {
207 while (time <= end) {
217 if (time < end && time > end - increment) {
231 RONet& net,
const bool readAll) {
234 if (!
myOptions.isUsableFileList(optionName)) {
237 for (
const std::string& fileIt :
myOptions.getStringVector(optionName)) {
250 WRITE_ERRORF(
TL(
"The loader for % from file '%' could not be initialised (%)."), optionName, fileIt, e.what());
260 const std::string& measure,
const bool useLanes,
const bool boundariesOverride) {
262 if (!
myOptions.isUsableFileList(optionName)) {
266 std::vector<SAXWeightsHandler::ToRetrieveDefinition*> retrieverDefs;
272 if (measure !=
"traveltime") {
273 std::string umeasure = measure;
274 if (measure ==
"CO" || measure ==
"CO2" || measure ==
"HC" || measure ==
"PMx" || measure ==
"NOx" || measure ==
"fuel" || measure ==
"electricity") {
275 umeasure = measure +
"_perVeh";
282 std::vector<std::string> files =
myOptions.getStringVector(optionName);
283 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
294 i.second->buildTimeLines(measure, boundariesOverride);
304 const double perc = (double)(time - start) / (double) absNo;
307 std::cout <<
"Reading up to time step: " +
time2string(time) +
"\r";
314 auto loader =
myLoaders.getFirstLoader();
315 if (loader !=
nullptr) {
316 return loader->getRouteHandler();
#define WRITE_WARNINGF(...)
#define WRITE_MESSAGEF(...)
#define WRITE_ERRORF(...)
#define WRITE_MESSAGE(msg)
#define WRITE_WARNING(msg)
#define PROGRESS_DONE_MESSAGE()
#define PROGRESS_FAILED_MESSAGE()
#define PROGRESS_BEGIN_MESSAGE(msg)
RouterProvider< ROEdge, ROLane, RONode, ROVehicle > RORouterProvider
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
std::set< std::string > deprecatedVehicleClassesSeen
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static bool isReadable(std::string path)
Checks whether the given file is readable.
void setFileName(const std::string &name)
Sets the current file name.
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
A storage for options typed value containers).
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
static OptionsCont & getOptions()
Retrieves the options.
Interface for building instances of router-edges.
A basic edge for routing applications.
void addEffort(double value, double timeBegin, double timeEnd)
Adds a weight value.
void addTravelTime(double value, double timeBegin, double timeEnd)
Adds a travel time value.
Obtains edge travel times from a weights handler and stores them within the edges.
RONet & myNet
The network edges shall be obtained from.
void addEdgeWeight(const std::string &id, double val, double beg, double end) const
Adds a travel time for a given edge and time period.
Obtains edge weights from a weights handler and stores them within the edges.
void addEdgeWeight(const std::string &id, double val, double beg, double end) const
Adds an effort for a given edge and time period.
RONet & myNet
The network edges shall be obtained from.
bool loadWeights(RONet &net, const std::string &optionName, const std::string &measure, const bool useLanes, const bool boundariesOverride)
Loads the net weights.
bool openTypedRoutes(const std::string &optionName, RONet &net, const bool readAll=false)
Opens route handler of the given type.
SUMORouteLoaderControl myLoaders
List of route loaders.
SUMORouteHandler * getRouteHandler()
void processRoutes(const SUMOTime start, const SUMOTime end, const SUMOTime increment, RONet &net, const RORouterProvider &provider)
Loads routes from all previously build route loaders.
virtual ~ROLoader()
Destructor.
ROLoader(OptionsCont &oc, const bool emptyDestinationsAllowed, const bool logSteps)
Constructor.
virtual void loadNet(RONet &toFill, ROAbstractEdgeBuilder &eb)
Loads the network.
void writeStats(const SUMOTime time, const SUMOTime start, const SUMOTime absNo, bool endGiven)
void openRoutes(RONet &net)
Builds and opens all route loaders.
const bool myLogSteps
Information whether the routing steps should be logged.
OptionsCont & myOptions
Options to use.
const bool myEmptyDestinationsAllowed
Information whether empty destinations are allowed.
The handler that parses a SUMO-network for its usage in a router.
const std::map< ROEdge *, std::string > & getBidiMap() const
retrieve mapping of edges to bidi edges (must be resolved after loading network)
The router's network representation.
const std::map< SUMOVehicleClass, double > * getRestrictions(const std::string &id) const
Returns the restrictions for an edge type If no restrictions are present, 0 is returned.
bool furtherStored()
Returns the information whether further vehicles, persons or containers are stored.
SUMOTime saveAndRemoveRoutesUntil(OptionsCont &options, const RORouterProvider &provider, SUMOTime time)
Computes routes described by their definitions and saves them.
void setBidiEdges(const std::map< ROEdge *, std::string > &bidiMap)
add a taz for every junction unless a taz with the same id already exists
void addJunctionTaz(ROAbstractEdgeBuilder &eb)
add a taz for every junction unless a taz with the same id already exists
const NamedObjectCont< ROEdge * > & getEdgeMap() const
bool hasRestrictions() const
Parser and container for routes during their loading.
Complete definition about what shall be retrieved and where to store it.
An XML-handler for network weights.
Parser for routes during their loading.
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false, const bool isRoute=false, const bool isExternal=false, const bool catchExceptions=true)
Runs the given handler on the given file; returns if everything's ok.