![]() |
Eclipse SUMO - Simulation of Urban MObility
|
A device that performs vehicle rerouting based on current edge speeds. More...
#include <MSRoutingEngine.h>
Static Public Member Functions | |
static void | cleanup () |
deletes the router instance More... | |
static double | getAssumedSpeed (const MSEdge *edge) |
return current travel speed assumption More... | |
static const MSRoute * | getCachedRoute (const std::pair< const MSEdge *, const MSEdge * > &key) |
return the cached route or nullptr on miss More... | |
static double | getEffort (const MSEdge *const e, const SUMOVehicle *const v, double t) |
Returns the effort to pass an edge. More... | |
static double | getEffortExtra (const MSEdge *const e, const SUMOVehicle *const v, double t) |
static SUMOTime | getLastAdaptation () |
Information when the last edge weight adaptation occurred. More... | |
static SUMOAbstractRouter< MSEdge, SUMOVehicle > & | getRouterTT (const int rngIndex, const MSEdgeVector &prohibited=MSEdgeVector()) |
return the router instance More... | |
static bool | hasEdgeUpdates () |
returns whether any routing actions take place More... | |
static void | initEdgeWeights () |
initialize the edge weights if not done before More... | |
static void | initRouter (SUMOVehicle *vehicle=nullptr) |
static void | initWeightUpdate () |
intialize period edge weight update More... | |
static bool | isEnabled () |
returns whether any routing actions take place More... | |
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 More... | |
static void | setEdgeTravelTime (const MSEdge *const edge, const double travelTime) |
adapt the known travel time for an edge More... | |
Static Public Attributes | |
static SUMOAbstractRouter< MSEdge, SUMOVehicle >::Operation | myEffortFunc = &MSRoutingEngine::getEffort |
Private Member Functions | |
MSRoutingEngine (const MSRoutingEngine &) | |
Invalidated copy constructor. More... | |
MSRoutingEngine & | operator= (const MSRoutingEngine &) |
Invalidated assignment operator. More... | |
Static Private Member Functions | |
Network state adaptation | |
static SUMOTime | adaptEdgeEfforts (SUMOTime currentTime) |
Adapt edge efforts by the current edge states. More... | |
Static Private Attributes | |
static SUMOTime | myAdaptationInterval = -1 |
At which time interval the edge weights get updated. More... | |
static int | myAdaptationSteps |
The number of steps for averaging edge speeds (ring-buffer) More... | |
static int | myAdaptationStepsIndex = 0 |
The current index in the pastEdgeSpeed ring-buffer. More... | |
static double | myAdaptationWeight |
Information which weight prior edge efforts have. More... | |
static std::map< std::pair< const MSEdge *, const MSEdge * >, const MSRoute * > | myCachedRoutes |
The container of pre-calculated routes. More... | |
static std::vector< double > | myEdgeSpeeds |
The container of edge speeds. More... | |
static Command * | myEdgeWeightSettingCommand = nullptr |
The weights adaptation/overwriting command. More... | |
static SUMOTime | myLastAdaptation = -1 |
Information when the last edge weight adaptation occurred. More... | |
static std::vector< std::vector< double > > | myPastEdgeSpeeds |
The container of edge speeds. More... | |
static SUMOAbstractRouter< MSEdge, SUMOVehicle > * | myRouter = nullptr |
The router to use. More... | |
static bool | myWithTaz |
whether taz shall be used at initial rerouting More... | |
A device that performs vehicle rerouting based on current edge speeds.
The routing-device system consists of in-vehicle devices that perform a routing and a simulation-wide (static) methods for colecting edge weights.
The edge weights container "myEdgeSpeeds" is pre-initialised as soon as one device is built and is kept updated via an event that adapts it to the current mean speed on the simulated network's edges.
A device is assigned to a vehicle using the common explicit/probability - procedure.
A device computes a new route for a vehicle as soon as the vehicle is inserted (within "enterLaneAtInsertion") - and, if the given period is larger than 0 - each x time steps where x is the period. This is triggered by an event that executes "wrappedRerouteCommandExecute".
Definition at line 63 of file MSRoutingEngine.h.
|
private |
Invalidated copy constructor.
Adapt edge efforts by the current edge states.
This method is called by the event handler at the end of a simulation step. The current edge weights are combined with the previously stored.
[in] | currentTime | The current simulation time |
Definition at line 153 of file MSRoutingEngine.cpp.
References OutputDevice::closeTag(), DELTA_T, OutputDevice::getDeviceByOption(), MSNet::getEdgeControl(), MSEdgeControl::getEdges(), MSNet::getInstance(), OptionsCont::getOptions(), initEdgeWeights(), OptionsCont::isSet(), myAdaptationInterval, myAdaptationSteps, myAdaptationStepsIndex, myAdaptationWeight, myCachedRoutes, myEdgeSpeeds, myEffortFunc, myLastAdaptation, myPastEdgeSpeeds, OutputDevice::openTag(), STEPS2TIME, SUMO_ATTR_BEGIN, SUMO_ATTR_END, SUMO_ATTR_ID, SUMO_TAG_EDGE, SUMO_TAG_INTERVAL, and OutputDevice::writeAttr().
Referenced by initWeightUpdate().
|
static |
deletes the router instance
Definition at line 327 of file MSRoutingEngine.cpp.
References MSGlobals::gNumThreads, myAdaptationInterval, myAdaptationStepsIndex, myCachedRoutes, myEdgeSpeeds, myPastEdgeSpeeds, and myRouter.
Referenced by MSDevice::cleanupAll().
|
static |
return current travel speed assumption
Definition at line 147 of file MSRoutingEngine.cpp.
References MSEdge::getLength(), and myEffortFunc.
Referenced by MSEdge::getRoutingSpeed().
|
static |
return the cached route or nullptr on miss
Definition at line 208 of file MSRoutingEngine.cpp.
References myCachedRoutes.
Referenced by MSDevice_Routing::preInsertionReroute().
|
static |
Returns the effort to pass an edge.
This method is given to the used router in order to obtain the efforts to pass an edge from the internal edge weights container.
The time is not used, here, as the current simulation state is used in an aggregated way.
[in] | e | The edge for which the effort to be passed shall be returned |
[in] | v | The vehicle that is rerouted |
[in] | t | The time for which the effort shall be returned |
Definition at line 123 of file MSRoutingEngine.cpp.
References MSEdge::getLength(), MSEdge::getMinimumTravelTime(), MSEdge::getNumericalID(), MAX2(), myEdgeSpeeds, and NUMERICAL_EPS.
Referenced by getEffortExtra(), MSDevice_Routing::getParameter(), and initRouter().
|
static |
Definition at line 133 of file MSRoutingEngine.cpp.
References MSEdge::getBidiEdge(), getEffort(), MSEdge::getLanes(), MSEdge::getLength(), gWeightsRandomFactor, NUMERICAL_EPS, and RandHelper::rand().
Referenced by initRouter().
|
inlinestatic |
Information when the last edge weight adaptation occurred.
Definition at line 77 of file MSRoutingEngine.h.
References myLastAdaptation.
Referenced by MSDevice_Routing::reroute(), and MSTransportableDevice_Routing::reroute().
|
static |
return the router instance
Definition at line 307 of file MSRoutingEngine.cpp.
References MSNet::getEdgeControl(), MSNet::getInstance(), FXWorkerThread::Pool::getWorkers(), MSGlobals::gNumThreads, initEdgeWeights(), initRouter(), initWeightUpdate(), myRouter, SUMOAbstractRouter< E, V >::prohibit(), and FXWorkerThread::Pool::size().
Referenced by libsumo::Simulation::findRoute(), MSVehicle::Influencer::getRouterTT(), MSTriggeredRerouter::notifyEnter(), and GUIVehicle::rerouteDRTStop().
|
inlinestatic |
returns whether any routing actions take place
Definition at line 72 of file MSRoutingEngine.h.
References myEdgeWeightSettingCommand.
Referenced by MSDevice_Routing::MSDevice_Routing(), and MSTransportableDevice_Routing::MSTransportableDevice_Routing().
|
static |
initialize the edge weights if not done before
Definition at line 93 of file MSRoutingEngine.cpp.
References OptionsCont::getBool(), MSNet::getCurrentTimeStep(), MSNet::getInstance(), OptionsCont::getInt(), OptionsCont::getOptions(), MSNet::getTravelTime(), OptionsCont::isDefault(), myAdaptationSteps, myAdaptationWeight, myEdgeSpeeds, myLastAdaptation, myPastEdgeSpeeds, and SIMTIME.
Referenced by adaptEdgeEfforts(), getRouterTT(), MSDevice_Routing::reroute(), and MSTransportableDevice_Routing::reroute().
|
static |
Definition at line 218 of file MSRoutingEngine.cpp.
References SUMOAbstractRouter< E, V >::clone(), MSEdge::getAllEdges(), SUMOTrafficObject::getChosenSpeedFactor(), MSNet::getEdgeControl(), getEffort(), getEffortExtra(), MSNet::getInstance(), OptionsCont::getInt(), OptionsCont::getOptions(), OptionsCont::getString(), MSNet::getTravelTime(), SUMOTrafficObject::getVClass(), FXWorkerThread::Pool::getWorkers(), gWeightsRandomFactor, MSNet::hasBidiEdges(), OptionsCont::isSet(), myAdaptationInterval, myEffortFunc, myRouter, SUMOVehicle::setChosenSpeedFactor(), FXWorkerThread::Pool::size(), and string2time().
Referenced by getRouterTT(), and reroute().
|
static |
intialize period edge weight update
Definition at line 69 of file MSRoutingEngine.cpp.
References adaptEdgeEfforts(), MSEventControl::addEvent(), OutputDevice::createDeviceByOption(), OptionsCont::getBool(), MSNet::getEndOfTimestepEvents(), OptionsCont::getFloat(), MSNet::getInstance(), OptionsCont::getOptions(), OptionsCont::getString(), myAdaptationInterval, myAdaptationSteps, myAdaptationWeight, myEdgeSpeeds, myEdgeWeightSettingCommand, myLastAdaptation, myWithTaz, string2time(), and WRITE_WARNING.
Referenced by MSTransportableDevice_Routing::buildDevices(), MSDevice_Routing::buildVehicleDevices(), and getRouterTT().
|
inlinestatic |
returns whether any routing actions take place
Definition at line 97 of file MSRoutingEngine.h.
References myAdaptationInterval, and myWithTaz.
Referenced by MSInsertionControl::determineCandidates(), and MSInsertionControl::emitVehicles().
|
private |
Invalidated assignment operator.
|
static |
initiate the rerouting, create router / thread pool on first use
Definition at line 269 of file MSRoutingEngine.cpp.
References FXWorkerThread::Pool::add(), MSNet::getEdgeControl(), MSNet::getInstance(), initRouter(), myRouter, myWithTaz, SUMOAbstractRouter< E, V >::prohibit(), SUMOVehicle::reroute(), and FXWorkerThread::Pool::size().
Referenced by MSDevice_Routing::reroute(), and MSRailSignal::LinkInfo::reroute().
|
static |
adapt the known travel time for an edge
Definition at line 301 of file MSRoutingEngine.cpp.
References MSEdge::getLength(), MSEdge::getNumericalID(), and myEdgeSpeeds.
Referenced by MSDevice_Routing::setParameter().
|
staticprivate |
At which time interval the edge weights get updated.
Definition at line 185 of file MSRoutingEngine.h.
Referenced by adaptEdgeEfforts(), cleanup(), initRouter(), initWeightUpdate(), and isEnabled().
|
staticprivate |
The number of steps for averaging edge speeds (ring-buffer)
Definition at line 191 of file MSRoutingEngine.h.
Referenced by adaptEdgeEfforts(), initEdgeWeights(), and initWeightUpdate().
|
staticprivate |
The current index in the pastEdgeSpeed ring-buffer.
Definition at line 194 of file MSRoutingEngine.h.
Referenced by adaptEdgeEfforts(), and cleanup().
|
staticprivate |
Information which weight prior edge efforts have.
Definition at line 182 of file MSRoutingEngine.h.
Referenced by adaptEdgeEfforts(), initEdgeWeights(), and initWeightUpdate().
|
staticprivate |
The container of pre-calculated routes.
Definition at line 206 of file MSRoutingEngine.h.
Referenced by adaptEdgeEfforts(), cleanup(), and getCachedRoute().
|
staticprivate |
The container of edge speeds.
Definition at line 179 of file MSRoutingEngine.h.
Referenced by adaptEdgeEfforts(), cleanup(), getEffort(), initEdgeWeights(), initWeightUpdate(), and setEdgeTravelTime().
|
staticprivate |
The weights adaptation/overwriting command.
Definition at line 176 of file MSRoutingEngine.h.
Referenced by hasEdgeUpdates(), and initWeightUpdate().
|
static |
Definition at line 121 of file MSRoutingEngine.h.
Referenced by adaptEdgeEfforts(), getAssumedSpeed(), and initRouter().
|
staticprivate |
Information when the last edge weight adaptation occurred.
Definition at line 188 of file MSRoutingEngine.h.
Referenced by adaptEdgeEfforts(), getLastAdaptation(), initEdgeWeights(), and initWeightUpdate().
|
staticprivate |
The container of edge speeds.
Definition at line 197 of file MSRoutingEngine.h.
Referenced by adaptEdgeEfforts(), cleanup(), and initEdgeWeights().
|
staticprivate |
The router to use.
Definition at line 203 of file MSRoutingEngine.h.
Referenced by cleanup(), getRouterTT(), initRouter(), and reroute().
|
staticprivate |
whether taz shall be used at initial rerouting
Definition at line 200 of file MSRoutingEngine.h.
Referenced by initWeightUpdate(), isEnabled(), and reroute().