Eclipse SUMO - Simulation of Urban MObility
MSRoutingEngine.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2007-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
18 // A device that performs vehicle rerouting based on current edge speeds
19 /****************************************************************************/
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include "MSRoutingEngine.h"
27 #include <microsim/MSNet.h>
28 #include <microsim/MSLane.h>
29 #include <microsim/MSEdge.h>
30 #include <microsim/MSEdgeControl.h>
32 #include <microsim/MSGlobals.h>
41 #include <utils/router/CHRouter.h>
43 
44 
45 // ===========================================================================
46 // static member variables
47 // ===========================================================================
48 std::vector<double> MSRoutingEngine::myEdgeSpeeds;
49 std::vector<std::vector<double> > MSRoutingEngine::myPastEdgeSpeeds;
58 std::map<std::pair<const MSEdge*, const MSEdge*>, const MSRoute*> MSRoutingEngine::myCachedRoutes;
60 #ifdef HAVE_FOX
61 FXMutex MSRoutingEngine::myRouteCacheMutex;
62 #endif
63 
64 
65 // ===========================================================================
66 // method definitions
67 // ===========================================================================
68 void
70  if (myAdaptationInterval == -1) {
72  myEdgeSpeeds.clear();
74  myAdaptationSteps = -1;
75  myLastAdaptation = -1;
77  myWithTaz = oc.getBool("device.rerouting.with-taz");
78  myAdaptationInterval = string2time(oc.getString("device.rerouting.adaptation-interval"));
79  myAdaptationWeight = oc.getFloat("device.rerouting.adaptation-weight");
80  const SUMOTime period = string2time(oc.getString("device.rerouting.period"));
81  if (myAdaptationWeight < 1. && myAdaptationInterval > 0) {
84  } else if (period > 0) {
85  WRITE_WARNING("Rerouting is useless if the edge weights do not get updated!");
86  }
87  OutputDevice::createDeviceByOption("device.rerouting.output", "weights", "meandata_file.xsd");
88  }
89 }
90 
91 
92 void
94  if (myEdgeSpeeds.empty()) {
96  if (myAdaptationWeight == 0 || !oc.isDefault("device.rerouting.adaptation-steps")) {
97  myAdaptationSteps = oc.getInt("device.rerouting.adaptation-steps");
98  }
99  const bool useLoaded = oc.getBool("device.rerouting.init-with-loaded-weights");
100  const double currentSecond = SIMTIME;
101  for (const MSEdge* const edge : MSNet::getInstance()->getEdgeControl().getEdges()) {
102  while (edge->getNumericalID() >= (int)myEdgeSpeeds.size()) {
103  myEdgeSpeeds.push_back(0);
104  if (myAdaptationSteps > 0) {
105  myPastEdgeSpeeds.push_back(std::vector<double>());
106  }
107  }
108  if (useLoaded) {
109  myEdgeSpeeds[edge->getNumericalID()] = edge->getLength() / MSNet::getTravelTime(edge, nullptr, currentSecond);
110  } else {
111  myEdgeSpeeds[edge->getNumericalID()] = edge->getMeanSpeed();
112  }
113  if (myAdaptationSteps > 0) {
114  myPastEdgeSpeeds[edge->getNumericalID()] = std::vector<double>(myAdaptationSteps, myEdgeSpeeds[edge->getNumericalID()]);
115  }
116  }
118  }
119 }
120 
121 
122 double
123 MSRoutingEngine::getEffort(const MSEdge* const e, const SUMOVehicle* const v, double) {
124  const int id = e->getNumericalID();
125  if (id < (int)myEdgeSpeeds.size()) {
127  }
128  return 0.;
129 }
130 
131 
132 double
133 MSRoutingEngine::getEffortExtra(const MSEdge* const e, const SUMOVehicle* const v, double t) {
134  if (e->getBidiEdge() != nullptr && !e->getBidiEdge()->getLanes()[0]->isEmpty()) {
135  // using std::numeric_limits<double>::max() causing router warnings
136  return e->getLength() / NUMERICAL_EPS;
137  }
138  double effort = getEffort(e, v, t);
139  if (gWeightsRandomFactor != 1.) {
140  effort *= RandHelper::rand(1., gWeightsRandomFactor);
141  }
142  return effort;
143 }
144 
145 
146 double
148  return edge->getLength() / myEffortFunc(edge, nullptr, 0);
149 }
150 
151 
152 SUMOTime
154  initEdgeWeights();
155  if (MSNet::getInstance()->getVehicleControl().getDepartedVehicleNo() == 0) {
156  return myAdaptationInterval;
157  }
158  std::map<std::pair<const MSEdge*, const MSEdge*>, const MSRoute*>::iterator it = myCachedRoutes.begin();
159  for (; it != myCachedRoutes.end(); ++it) {
160  it->second->release();
161  }
162  myCachedRoutes.clear();
164  if (myAdaptationSteps > 0) {
165  // moving average
166  for (MSEdgeVector::const_iterator i = edges.begin(); i != edges.end(); ++i) {
167  if ((*i)->isDelayed()) {
168  const int id = (*i)->getNumericalID();
169  const double currSpeed = (*i)->getMeanSpeed();
171  myPastEdgeSpeeds[id][myAdaptationStepsIndex] = currSpeed;
172  }
173  }
175  } else {
176  // exponential moving average
177  const double newWeightFactor = (double)(1. - myAdaptationWeight);
178  for (MSEdgeVector::const_iterator i = edges.begin(); i != edges.end(); ++i) {
179  if ((*i)->isDelayed()) {
180  const int id = (*i)->getNumericalID();
181  const double currSpeed = (*i)->getMeanSpeed();
182  if (currSpeed != myEdgeSpeeds[id]) {
183  myEdgeSpeeds[id] = myEdgeSpeeds[id] * myAdaptationWeight + currSpeed * newWeightFactor;
184  }
185  }
186  }
187  }
188  myLastAdaptation = currentTime + DELTA_T; // because we run at the end of the time step
189  if (OptionsCont::getOptions().isSet("device.rerouting.output")) {
190  OutputDevice& dev = OutputDevice::getDeviceByOption("device.rerouting.output");
192  dev.writeAttr(SUMO_ATTR_ID, "device.rerouting");
193  dev.writeAttr(SUMO_ATTR_BEGIN, STEPS2TIME(currentTime));
195  for (const MSEdge* e : edges) {
196  dev.openTag(SUMO_TAG_EDGE);
197  dev.writeAttr(SUMO_ATTR_ID, e->getID());
198  dev.writeAttr("traveltime", myEffortFunc(e, nullptr, STEPS2TIME(currentTime)));
199  dev.closeTag();
200  }
201  dev.closeTag();
202  }
203  return myAdaptationInterval;
204 }
205 
206 
207 const MSRoute*
208 MSRoutingEngine::getCachedRoute(const std::pair<const MSEdge*, const MSEdge*>& key) {
209  auto routeIt = myCachedRoutes.find(key);
210  if (routeIt != myCachedRoutes.end()) {
211  return routeIt->second;
212  }
213  return nullptr;
214 }
215 
216 
217 void
220  const std::string routingAlgorithm = oc.getString("routing-algorithm");
224  if (routingAlgorithm == "dijkstra") {
225  myRouter = new DijkstraRouter<MSEdge, SUMOVehicle>(MSEdge::getAllEdges(), true, myEffortFunc, nullptr, false, nullptr, true);
226  } else if (routingAlgorithm == "astar") {
227  typedef AStarRouter<MSEdge, SUMOVehicle> AStar;
228  std::shared_ptr<const AStar::LookupTable> lookup = nullptr;
229  if (oc.isSet("astar.all-distances")) {
230  lookup = std::make_shared<const AStar::FLT>(oc.getString("astar.all-distances"), (int)MSEdge::getAllEdges().size());
231  } else if (oc.isSet("astar.landmark-distances") && vehicle != nullptr) {
232  const double speedFactor = vehicle->getChosenSpeedFactor();
233  // we need an exemplary vehicle with speedFactor 1
234  vehicle->setChosenSpeedFactor(1);
237  string2time(oc.getString("begin")), string2time(oc.getString("end")), std::numeric_limits<int>::max(), 1);
238  lookup = std::make_shared<const AStar::LMLT>(oc.getString("astar.landmark-distances"), MSEdge::getAllEdges(), &router, vehicle, "", oc.getInt("device.rerouting.threads"));
239  vehicle->setChosenSpeedFactor(speedFactor);
240  }
241  myRouter = new AStar(MSEdge::getAllEdges(), true, myEffortFunc, lookup, true);
242  } else if (routingAlgorithm == "CH") {
243  const SUMOTime weightPeriod = myAdaptationInterval > 0 ? myAdaptationInterval : std::numeric_limits<int>::max();
245  MSEdge::getAllEdges(), true, myEffortFunc, vehicle->getVClass(), weightPeriod, true, false);
246  } else if (routingAlgorithm == "CHWrapper") {
247  const SUMOTime weightPeriod = myAdaptationInterval > 0 ? myAdaptationInterval : std::numeric_limits<int>::max();
250  string2time(oc.getString("begin")), string2time(oc.getString("end")), weightPeriod, oc.getInt("device.rerouting.threads"));
251  } else {
252  throw ProcessError("Unknown routing algorithm '" + routingAlgorithm + "'!");
253  }
254 #ifdef HAVE_FOX
255  FXWorkerThread::Pool& threadPool = MSNet::getInstance()->getEdgeControl().getThreadPool();
256  if (threadPool.size() > 0) {
257  const std::vector<FXWorkerThread*>& threads = threadPool.getWorkers();
258  if (static_cast<MSEdgeControl::WorkerThread*>(threads.front())->setRouter(myRouter)) {
259  for (std::vector<FXWorkerThread*>::const_iterator t = threads.begin() + 1; t != threads.end(); ++t) {
260  static_cast<MSEdgeControl::WorkerThread*>(*t)->setRouter(myRouter->clone());
261  }
262  }
263  }
264 #endif
265 }
266 
267 
268 void
269 MSRoutingEngine::reroute(SUMOVehicle& vehicle, const SUMOTime currentTime, const std::string& info,
270  const bool onInit, const bool silent, const MSEdgeVector& prohibited) {
271  if (myRouter == nullptr) {
272  initRouter(&vehicle);
273  }
274 #ifdef HAVE_FOX
275  FXWorkerThread::Pool& threadPool = MSNet::getInstance()->getEdgeControl().getThreadPool();
276  if (threadPool.size() > 0) {
277  threadPool.add(new RoutingTask(vehicle, currentTime, info, onInit, silent, prohibited));
278  return;
279  }
280 #endif
281  if (!prohibited.empty()) {
282  myRouter->prohibit(prohibited);
283  }
284  try {
285  vehicle.reroute(currentTime, info, *myRouter, onInit, myWithTaz, silent);
286  } catch (ProcessError&) {
287  if (!silent) {
288  if (!prohibited.empty()) {
290  }
291  throw;
292  }
293  }
294  if (!prohibited.empty()) {
296  }
297 }
298 
299 
300 void
301 MSRoutingEngine::setEdgeTravelTime(const MSEdge* const edge, const double travelTime) {
302  myEdgeSpeeds[edge->getNumericalID()] = edge->getLength() / travelTime;
303 }
304 
305 
307 MSRoutingEngine::getRouterTT(const int rngIndex, const MSEdgeVector& prohibited) {
308  if (myRouter == nullptr) {
310  initEdgeWeights();
311  initRouter();
312  }
313 #ifdef HAVE_FOX
314  FXWorkerThread::Pool& threadPool = MSNet::getInstance()->getEdgeControl().getThreadPool();
315  if (threadPool.size() > 0) {
316  auto& router = static_cast<MSEdgeControl::WorkerThread*>(threadPool.getWorkers()[rngIndex % MSGlobals::gNumThreads])->getRouter();
317  router.prohibit(prohibited);
318  return router;
319  }
320 #endif
321  myRouter->prohibit(prohibited);
322  return *myRouter;
323 }
324 
325 
326 void
328  myAdaptationInterval = -1; // responsible for triggering initEdgeWeights
329  myPastEdgeSpeeds.clear();
330  myEdgeSpeeds.clear();
331  // @todo recheck. calling release crashes in parallel routing
332  //for (auto& item : myCachedRoutes) {
333  // item.second->release();
334  //}
335  myCachedRoutes.clear();
337 #ifdef HAVE_FOX
338  if (MSGlobals::gNumThreads > 1) {
339  // router deletion is done in thread destructor
340  myRouter = nullptr;
341  return;
342  }
343 #endif
344  delete myRouter;
345  myRouter = nullptr;
346 }
347 
348 
349 #ifdef HAVE_FOX
350 void
351 MSRoutingEngine::waitForAll() {
352  FXWorkerThread::Pool& threadPool = MSNet::getInstance()->getEdgeControl().getThreadPool();
353  if (threadPool.size() > 0) {
354  threadPool.waitAll();
355  }
356 }
357 
358 
359 // ---------------------------------------------------------------------------
360 // MSRoutingEngine::RoutingTask-methods
361 // ---------------------------------------------------------------------------
362 void
363 MSRoutingEngine::RoutingTask::run(FXWorkerThread* context) {
364  SUMOAbstractRouter<MSEdge, SUMOVehicle>& router = static_cast<MSEdgeControl::WorkerThread*>(context)->getRouter();
365  if (!myProhibited.empty()) {
366  router.prohibit(myProhibited);
367  }
368  try {
369  myVehicle.reroute(myTime, myInfo, router, myOnInit, myWithTaz, mySilent);
370  } catch (ProcessError&) {
371  if (!mySilent) {
372  if (!myProhibited.empty()) {
373  router.prohibit(MSEdgeVector());
374  }
375  throw;
376  }
377  }
378  if (!myProhibited.empty()) {
379  router.prohibit(MSEdgeVector());
380  }
381  const MSEdge* source = *myVehicle.getRoute().begin();
382  const MSEdge* dest = myVehicle.getRoute().getLastEdge();
383  if (source->isTazConnector() && dest->isTazConnector()) {
384  const std::pair<const MSEdge*, const MSEdge*> key = std::make_pair(source, dest);
385  FXMutexLock lock(myRouteCacheMutex);
387  MSRoutingEngine::myCachedRoutes[key] = &myVehicle.getRoute();
388  myVehicle.getRoute().addReference();
389  }
390  }
391 }
392 #endif
393 
394 
395 /****************************************************************************/
OptionsCont::isSet
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
Definition: OptionsCont.cpp:135
OutputDevice::createDeviceByOption
static bool createDeviceByOption(const std::string &optionName, const std::string &rootElement="", const std::string &schemaFile="")
Creates the device using the output definition stored in the named option.
Definition: OutputDevice.cpp:101
OptionsCont::getInt
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
Definition: OptionsCont.cpp:215
MSRoutingEngine::myAdaptationWeight
static double myAdaptationWeight
Information which weight prior edge efforts have.
Definition: MSRoutingEngine.h:182
MSEdge::getNumericalID
int getNumericalID() const
Returns the numerical id of the edge.
Definition: MSEdge.h:265
MSNet::hasBidiEdges
bool hasBidiEdges() const
return whether the network contains bidirectional rail edges
Definition: MSNet.h:658
MSEventControl::addEvent
virtual void addEvent(Command *operation, SUMOTime execTimeStep=-1)
Adds an Event.
Definition: MSEventControl.cpp:52
WRITE_WARNING
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:275
MSNet.h
SUMOVehicle::setChosenSpeedFactor
virtual void setChosenSpeedFactor(const double factor)=0
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:63
DELTA_T
SUMOTime DELTA_T
Definition: SUMOTime.cpp:36
NUMERICAL_EPS
#define NUMERICAL_EPS
Definition: config.h:148
OptionsCont.h
MSRoutingEngine::myEdgeWeightSettingCommand
static Command * myEdgeWeightSettingCommand
The weights adaptation/overwriting command.
Definition: MSRoutingEngine.h:176
MSRoutingEngine::myRouter
static SUMOAbstractRouter< MSEdge, SUMOVehicle > * myRouter
The router to use.
Definition: MSRoutingEngine.h:203
WrappingCommand.h
MSRoutingEngine::myCachedRoutes
static std::map< std::pair< const MSEdge *, const MSEdge * >, const MSRoute * > myCachedRoutes
The container of pre-calculated routes.
Definition: MSRoutingEngine.h:206
OptionsCont::getString
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
Definition: OptionsCont.cpp:201
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
SUMOVehicle
Representation of a vehicle.
Definition: SUMOVehicle.h:60
MSRoutingEngine::getAssumedSpeed
static double getAssumedSpeed(const MSEdge *edge)
return current travel speed assumption
Definition: MSRoutingEngine.cpp:147
MSRoutingEngine::myEdgeSpeeds
static std::vector< double > myEdgeSpeeds
The container of edge speeds.
Definition: MSRoutingEngine.h:179
OptionsCont::getBool
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
Definition: OptionsCont.cpp:222
SUMOTrafficObject::getVClass
virtual SUMOVehicleClass getVClass() const =0
Returns the vehicle's access class.
OptionsCont::getOptions
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:57
SUMO_ATTR_ID
@ SUMO_ATTR_ID
Definition: SUMOXMLDefinitions.h:378
MSEdge.h
MSRoutingEngine::adaptEdgeEfforts
static SUMOTime adaptEdgeEfforts(SUMOTime currentTime)
Adapt edge efforts by the current edge states.
Definition: MSRoutingEngine.cpp:153
MSRoutingEngine::getRouterTT
static SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterTT(const int rngIndex, const MSEdgeVector &prohibited=MSEdgeVector())
return the router instance
Definition: MSRoutingEngine.cpp:307
MSEdge::getLength
double getLength() const
return the length of the edge
Definition: MSEdge.h:589
MSRoutingEngine::myLastAdaptation
static SUMOTime myLastAdaptation
Information when the last edge weight adaptation occurred.
Definition: MSRoutingEngine.h:188
CHRouterWrapper.h
MSRoute
Definition: MSRoute.h:66
MSRoutingEngine::setEdgeTravelTime
static void setEdgeTravelTime(const MSEdge *const edge, const double travelTime)
adapt the known travel time for an edge
Definition: MSRoutingEngine.cpp:301
DijkstraRouter
Computes the shortest path through a network using the Dijkstra algorithm.
Definition: DijkstraRouter.h:61
OutputDevice::closeTag
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
Definition: OutputDevice.cpp:253
FXWorkerThread::Pool::size
int size() const
Returns the number of threads in the pool.
Definition: FXWorkerThread.h:243
gWeightsRandomFactor
double gWeightsRandomFactor
Definition: StdDefs.cpp:30
MSRoutingEngine::cleanup
static void cleanup()
deletes the router instance
Definition: MSRoutingEngine.cpp:327
SUMO_ATTR_BEGIN
@ SUMO_ATTR_BEGIN
weights: time range begin
Definition: SUMOXMLDefinitions.h:678
CHRouter.h
MAX2
T MAX2(T a, T b)
Definition: StdDefs.h:79
SUMOTrafficObject::getChosenSpeedFactor
virtual double getChosenSpeedFactor() const =0
MSGlobals::gNumThreads
static int gNumThreads
how many threads to use
Definition: MSGlobals.h:126
FXWorkerThread::Pool::waitAll
void waitAll(const bool deleteFinished=true)
waits for all tasks to be finished
Definition: FXWorkerThread.h:185
OutputDevice::writeAttr
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:255
StaticCommand
A wrapper for a Command function.
Definition: StaticCommand.h:40
MSRoutingEngine::initEdgeWeights
static void initEdgeWeights()
initialize the edge weights if not done before
Definition: MSRoutingEngine.cpp:93
RandHelper::rand
static double rand(std::mt19937 *rng=0)
Returns a random real number in [0, 1)
Definition: RandHelper.h:53
SIMTIME
#define SIMTIME
Definition: SUMOTime.h:63
MSRoutingEngine::getEffort
static double getEffort(const MSEdge *const e, const SUMOVehicle *const v, double t)
Returns the effort to pass an edge.
Definition: MSRoutingEngine.cpp:123
MSRoutingEngine::reroute
static void reroute(SUMOVehicle &vehicle, const SUMOTime currentTime, const std::string &info, const bool onInit=false, const bool silent=false, const MSEdgeVector &prohibited=MSEdgeVector())
initiate the rerouting, create router / thread pool on first use
Definition: MSRoutingEngine.cpp:269
MSNet::getEndOfTimestepEvents
MSEventControl * getEndOfTimestepEvents()
Returns the event control for events executed at the end of a time step.
Definition: MSNet.h:439
AStarRouter.h
MSRoutingEngine::myAdaptationStepsIndex
static int myAdaptationStepsIndex
The current index in the pastEdgeSpeed ring-buffer.
Definition: MSRoutingEngine.h:194
MSNet::getCurrentTimeStep
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:283
MSEdge::isTazConnector
bool isTazConnector() const
Definition: MSEdge.h:258
STEPS2TIME
#define STEPS2TIME(x)
Definition: SUMOTime.h:56
CHRouterWrapper
Computes the shortest path through a contracted network.
Definition: CHRouterWrapper.h:63
MSRoutingEngine::myWithTaz
static bool myWithTaz
whether taz shall be used at initial rerouting
Definition: MSRoutingEngine.h:200
SUMO_TAG_EDGE
@ SUMO_TAG_EDGE
begin/end of the description of an edge
Definition: SUMOXMLDefinitions.h:47
ProcessError
Definition: UtilExceptions.h:39
MSRoutingEngine::initRouter
static void initRouter(SUMOVehicle *vehicle=nullptr)
Definition: MSRoutingEngine.cpp:218
FXWorkerThread::Pool::getWorkers
const std::vector< FXWorkerThread * > & getWorkers()
Definition: FXWorkerThread.h:257
StaticCommand.h
MSGlobals.h
MSRoutingEngine::myAdaptationInterval
static SUMOTime myAdaptationInterval
At which time interval the edge weights get updated.
Definition: MSRoutingEngine.h:185
MSEdge::getBidiEdge
const MSEdge * getBidiEdge() const
return opposite superposable/congruent edge, if it exist and 0 else
Definition: MSEdge.h:249
MSEdge::getMinimumTravelTime
double getMinimumTravelTime(const SUMOVehicle *const veh) const
returns the minimum travel time for the given vehicle
Definition: MSEdge.h:421
OptionsCont
A storage for options typed value containers)
Definition: OptionsCont.h:89
MSEdge
A road/street connecting two junctions.
Definition: MSEdge.h:78
MSRoutingEngine.h
string2time
SUMOTime string2time(const std::string &r)
Definition: SUMOTime.cpp:44
SUMOAbstractRouter::prohibit
virtual void prohibit(const std::vector< E * > &)
Definition: SUMOAbstractRouter.h:163
MSRoutingEngine::myPastEdgeSpeeds
static std::vector< std::vector< double > > myPastEdgeSpeeds
The container of edge speeds.
Definition: MSRoutingEngine.h:197
OptionsCont::isDefault
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
Definition: OptionsCont.cpp:163
SUMOAbstractRouter< MSEdge, SUMOVehicle >
MSRoutingEngine::initWeightUpdate
static void initWeightUpdate()
intialize period edge weight update
Definition: MSRoutingEngine.cpp:69
MSEdgeControl.h
OptionsCont::getFloat
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
Definition: OptionsCont.cpp:208
OutputDevice::openTag
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
Definition: OutputDevice.cpp:239
StringUtils.h
SUMOAbstractRouter::clone
virtual SUMOAbstractRouter * clone()=0
MSNet::getInstance
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:167
SUMOVehicle::reroute
virtual void reroute(SUMOTime t, const std::string &info, SUMOAbstractRouter< MSEdge, SUMOVehicle > &router, const bool onInit=false, const bool withTaz=false, const bool silent=false)=0
Performs a rerouting using the given router.
CHRouter
Computes the shortest path through a contracted network.
Definition: CHRouter.h:61
MSRoutingEngine::getEffortExtra
static double getEffortExtra(const MSEdge *const e, const SUMOVehicle *const v, double t)
Definition: MSRoutingEngine.cpp:133
FXWorkerThread::Pool
A pool of worker threads which distributes the tasks and collects the results.
Definition: FXWorkerThread.h:88
Command
Base (microsim) event class.
Definition: Command.h:52
MSEdgeVector
std::vector< MSEdge * > MSEdgeVector
Definition: MSEdge.h:74
FXWorkerThread::Pool::add
void add(Task *const t, int index=-1)
Gives a number to the given task and assigns it to the worker with the given index....
Definition: FXWorkerThread.h:147
AStarRouter
Computes the shortest path through a network using the A* algorithm.
Definition: AStarRouter.h:77
SUMOSAXAttributes.h
MSEdge::getLanes
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Definition: MSEdge.h:167
MSRoutingEngine::myAdaptationSteps
static int myAdaptationSteps
The number of steps for averaging edge speeds (ring-buffer)
Definition: MSRoutingEngine.h:191
config.h
DijkstraRouter.h
SUMO_ATTR_END
@ SUMO_ATTR_END
weights: time range end
Definition: SUMOXMLDefinitions.h:680
SUMO_TAG_INTERVAL
@ SUMO_TAG_INTERVAL
an aggreagated-output interval
Definition: SUMOXMLDefinitions.h:159
MSEventControl.h
MSLane.h
MSRoutingEngine::myEffortFunc
static SUMOAbstractRouter< MSEdge, SUMOVehicle >::Operation myEffortFunc
Definition: MSRoutingEngine.h:121
MSNet::getEdgeControl
MSEdgeControl & getEdgeControl()
Returns the edge control.
Definition: MSNet.h:379
MSRoutingEngine::getCachedRoute
static const MSRoute * getCachedRoute(const std::pair< const MSEdge *, const MSEdge * > &key)
return the cached route or nullptr on miss
Definition: MSRoutingEngine.cpp:208
MSEdge::getAllEdges
static const MSEdgeVector & getAllEdges()
Returns all edges with a numerical id.
Definition: MSEdge.cpp:798
MSVehicleControl.h
MSNet::getTravelTime
static double getTravelTime(const MSEdge *const e, const SUMOVehicle *const v, double t)
Returns the travel time to pass an edge.
Definition: MSNet.cpp:150
OutputDevice::getDeviceByOption
static OutputDevice & getDeviceByOption(const std::string &name)
Returns the device described by the option.
Definition: OutputDevice.cpp:116
MSEdgeControl::getEdges
const MSEdgeVector & getEdges() const
Returns loaded edges.
Definition: MSEdgeControl.h:169
FXWorkerThread
A thread repeatingly calculating incoming tasks.
Definition: FXWorkerThread.h:48