Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MSRoutingEngine Class Reference

A device that performs vehicle rerouting based on current edge speeds. More...

#include <MSRoutingEngine.h>

Collaboration diagram for MSRoutingEngine:
[legend]

Public Types

typedef SUMOAbstractRouter< MSEdge, SUMOVehicle >::Prohibitions Prohibitions
 

Static Public Member Functions

static void addEdgeTravelTime (const MSEdge &edge, const SUMOTime travelTime)
 record actual travel time for an edge
 
static void applyExtras (const MSEdge *const e, const SUMOVehicle *const v, SUMOTime step, double &effort)
 apply cost modifications from randomness, priorityFactor and preferences
 
static void cleanup ()
 deletes the router instance
 
static void cleanupCCH ()
 tears down the CCH state (myCCHLive/myCCHFreeflow/myCCHGraph) only – the ref vehicles owned by the CCH metric families hold a raw MSVehicleType* that MSVehicleControl frees, so this MUST run before MSNet deletes its MSVehicleControl (cleanup() itself runs far later, from MSNet::clearAll(), so this is called separately and first; it is also idempotent/safe to call again from cleanup() afterwards since it nulls out the pointers it deletes)
 
static MSCCHGraph * ensureCCHGraph ()
 the shared CCH topology, built on first demand (used by MSNet::getRouterTT to construct its CCH router; the device path builds it through initCCH)
 
static double getAssumedSpeed (const MSEdge *edge, const SUMOVehicle *veh)
 return current travel speed assumption
 
static ConstMSRoutePtr getCachedRoute (const std::pair< const MSEdge *, const MSEdge * > &key)
 return the cached route or nullptr on miss
 
static double getEffort (const MSEdge *const e, const SUMOVehicle *const v, double t)
 Returns the effort to pass an edge.
 
static double getEffortBike (const MSEdge *const e, const SUMOVehicle *const v, double t)
 
static double getEffortExtra (const MSEdge *const e, const SUMOVehicle *const v, double t)
 
static const RoutingKit::CustomizableContractionHierarchyMetric * getFreeflowCCHMetric (SUMOVehicleClass vClass, SUMOTime time, const SUMOVehicle *veh)
 the free-flow CCH metric for MSNet's routers (TraCI / triggers / GUI), keyed by vehicle type and filled through MSNet::getTravelTime with a reference vehicle of the type. Free-flow efforts are static, so each metric customizes once; a runtime permission change re-customizes in place. Returns nullptr (-> exact A* fallback) whenever the query cannot be served by a shared metric: individual or global TraCI edge weights, a routing mode other than DEFAULT, or a vehicle-specific type. MAIN-THREAD ONLY – MSNet's routers never run on the worker threads, which is what allows the synchronous lazy build and repair.
 
static MSTransportableRouter & getIntermodalRouterTT (const int rngIndex, const Prohibitions &prohibited={})
 return the person router instance
 
static SUMOTime getLastAdaptation ()
 Information when the last edge weight adaptation occurred.
 
static const RoutingKit::CustomizableContractionHierarchyMetric * getPublishedCCHMetric (SUMOVehicleClass vClass, SUMOTime time, const SUMOVehicle *veh)
 the currently published (customized) CCH metric FOR A GIVEN vehicle class, or nullptr if that class has no CCH metric (then the caller falls back to A*). Lock-free: a plain atomic pointer read. The metric objects live for the whole run, so the raw pointer is always valid; the double buffer guarantees the pointer we hand out is not the one being customized. Called on the routing hot path – allocation- and lock-free.
 
static MSVehicleRouter & getRouterTT (const int rngIndex, SUMOVehicleClass svc, const Prohibitions &prohibited={})
 return the vehicle router instance
 
static bool hasBikeSpeeds ()
 whether the router collects bicycle speeds
 
static bool hasEdgeUpdates ()
 returns whether any edge weight updates will take place
 
static bool haveExtras ()
 
static void initEdgeWeights (SUMOVehicleClass svc, SUMOTime lastAdaption=-1, int index=-1)
 initialize the edge weights if not done before
 
static void initRouter (SUMOVehicle *vehicle=nullptr)
 
static void initWeightConstants (const OptionsCont &oc)
 initialize constants for using myPriorityFactor
 
static void initWeightUpdate (SUMOTime lastAdaption=- 1)
 intialize period edge weight update
 
static void invalidateCCHEdge (const MSEdge *e)
 a runtime permission change (closure / re-opening) hit this edge: invalidate the graph's primed connection masks and both families' metrics (queries divert to the exact fallback until the families re-customize)
 
static bool isEnabled ()
 returns whether any routing actions take place
 
static void loadCCHMetric (const SUMOSAXAttributes &attrs)
 Loads the arcs of a CCH metric that lag behind the speeds.
 
static void loadState (const SUMOSAXAttributes &attrs)
 Loads the state.
 
static void reroute (MSTransportable &t, const SUMOTime currentTime, const std::string &info, const bool onInit=false, const bool silent=false, const Prohibitions &prohibited={})
 initiate the person rerouting, create router / thread pool on first use
 
static void reroute (SUMOVehicle &vehicle, const SUMOTime currentTime, const std::string &info, const bool onInit=false, const bool silent=false, const Prohibitions &prohibited={})
 initiate the rerouting, create router / thread pool on first use
 
static void saveState (OutputDevice &out)
 Saves the state (i.e. recorded speeds)
 
static void setEdgeTravelTime (const MSEdge *const edge, const double travelTime)
 adapt the known travel time for an edge
 
static bool withTaz ()
 whether taz-routing is enabled
 

Static Public Attributes

static SUMOAbstractRouter< MSEdge, SUMOVehicle >::Operation myEffortFunc = &MSRoutingEngine::getEffort
 

Private Types

typedef std::pair< SUMOTime, int > TimeAndCount
 

Private Member Functions

 MSRoutingEngine (const MSRoutingEngine &)
 Invalidated copy constructor.
 
MSRoutingEngine & operator= (const MSRoutingEngine &)
 Invalidated assignment operator.
 

Static Private Member Functions

static void _initEdgeWeights (std::vector< double > &edgeSpeeds, std::vector< std::vector< double > > &pastEdgeSpeeds)
 initialized edge speed storage into the given containers
 
static void buildCCHLive ()
 build the live family without metrics
 
static SUMOVehicle * buildCCHRefVehicle (const MSVehicleType *type, int slot)
 construct the unregistered effort-reference vehicle for a type: never counted, inserted or given devices, with the type's mean speed factor and a deterministic random seed (the family's RefVehicleFactory; the slot picks the frozen random-factor realization, see device.rerouting.cch-ensemble)
 
static MSCCHMetricFamily * getLoadedCCH ()
 the live family restored from a state, built on first use
 
static SumoRNG * getThreadRNG ()
 returns RNG associated with the current thread
 
static void initCCH ()
 build the shared CCH + the live family with one metric per loaded type, publish initial metrics
 
Network state adaptation
static SUMOTime adaptEdgeEfforts (SUMOTime currentTime)
 Adapt edge efforts by the current edge states.
 
static double patchSpeedForTurns (const MSEdge *edge, double currSpeed)
 

Static Private Attributes

static SUMOTime myAdaptationInterval = -1
 At which time interval the edge weights get updated.
 
static int myAdaptationSteps
 The number of steps for averaging edge speeds (ring-buffer)
 
static int myAdaptationStepsIndex = 0
 The current index in the pastEdgeSpeed ring-buffer.
 
static double myAdaptationWeight
 Information which weight prior edge efforts have.
 
static bool myBikeSpeeds
 whether separate speeds for bicycles shall be tracked
 
static std::map< std::pair< const MSEdge *, const MSEdge * >, ConstMSRoutePtr > myCachedRoutes
 The container of pre-calculated routes.
 
static MSCCHMetricFamily * myCCHFreeflow = nullptr
 the STATIC free-flow metric family behind MSNet's routers (TraCI / triggers / GUI, all main-thread); built on first query
 
static MSCCHGraph * myCCHGraph = nullptr
 the immutable shared CCH topology (built once), or nullptr if inactive
 
static MSCCHMetricFamily * myCCHLive = nullptr
 the rerouting device's LIVE metric family over the adaptive speed tables (see utils/router/CCHMetricFamily.h): metrics are keyed by vehicle TYPE – mirroring duarouter's keying – and filled with an OWNED reference vehicle of the type, so the type's maximum speed, vClass speed limits, routing preferences, the bicycle speed table and one frozen weights.random-factor realization are exact per metric. nullptr until initCCH.
 
static bool myDynamicRandomness
 whether randomness varies over time
 
static std::vector< double > myEdgeBikeSpeeds
 
static double myEdgePriorityRange
 the difference between maximum and minimum priority for all edges
 
static std::vector< double > myEdgeSpeeds
 The container of edge speeds.
 
static std::vector< TimeAndCount > myEdgeTravelTimes
 Sum of travel times experienced by equipped vehicles for each edge.
 
static Command * myEdgeWeightSettingCommand = nullptr
 The weights adaptation/overwriting command.
 
static bool myHaveExtras
 whether extra routing cost modifications are configured
 
static SUMOTime myLastAdaptation = -1
 Information when the last edge weight adaptation occurred.
 
static double myMinEdgePriority
 Minimum priority for all edges.
 
static std::vector< std::vector< double > > myPastEdgeBikeSpeeds
 
static std::vector< std::vector< double > > myPastEdgeSpeeds
 The container of past edge speeds (when using a simple moving average)
 
static double myPriorityFactor
 Coefficient for factoring edge priority into routing weight.
 
static std::mutex myRouterInitLock
 serialises building the routers when the first queries come from several threads
 
static MSRouterProvider * myRouterProvider = nullptr
 The router to use.
 
static std::atomic< bool > myRouterReady
 whether the routers of all threads are built
 
static bool myWithTaz
 whether taz shall be used at initial rerouting
 

Detailed Description

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 78 of file MSRoutingEngine.h.

Member Typedef Documentation

◆ Prohibitions

Definition at line 80 of file MSRoutingEngine.h.

◆ TimeAndCount

typedef std::pair<SUMOTime, int> MSRoutingEngine::TimeAndCount
private

Definition at line 317 of file MSRoutingEngine.h.

Constructor & Destructor Documentation

◆ MSRoutingEngine()

MSRoutingEngine::MSRoutingEngine ( const MSRoutingEngine &  )
private

Invalidated copy constructor.

Member Function Documentation

◆ _initEdgeWeights()

void MSRoutingEngine::_initEdgeWeights ( std::vector< double > &  edgeSpeeds,
std::vector< std::vector< double > > &  pastEdgeSpeeds 
)
staticprivate

initialized edge speed storage into the given containers

Definition at line 172 of file MSRoutingEngine.cpp.

References OptionsCont::getBool(), MSNet::getCurrentTimeStep(), MSNet::getEdgeControl(), MSEdgeControl::getEdges(), MSNet::getInstance(), OptionsCont::getOptions(), MSNet::getTravelTime(), MSGlobals::gWeightsSeparateTurns, myAdaptationSteps, myEdgeSpeeds, myEdgeTravelTimes, myLastAdaptation, and SIMTIME.

Referenced by initEdgeWeights().

Here is the caller graph for this function:

◆ adaptEdgeEfforts()

SUMOTime MSRoutingEngine::adaptEdgeEfforts ( SUMOTime  currentTime)
staticprivate

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.

Parameters
[in]currentTimeThe current simulation time
Returns
The offset to the next call (always 1 in this case - edge weights are updated each time step)
Todo:
Describe how the weights are adapted
See also
MSEventHandler
StaticCommand

Definition at line 238 of file MSRoutingEngine.cpp.

References CCHMetricFamily< E, V, K >::atBarrier(), OutputDevice::closeTag(), DEBUG_COND, OptionsCont::getDeviceByOption(), MSNet::getEdgeControl(), MSEdgeControl::getEdges(), getEffortBike(), MSNet::getInstance(), OptionsCont::getOptions(), MSGlobals::gWeightsSeparateTurns, initEdgeWeights(), OptionsCont::isSet(), CCHMetricFamily< E, V, K >::markDirty(), myAdaptationInterval, myAdaptationSteps, myAdaptationStepsIndex, myAdaptationWeight, myBikeSpeeds, myCachedRoutes, myCCHLive, myEdgeBikeSpeeds, myEdgeSpeeds, myEffortFunc, myLastAdaptation, myPastEdgeBikeSpeeds, myPastEdgeSpeeds, OutputDevice::openTag(), patchSpeedForTurns(), SIMTIME, STEPS2TIME, SUMO_ATTR_BEGIN, SUMO_ATTR_END, SUMO_ATTR_ID, SUMO_TAG_EDGE, SUMO_TAG_INTERVAL, SVC_BICYCLE, SVC_PASSENGER, and OutputDevice::writeAttr().

Referenced by initWeightUpdate().

Here is the caller graph for this function:

◆ addEdgeTravelTime()

void MSRoutingEngine::addEdgeTravelTime ( const MSEdge &  edge,
const SUMOTime  travelTime 
)
static

record actual travel time for an edge

Definition at line 751 of file MSRoutingEngine.cpp.

References MSEdge::getNumericalID(), and myEdgeTravelTimes.

Referenced by MSDevice_Routing::notifyEnter().

Here is the caller graph for this function:

◆ applyExtras()

static void MSRoutingEngine::applyExtras ( const MSEdge *const  e,
const SUMOVehicle *const  v,
SUMOTime  step,
double &  effort 
)
inlinestatic

apply cost modifications from randomness, priorityFactor and preferences

Definition at line 106 of file MSRoutingEngine.h.

References MSNet::getInstance(), MSEdge::getNumericalID(), MSNet::getPreference(), MSEdge::getPriority(), SUMOTrafficObject::getRandomSeed(), MSEdge::getRoutingType(), SUMOTrafficObject::getVTypeParameter(), gRoutingPreferences, gWeightsRandomFactor, myDynamicRandomness, myEdgePriorityRange, myMinEdgePriority, myPriorityFactor, and RandHelper::randHash().

Referenced by getEffortExtra(), and MSNet::getTravelTime().

Here is the caller graph for this function:

◆ buildCCHLive()

void MSRoutingEngine::buildCCHLive ( )
staticprivate

build the live family without metrics

Definition at line 377 of file MSRoutingEngine.cpp.

References buildCCHRefVehicle(), ensureCCHGraph(), getEffort(), OptionsCont::getFloat(), OptionsCont::getInt(), OptionsCont::getOptions(), OptionsCont::getString(), myCCHGraph, myCCHLive, myEffortFunc, STEPS2TIME, and string2time().

Referenced by getLoadedCCH(), and initCCH().

Here is the caller graph for this function:

◆ buildCCHRefVehicle()

SUMOVehicle * MSRoutingEngine::buildCCHRefVehicle ( const MSVehicleType *  type,
int  slot 
)
staticprivate

construct the unregistered effort-reference vehicle for a type: never counted, inserted or given devices, with the type's mean speed factor and a deterministic random seed (the family's RefVehicleFactory; the slot picks the frozen random-factor realization, see device.rerouting.cch-ensemble)

Definition at line 402 of file MSRoutingEngine.cpp.

References MSEdge::getAllEdges(), MSVehicleType::getID(), Distribution_Parameterized::getParameter(), MSVehicleType::getSpeedFactor(), MSGlobals::gUseMesoSim, SUMOVehicleParameter::id, and toString().

Referenced by buildCCHLive(), and getFreeflowCCHMetric().

Here is the caller graph for this function:

◆ cleanup()

void MSRoutingEngine::cleanup ( )
static

deletes the router instance

Definition at line 834 of file MSRoutingEngine.cpp.

References cleanupCCH(), MSGlobals::gNumThreads, myAdaptationInterval, myAdaptationStepsIndex, myCachedRoutes, myEdgeBikeSpeeds, myEdgeSpeeds, myEdgeTravelTimes, myPastEdgeBikeSpeeds, myPastEdgeSpeeds, myRouterProvider, and myRouterReady.

Referenced by MSDevice::cleanupAll().

Here is the caller graph for this function:

◆ cleanupCCH()

void MSRoutingEngine::cleanupCCH ( )
static

tears down the CCH state (myCCHLive/myCCHFreeflow/myCCHGraph) only – the ref vehicles owned by the CCH metric families hold a raw MSVehicleType* that MSVehicleControl frees, so this MUST run before MSNet deletes its MSVehicleControl (cleanup() itself runs far later, from MSNet::clearAll(), so this is called separately and first; it is also idempotent/safe to call again from cleanup() afterwards since it nulls out the pointers it deletes)

Definition at line 816 of file MSRoutingEngine.cpp.

References myCCHFreeflow, myCCHGraph, and myCCHLive.

Referenced by cleanup(), and MSNet::~MSNet().

Here is the caller graph for this function:

◆ ensureCCHGraph()

MSCCHGraph * MSRoutingEngine::ensureCCHGraph ( )
static

the shared CCH topology, built on first demand (used by MSNet::getRouterTT to construct its CCH router; the device path builds it through initCCH)

Definition at line 339 of file MSRoutingEngine.cpp.

References MSEdge::getAllEdges(), and myCCHGraph.

Referenced by buildCCHLive(), getFreeflowCCHMetric(), and MSNet::getRouterTT().

Here is the caller graph for this function:

◆ getAssumedSpeed()

double MSRoutingEngine::getAssumedSpeed ( const MSEdge *  edge,
const SUMOVehicle *  veh 
)
static

return current travel speed assumption

Definition at line 232 of file MSRoutingEngine.cpp.

References MSEdge::getLength(), and myEffortFunc.

Referenced by MSEdge::getRoutingSpeed(), and MSEdge::getTravelTimeAggregated().

Here is the caller graph for this function:

◆ getCachedRoute()

ConstMSRoutePtr MSRoutingEngine::getCachedRoute ( const std::pair< const MSEdge *, const MSEdge * > &  key)
static

return the cached route or nullptr on miss

Definition at line 577 of file MSRoutingEngine.cpp.

References myCachedRoutes.

Referenced by MSDevice_Routing::preInsertionReroute().

Here is the caller graph for this function:

◆ getEffort()

double MSRoutingEngine::getEffort ( const MSEdge *const  e,
const SUMOVehicle *const  v,
double  t 
)
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.

Parameters
[in]eThe edge for which the effort to be passed shall be returned
[in]vThe vehicle that is rerouted
[in]tThe time for which the effort shall be returned
Returns
The effort (time to pass in this case) for an edge
See also
DijkstraRouter_ByProxi

Definition at line 202 of file MSRoutingEngine.cpp.

References MSEdge::getLength(), MSEdge::getMinimumTravelTime(), MSEdge::getNumericalID(), MAX2(), and myEdgeSpeeds.

Referenced by buildCCHLive(), getEffortExtra(), getLoadedCCH(), MSDevice_Routing::getParameter(), MSNet::getTravelTime(), and initRouter().

Here is the caller graph for this function:

◆ getEffortBike()

double MSRoutingEngine::getEffortBike ( const MSEdge *const  e,
const SUMOVehicle *const  v,
double  t 
)
static

Definition at line 212 of file MSRoutingEngine.cpp.

References MSEdge::getLength(), MSEdge::getMinimumTravelTime(), MSEdge::getNumericalID(), MAX2(), and myEdgeBikeSpeeds.

Referenced by adaptEdgeEfforts(), getEffortExtra(), and MSNet::getTravelTime().

Here is the caller graph for this function:

◆ getEffortExtra()

double MSRoutingEngine::getEffortExtra ( const MSEdge *const  e,
const SUMOVehicle *const  v,
double  t 
)
static

Definition at line 222 of file MSRoutingEngine.cpp.

References applyExtras(), getEffort(), getEffortBike(), SUMOTrafficObject::getVClass(), myBikeSpeeds, SIMSTEP, and SVC_BICYCLE.

Referenced by getLoadedCCH(), MSNet::getTravelTime(), and initRouter().

Here is the caller graph for this function:

◆ getFreeflowCCHMetric()

const RoutingKit::CustomizableContractionHierarchyMetric * MSRoutingEngine::getFreeflowCCHMetric ( SUMOVehicleClass  vClass,
SUMOTime  time,
const SUMOVehicle *  veh 
)
static

the free-flow CCH metric for MSNet's routers (TraCI / triggers / GUI), keyed by vehicle type and filled through MSNet::getTravelTime with a reference vehicle of the type. Free-flow efforts are static, so each metric customizes once; a runtime permission change re-customizes in place. Returns nullptr (-> exact A* fallback) whenever the query cannot be served by a shared metric: individual or global TraCI edge weights, a routing mode other than DEFAULT, or a vehicle-specific type. MAIN-THREAD ONLY – MSNet's routers never run on the worker threads, which is what allows the synchronous lazy build and repair.

Definition at line 471 of file MSRoutingEngine.cpp.

References buildCCHRefVehicle(), MSEdgeWeightsStorage::empty(), ensureCCHGraph(), CCHMetricFamily< E, V, K >::get(), MSNet::getCurrentTimeStep(), MSNet::getInstance(), SUMOTrafficObject::getRoutingMode(), MSNet::getTravelTime(), MSVehicleType::getVehicleClass(), SUMOTrafficObject::getVehicleType(), MSNet::getWeightsStorage(), MSBaseVehicle::getWeightsStorage(), MSVehicleType::isVehicleSpecific(), myCCHFreeflow, libsumo::ROUTING_MODE_DEFAULT, and SUMOTime_MAX.

Referenced by MSNet::getRouterTT().

Here is the caller graph for this function:

◆ getIntermodalRouterTT()

MSTransportableRouter & MSRoutingEngine::getIntermodalRouterTT ( const int  rngIndex,
const Prohibitions &  prohibited = {} 
)
static

◆ getLastAdaptation()

static SUMOTime MSRoutingEngine::getLastAdaptation ( )
inlinestatic

Information when the last edge weight adaptation occurred.

Definition at line 97 of file MSRoutingEngine.h.

References myLastAdaptation.

Referenced by MSDevice_Routing::reroute(), and MSTransportableDevice_Routing::reroute().

Here is the caller graph for this function:

◆ getLoadedCCH()

MSCCHMetricFamily * MSRoutingEngine::getLoadedCCH ( )
staticprivate

the live family restored from a state, built on first use

Definition at line 390 of file MSRoutingEngine.cpp.

References buildCCHLive(), OptionsCont::getBool(), getEffort(), getEffortExtra(), OptionsCont::getOptions(), OptionsCont::getString(), myCCHLive, myEffortFunc, and myHaveExtras.

Referenced by loadCCHMetric(), and loadState().

Here is the caller graph for this function:

◆ getPublishedCCHMetric()

const RoutingKit::CustomizableContractionHierarchyMetric * MSRoutingEngine::getPublishedCCHMetric ( SUMOVehicleClass  vClass,
SUMOTime  time,
const SUMOVehicle *  veh 
)
static

the currently published (customized) CCH metric FOR A GIVEN vehicle class, or nullptr if that class has no CCH metric (then the caller falls back to A*). Lock-free: a plain atomic pointer read. The metric objects live for the whole run, so the raw pointer is always valid; the double buffer guarantees the pointer we hand out is not the one being customized. Called on the routing hot path – allocation- and lock-free.

Definition at line 453 of file MSRoutingEngine.cpp.

References Named::getID(), SUMOTrafficObject::getVehicleType(), MSVehicleType::isVehicleSpecific(), myCCHLive, and CCHMetricFamily< E, V, K >::published().

Referenced by initRouter().

Here is the caller graph for this function:

◆ getRouterTT()

◆ getThreadRNG()

static SumoRNG * MSRoutingEngine::getThreadRNG ( )
staticprivate

returns RNG associated with the current thread

◆ hasBikeSpeeds()

static bool MSRoutingEngine::hasBikeSpeeds ( )
inlinestatic

whether the router collects bicycle speeds

Definition at line 193 of file MSRoutingEngine.h.

References myBikeSpeeds.

Referenced by MSNet::getTravelTime().

Here is the caller graph for this function:

◆ hasEdgeUpdates()

static bool MSRoutingEngine::hasEdgeUpdates ( )
inlinestatic

returns whether any edge weight updates will take place

Definition at line 92 of file MSRoutingEngine.h.

References myEdgeWeightSettingCommand.

Referenced by MSDevice_Routing::MSDevice_Routing().

Here is the caller graph for this function:

◆ haveExtras()

static bool MSRoutingEngine::haveExtras ( )
inlinestatic

Definition at line 101 of file MSRoutingEngine.h.

References myHaveExtras.

Referenced by MSNet::getTravelTime().

Here is the caller graph for this function:

◆ initCCH()

void MSRoutingEngine::initCCH ( )
staticprivate

build the shared CCH + the live family with one metric per loaded type, publish initial metrics

Definition at line 348 of file MSRoutingEngine.cpp.

References buildCCHLive(), CCHMetricFamily< E, V, K >::customize(), MSNet::getInstance(), MSNet::getVehicleControl(), MSVehicleControl::getVType(), MSVehicleControl::hasVTypeDistribution(), MSVehicleControl::insertVTypeIDs(), MSVehicleType::isVehicleSpecific(), myCCHLive, CCHMetricFamily< E, V, K >::seedKey(), and STEPS2TIME.

Referenced by initRouter().

Here is the caller graph for this function:

◆ initEdgeWeights()

void MSRoutingEngine::initEdgeWeights ( SUMOVehicleClass  svc,
SUMOTime  lastAdaption = -1,
int  index = -1 
)
static

◆ initRouter()

◆ initWeightConstants()

void MSRoutingEngine::initWeightConstants ( const OptionsCont &  oc)
static

initialize constants for using myPriorityFactor

Definition at line 148 of file MSRoutingEngine.cpp.

References OptionsCont::getBool(), MSNet::getEdgeControl(), MSEdgeControl::getEdges(), OptionsCont::getFloat(), MSNet::getInstance(), gRoutingPreferences, gWeightsRandomFactor, MAX2(), MIN2(), myDynamicRandomness, myEdgePriorityRange, myHaveExtras, myMinEdgePriority, myPriorityFactor, TL, and WRITE_WARNING.

Referenced by NLBuilder::build().

Here is the caller graph for this function:

◆ initWeightUpdate()

◆ invalidateCCHEdge()

void MSRoutingEngine::invalidateCCHEdge ( const MSEdge *  e)
static

a runtime permission change (closure / re-opening) hit this edge: invalidate the graph's primed connection masks and both families' metrics (queries divert to the exact fallback until the families re-customize)

Definition at line 433 of file MSRoutingEngine.cpp.

References CCHMetricFamily< E, V, K >::flagPermissionsStale(), CCHGraph< E, V >::invalidateClassMasks(), CCHMetricFamily< E, V, K >::invalidateEdge(), myCCHFreeflow, myCCHGraph, and myCCHLive.

Referenced by MSEdge::rebuildAllowedLanes().

Here is the caller graph for this function:

◆ isEnabled()

static bool MSRoutingEngine::isEnabled ( )
inlinestatic

returns whether any routing actions take place

Definition at line 179 of file MSRoutingEngine.h.

References myAdaptationInterval, and myWithTaz.

Referenced by MSInsertionControl::determineCandidates(), and MSInsertionControl::emitVehicles().

Here is the caller graph for this function:

◆ loadCCHMetric()

void MSRoutingEngine::loadCCHMetric ( const SUMOSAXAttributes &  attrs)
static

Loads the arcs of a CCH metric that lag behind the speeds.

Definition at line 969 of file MSRoutingEngine.cpp.

References MSNet::getInstance(), SUMOSAXAttributes::getInt(), getLoadedCCH(), SUMOSAXAttributes::getOpt(), SUMOSAXAttributes::getString(), MSNet::getVehicleControl(), MSVehicleControl::getVType(), CCHMetricFamily< E, V, K >::loadMetric(), myCCHLive, SIMTIME, SUMO_ATTR_ARCS, SUMO_ATTR_INDEX, SUMO_ATTR_TYPE, and SUMO_ATTR_WEIGHTS.

Referenced by MSStateHandler::myStartElement().

Here is the caller graph for this function:

◆ loadState()

void MSRoutingEngine::loadState ( const SUMOSAXAttributes &  attrs)
static

◆ operator=()

MSRoutingEngine & MSRoutingEngine::operator= ( const MSRoutingEngine &  )
private

Invalidated assignment operator.

◆ patchSpeedForTurns()

double MSRoutingEngine::patchSpeedForTurns ( const MSEdge *  edge,
double  currSpeed 
)
staticprivate

Definition at line 509 of file MSRoutingEngine.cpp.

References DEBUG_COND, Named::getID(), MSEdge::getLength(), MSEdge::getViaSuccessors(), MSGlobals::gWeightsSeparateTurns, MAX2(), myAdaptationSteps, myAdaptationStepsIndex, myEdgeSpeeds, myEdgeTravelTimes, myPastEdgeSpeeds, SIMTIME, and STEPS2TIME.

Referenced by adaptEdgeEfforts().

Here is the caller graph for this function:

◆ reroute() [1/2]

void MSRoutingEngine::reroute ( MSTransportable &  t,
const SUMOTime  currentTime,
const std::string &  info,
const bool  onInit = false,
const bool  silent = false,
const Prohibitions &  prohibited = {} 
)
static

◆ reroute() [2/2]

void MSRoutingEngine::reroute ( SUMOVehicle &  vehicle,
const SUMOTime  currentTime,
const std::string &  info,
const bool  onInit = false,
const bool  silent = false,
const Prohibitions &  prohibited = {} 
)
static

initiate the rerouting, create router / thread pool on first use

Definition at line 675 of file MSRoutingEngine.cpp.

References MFXWorkerThread::Pool::add(), MSNet::getEdgeControl(), MSNet::getInstance(), SUMOTrafficObject::getVClass(), RouterProvider< E, L, N, V >::getVehicleRouter(), initRouter(), myRouterInitLock, myRouterProvider, myRouterReady, myWithTaz, SUMOVehicle::reroute(), and MFXWorkerThread::Pool::size().

Referenced by MSDevice_Routing::reroute(), MSTransportableDevice_Routing::reroute(), and MSRailSignal::LinkInfo::reroute().

Here is the caller graph for this function:

◆ saveState()

◆ setEdgeTravelTime()

void MSRoutingEngine::setEdgeTravelTime ( const MSEdge *const  edge,
const double  travelTime 
)
static

adapt the known travel time for an edge

Definition at line 746 of file MSRoutingEngine.cpp.

References MSEdge::getLength(), MSEdge::getNumericalID(), and myEdgeSpeeds.

Referenced by MSDevice_Routing::setParameter().

Here is the caller graph for this function:

◆ withTaz()

static bool MSRoutingEngine::withTaz ( )
inlinestatic

whether taz-routing is enabled

Definition at line 220 of file MSRoutingEngine.h.

References myWithTaz.

Referenced by MSDevice_Routing::notifyEnter().

Here is the caller graph for this function:

Field Documentation

◆ myAdaptationInterval

SUMOTime MSRoutingEngine::myAdaptationInterval = -1
staticprivate

At which time interval the edge weights get updated.

Definition at line 306 of file MSRoutingEngine.h.

Referenced by adaptEdgeEfforts(), cleanup(), initRouter(), initWeightUpdate(), and isEnabled().

◆ myAdaptationSteps

int MSRoutingEngine::myAdaptationSteps
staticprivate

The number of steps for averaging edge speeds (ring-buffer)

Definition at line 312 of file MSRoutingEngine.h.

Referenced by _initEdgeWeights(), adaptEdgeEfforts(), initEdgeWeights(), loadState(), patchSpeedForTurns(), and saveState().

◆ myAdaptationStepsIndex

int MSRoutingEngine::myAdaptationStepsIndex = 0
staticprivate

The current index in the pastEdgeSpeed ring-buffer.

Definition at line 315 of file MSRoutingEngine.h.

Referenced by adaptEdgeEfforts(), cleanup(), initEdgeWeights(), patchSpeedForTurns(), and saveState().

◆ myAdaptationWeight

double MSRoutingEngine::myAdaptationWeight
staticprivate

Information which weight prior edge efforts have.

Definition at line 303 of file MSRoutingEngine.h.

Referenced by adaptEdgeEfforts(), initEdgeWeights(), and initWeightUpdate().

◆ myBikeSpeeds

bool MSRoutingEngine::myBikeSpeeds
staticprivate

whether separate speeds for bicycles shall be tracked

Definition at line 334 of file MSRoutingEngine.h.

Referenced by adaptEdgeEfforts(), getEffortExtra(), hasBikeSpeeds(), initEdgeWeights(), initRouter(), loadState(), and saveState().

◆ myCachedRoutes

std::map< std::pair< const MSEdge *, const MSEdge * >, ConstMSRoutePtr > MSRoutingEngine::myCachedRoutes
staticprivate

The container of pre-calculated routes.

Definition at line 346 of file MSRoutingEngine.h.

Referenced by adaptEdgeEfforts(), cleanup(), and getCachedRoute().

◆ myCCHFreeflow

MSCCHMetricFamily * MSRoutingEngine::myCCHFreeflow = nullptr
staticprivate

the STATIC free-flow metric family behind MSNet's routers (TraCI / triggers / GUI, all main-thread); built on first query

Definition at line 379 of file MSRoutingEngine.h.

Referenced by cleanupCCH(), getFreeflowCCHMetric(), and invalidateCCHEdge().

◆ myCCHGraph

MSCCHGraph * MSRoutingEngine::myCCHGraph = nullptr
staticprivate

the immutable shared CCH topology (built once), or nullptr if inactive

Definition at line 368 of file MSRoutingEngine.h.

Referenced by buildCCHLive(), cleanupCCH(), ensureCCHGraph(), initRouter(), and invalidateCCHEdge().

◆ myCCHLive

MSCCHMetricFamily * MSRoutingEngine::myCCHLive = nullptr
staticprivate

the rerouting device's LIVE metric family over the adaptive speed tables (see utils/router/CCHMetricFamily.h): metrics are keyed by vehicle TYPE – mirroring duarouter's keying – and filled with an OWNED reference vehicle of the type, so the type's maximum speed, vClass speed limits, routing preferences, the bicycle speed table and one frozen weights.random-factor realization are exact per metric. nullptr until initCCH.

Definition at line 376 of file MSRoutingEngine.h.

Referenced by adaptEdgeEfforts(), buildCCHLive(), cleanupCCH(), getLoadedCCH(), getPublishedCCHMetric(), initCCH(), invalidateCCHEdge(), loadCCHMetric(), loadState(), and saveState().

◆ myDynamicRandomness

bool MSRoutingEngine::myDynamicRandomness
staticprivate

whether randomness varies over time

Definition at line 357 of file MSRoutingEngine.h.

Referenced by applyExtras(), and initWeightConstants().

◆ myEdgeBikeSpeeds

std::vector< double > MSRoutingEngine::myEdgeBikeSpeeds
staticprivate

◆ myEdgePriorityRange

double MSRoutingEngine::myEdgePriorityRange
staticprivate

the difference between maximum and minimum priority for all edges

Definition at line 354 of file MSRoutingEngine.h.

Referenced by applyExtras(), and initWeightConstants().

◆ myEdgeSpeeds

std::vector< double > MSRoutingEngine::myEdgeSpeeds
staticprivate

◆ myEdgeTravelTimes

std::vector< MSRoutingEngine::TimeAndCount > MSRoutingEngine::myEdgeTravelTimes
staticprivate

Sum of travel times experienced by equipped vehicles for each edge.

Definition at line 324 of file MSRoutingEngine.h.

Referenced by _initEdgeWeights(), addEdgeTravelTime(), cleanup(), and patchSpeedForTurns().

◆ myEdgeWeightSettingCommand

Command * MSRoutingEngine::myEdgeWeightSettingCommand = nullptr
staticprivate

The weights adaptation/overwriting command.

Definition at line 300 of file MSRoutingEngine.h.

Referenced by hasEdgeUpdates(), and initWeightUpdate().

◆ myEffortFunc

SUMOAbstractRouter< MSEdge, SUMOVehicle >::Operation MSRoutingEngine::myEffortFunc = &MSRoutingEngine::getEffort
static

◆ myHaveExtras

bool MSRoutingEngine::myHaveExtras
staticprivate

whether extra routing cost modifications are configured

Definition at line 360 of file MSRoutingEngine.h.

Referenced by getLoadedCCH(), haveExtras(), initRouter(), and initWeightConstants().

◆ myLastAdaptation

SUMOTime MSRoutingEngine::myLastAdaptation = -1
staticprivate

Information when the last edge weight adaptation occurred.

Definition at line 309 of file MSRoutingEngine.h.

Referenced by _initEdgeWeights(), adaptEdgeEfforts(), getLastAdaptation(), initEdgeWeights(), initWeightUpdate(), and saveState().

◆ myMinEdgePriority

double MSRoutingEngine::myMinEdgePriority
staticprivate

Minimum priority for all edges.

Definition at line 352 of file MSRoutingEngine.h.

Referenced by applyExtras(), and initWeightConstants().

◆ myPastEdgeBikeSpeeds

std::vector< std::vector< double > > MSRoutingEngine::myPastEdgeBikeSpeeds
staticprivate

Definition at line 328 of file MSRoutingEngine.h.

Referenced by adaptEdgeEfforts(), cleanup(), initEdgeWeights(), loadState(), and saveState().

◆ myPastEdgeSpeeds

std::vector< std::vector< double > > MSRoutingEngine::myPastEdgeSpeeds
staticprivate

The container of past edge speeds (when using a simple moving average)

Definition at line 327 of file MSRoutingEngine.h.

Referenced by adaptEdgeEfforts(), cleanup(), initEdgeWeights(), loadState(), patchSpeedForTurns(), and saveState().

◆ myPriorityFactor

double MSRoutingEngine::myPriorityFactor
staticprivate

Coefficient for factoring edge priority into routing weight.

Definition at line 349 of file MSRoutingEngine.h.

Referenced by applyExtras(), and initWeightConstants().

◆ myRouterInitLock

std::mutex MSRoutingEngine::myRouterInitLock
staticprivate

serialises building the routers when the first queries come from several threads

Definition at line 343 of file MSRoutingEngine.h.

Referenced by getIntermodalRouterTT(), getRouterTT(), and reroute().

◆ myRouterProvider

MSRouterProvider * MSRoutingEngine::myRouterProvider = nullptr
staticprivate

The router to use.

Definition at line 337 of file MSRoutingEngine.h.

Referenced by cleanup(), getIntermodalRouterTT(), getRouterTT(), initRouter(), and reroute().

◆ myRouterReady

std::atomic< bool > MSRoutingEngine::myRouterReady
staticprivate

whether the routers of all threads are built

Definition at line 340 of file MSRoutingEngine.h.

Referenced by cleanup(), getIntermodalRouterTT(), getRouterTT(), and reroute().

◆ myWithTaz

bool MSRoutingEngine::myWithTaz
staticprivate

whether taz shall be used at initial rerouting

Definition at line 331 of file MSRoutingEngine.h.

Referenced by initWeightUpdate(), isEnabled(), reroute(), reroute(), and withTaz().


The documentation for this class was generated from the following files: