![]() |
Eclipse SUMO - Simulation of Urban MObility
|
per-vehicle-type CCH metric store over a shared CCHGraph More...
#include <CCHMetricFamily.h>
Data Structures | |
| struct | LiveMetric |
| per-type LIVE metric state. Heap-owned: the atomic makes it non-movable, so it cannot live in a map by value. More... | |
| struct | StaticMetric |
| per-(type, period) STATIC metric state. RoutingKit metrics BORROW their input-weight buffer, so buffer and metric live together in the map (std::map nodes are address-stable). More... | |
Public Types | |
| typedef Graph::EffortOperation | EffortOperation |
| typedef CCHGraph< E, V > | Graph |
| typedef const RoutingKit::CustomizableContractionHierarchyMetric * | MetricPtr |
| typedef V *(* | RefVehicleFactory) (const K *, int) |
| builds an OWNED effort-reference vehicle for a type: never registered, counted or inserted – it exists only so every fill of that type's metric evaluates the same reference (deterministic speed factor and frozen random realization are the factory's business). The second argument is the ensemble slot (see the LIVE constructor); slot 0 must reproduce the pre-ensemble reference exactly, further slots give distinct frozen weights.random-factor realizations (typically by varying the reference vehicle's id, which seeds them) | |
| typedef void(* | WeightPatch) (const Graph *, const V *, std::vector< unsigned > &) |
| post-fill hook on the input weights (STATIC mode), e.g. duarouter masking the edges that restrict a type to inf_weight | |
Public Member Functions | |
| CCHMetricFamily (const Graph *graph, EffortOperation fillEffort, EffortOperation gateEffort, double updateFactor, double updateConstant, RefVehicleFactory factory, int ensembleK=1) | |
| construct a LIVE family (double-buffered, barrier-customized) | |
| CCHMetricFamily (const Graph *graph, EffortOperation fillEffort, SUMOTime begin, SUMOTime weightPeriod, RefVehicleFactory factory, WeightPatch patch) | |
| construct a STATIC family (lazy build per (type, period)) | |
| ~CCHMetricFamily () | |
STATIC mode | |
| MetricPtr | get (const K *key, SUMOVehicleClass vClass, SUMOTime time, const V *veh) |
the metric for (type key, period of time), built on the first query of the pair; nullptr before init. Thread-safe: the mutex serialises concurrent first queries from parallel routing threads (satisfying primeClassMask's synchronization contract); afterwards the map is read-only for that key (map references are address-stable). A pending flagStale() first refills and re-customizes every cached metric from the live efforts and permissions – in place, so the flagging host guarantees that no query is in flight (the simulation's main thread, marouter's reset between two iterations). | |
| SUMOTime | periodEnd (SUMOTime time) const |
| the end of the weight period containing the given time (SUMOTime_MAX when the weights are static); CCHRouter's PeriodEnd hook | |
| void | flagStale () |
| the efforts behind the cached metrics changed – a runtime permission change in the simulation (the caller must also invalidate the graph's class masks), or marouter's travel times after an assignment iteration (CCHRouter::reset): every cached metric is refilled and re-customized on the next get(). | |
| void | flagPermissionsStale () |
| flagStale() under the simulation's name for the permission case | |
LIVE mode | |
| void | seedKey (const K *key) |
| allocate the metric state (all ensemble slots) for one type; call only while no query is in flight (seeding at init, or the customization barrier) | |
| void | markDirty (const E *e) |
| queue an edge whose gate effort changed (the deadband applies later, at the customize barrier) | |
| void | invalidateEdge (const E *e) |
| a runtime permission change (closure / re-opening) hit this edge: queue it bypassing the deadband and divert every query to the exact fallback until customize() has refilled both buffers wholesale (the sparse path cannot repair tail-side arcs of a connection-level change). The caller must also invalidate the graph's class masks. | |
| void | atBarrier (double now, bool effortsMoved) |
| the owner's customization barrier: bump the speed epoch when an effort moved and re-customize when it matters. Lazy, following the CH weightPeriod pattern: metric state is only built for types somebody routes on (myLiveMetrics stays empty in a run that never routes, which then pays nothing here). Once any metric exists, every barrier where an effort moved re-customizes, so a query never sees a metric more than one barrier old – CH's weightPeriod bound. The queried flag only bootstraps type creation; a pending permission flip forces the customize even without queries. | |
| void | customize (double now) |
| refill + customize + publish every type's metric from the live efforts and permissions. Call only while no query is in flight (the publish itself is lock-free: release store here, acquire loads on the query hot path). | |
| MetricPtr | published (const K *key, const std::string &vehID) |
| the published metric for a type key and querying vehicle id (the id picks the ensemble slot – see the LIVE constructor), or nullptr if the query must route on the exact fallback. Query hot path, any thread. | |
| bool | empty () const |
| whether any type has live metric state yet | |
| bool | hasDeadband () const |
| whether the deadband can keep the metrics behind the efforts (then its state and the lagging arcs belong to the simulation state) | |
| double | getAppliedEffort (const E *e) const |
| the gate effort the edge was last applied with (NaN = never) | |
| bool | isPending (const E *e) const |
| whether the edge waits for the deadband | |
| void | loadEdge (const E *e, double appliedEffort, bool pending) |
| restore the deadband state of an edge (state loading) | |
| std::vector< const K * > | getKeys () const |
| the type keys with metric state | |
| int | getEnsembleSize () const |
| the number of metrics per type | |
| void | getLaggingArcs (const K *key, int slot, double now, std::vector< int > &arcs, std::vector< int > &weights) const |
the arcs of the published metric of a type and ensemble slot whose weight differs from a fresh fill at now | |
| void | loadMetric (const K *key, int slot, double now, const std::vector< int > &arcs, const std::vector< int > &weights) |
publish the metric of a type and ensemble slot as a fresh fill at now with the given arcs overwritten (state loading); the other buffer is dropped, so the next customize copies this one | |
Private Member Functions | |
| LiveMetric * | buildLiveMetric (const K *key, int slot) |
| allocate LIVE metric state for one (type, ensemble slot) (owner's thread only) | |
| CCHMetricFamily (const CCHMetricFamily &)=delete | |
| void | fillStatic (StaticMetric &sm, int period, SUMOTime time, const V *ref, const V *veh) |
| (re)fill a STATIC metric's input weights from the live efforts. A weight-period grid evaluates at the period's begin, so each pair is customized once per fill; a single period evaluates at the query time – free-flow efforts are time-invariant anyway, and marouter's per-iteration travel times are exactly what a Dijkstra query at that time sees. The patch runs once, on the first fill, and what it wrote is re-applied on every refill: the masked set depends only on the metric's type, whereas the vehicle triggering a refill may be of another type. | |
| CCHMetricFamily & | operator= (const CCHMetricFamily &)=delete |
| int | periodOf (SUMOTime time) const |
the weight period containing time: 0 is everything before begin and the whole run when the weights are static | |
Static Private Member Functions | |
| static uint64_t | fnv1a (const std::string &s) |
| stable 64-bit FNV-1a for the ensemble slot assignment | |
Private Attributes | |
| RefVehicleFactory | myFactory |
| reference-vehicle factory (required LIVE, optional STATIC) | |
| EffortOperation | myFillEffort |
| the effort the metrics are filled from | |
| EffortOperation | myGateEffort |
| the type-independent effort of the LIVE deadband | |
| const Graph * | myGraph |
| the immutable shared topology | |
| const bool | myLive |
| LIVE or STATIC (fixed at construction) | |
| WeightPatch | myPatch |
| post-fill weight hook (STATIC) | |
STATIC state | |
| SUMOTime | myBegin |
| SUMOTime | myWeightPeriod |
| std::map< std::pair< const K *, int >, StaticMetric > | myStaticMetrics |
| std::mutex | myStaticLock |
| bool | myStale = false |
| the efforts changed behind the cached metrics: refill and re-customize them all on the next get() (see flagStale) | |
LIVE state | |
the deadband bounds (see the LIVE constructor) | |
| double | myUpdateFactor |
| double | myUpdateConstant |
| int | myEnsembleK = 1 |
| frozen random-factor realizations per type (see the LIVE ctor) | |
| std::vector< LiveMetric * > | myLiveMetrics |
| every type's state, in creation order (barrier iteration) and by key (query lookup; only mutated while no query is in flight) | |
| std::map< const K *, std::vector< LiveMetric * > > | myByKey |
| std::vector< const K * > | myWantedKeys |
| types that queried but have no metric yet (demand streams, so types can appear after seeding); queries register them under the lock and route via the fallback until the next barrier builds their state | |
| std::mutex | myWantedLock |
| std::atomic< bool > | myQueried {false} |
| whether a query arrived since the last barrier (bootstraps type creation and re-arms after resets – see atBarrier) | |
| std::atomic< bool > | myMetricStale {false} |
| a permission flip has not yet been customized into the published metrics (queries divert to the exact fallback while set) | |
| std::atomic< uint64_t > | mySpeedEpoch {0} |
| barrier counter of the tracked efforts and the counter value the published metrics were customized from: the staleness bound's safety invariant (see atBarrier / published). Both only change on the owner's thread at the barrier – no query is in flight there – the atomics just publish the values to the query threads. | |
| std::atomic< uint64_t > | myPublishedEpoch {0} |
| int | myFullFillsPending = 0 |
| how many customize passes must replace a whole buffer after a permission flip: 2 = refill one, then copy it (the sparse path cannot repair connection-level mask changes: arcsOfEdge deliberately omits the tail side) | |
| std::vector< double > | myAppliedEffort |
| edge state for the sparse path, shared by both buffers: the gate effort each edge's arcs were last filled from (NaN = never applied / forced), the pending-dirty flag, the pending list and the edges the last customize applied (the other buffer copies their arcs) | |
| std::vector< char > | myPendingFlag |
| std::vector< const E * > | myPendingList |
| std::vector< const E * > | myLastAccepted |
per-vehicle-type CCH metric store over a shared CCHGraph
| E | the edge type (MSEdge / ROEdge) |
| V | the vehicle type of the effort callback (SUMOVehicle / ROVehicle) |
| K | the vehicle-type key (MSVehicleType / SUMOVTypeParameter); used only as a stable map key, never dereferenced |
Definition at line 86 of file CCHMetricFamily.h.
| typedef Graph::EffortOperation CCHMetricFamily< E, V, K >::EffortOperation |
Definition at line 89 of file CCHMetricFamily.h.
Definition at line 88 of file CCHMetricFamily.h.
| typedef const RoutingKit::CustomizableContractionHierarchyMetric* CCHMetricFamily< E, V, K >::MetricPtr |
Definition at line 90 of file CCHMetricFamily.h.
| typedef V *(* CCHMetricFamily< E, V, K >::RefVehicleFactory) (const K *, int) |
builds an OWNED effort-reference vehicle for a type: never registered, counted or inserted – it exists only so every fill of that type's metric evaluates the same reference (deterministic speed factor and frozen random realization are the factory's business). The second argument is the ensemble slot (see the LIVE constructor); slot 0 must reproduce the pre-ensemble reference exactly, further slots give distinct frozen weights.random-factor realizations (typically by varying the reference vehicle's id, which seeds them)
Definition at line 99 of file CCHMetricFamily.h.
| typedef void(* CCHMetricFamily< E, V, K >::WeightPatch) (const Graph *, const V *, std::vector< unsigned > &) |
post-fill hook on the input weights (STATIC mode), e.g. duarouter masking the edges that restrict a type to inf_weight
Definition at line 102 of file CCHMetricFamily.h.
|
inline |
construct a STATIC family (lazy build per (type, period))
| [in] | graph | the shared topology |
| [in] | fillEffort | the effort the weights are computed from |
| [in] | begin | begin of the weight-period grid |
| [in] | weightPeriod | period length; SUMOTime_MAX = a single period |
| [in] | factory | reference-vehicle factory; nullptr = fill with the QUERYING vehicle (each pair is customized exactly once, so the first vehicle of a type is that type's reference – duarouter's contract) |
| [in] | patch | optional post-fill weight hook |
Definition at line 113 of file CCHMetricFamily.h.
|
inline |
construct a LIVE family (double-buffered, barrier-customized)
| [in] | graph | the shared topology |
| [in] | fillEffort | the (possibly per-type) effort the weights are computed from, evaluated with the type's reference vehicle |
| [in] | gateEffort | the type-INDEPENDENT effort used by the deadband (evaluated with a null vehicle: per-type extras are static multipliers that cancel out of the moved-or-not decision) |
| [in] | updateFactor | / updateConstant the deadband: an edge's arcs are only refilled when its gate effort moved by MORE than BOTH the relative factor AND the absolute constant (seconds) since it was last applied – the sufficientSaving() analog. The moving-average speed filter smears every traffic event into many ticks of sub-percent drift; without a deadband that drift marks thousands of arcs per barrier and partial re-customization degenerates (RoutingKit documents it for the sparse "new traffic jam" case). 1/0 = every change propagates. Rejected edges stay pending and their drift accumulates against the same applied value, so a slow trend eventually passes while filter jitter never does. |
| [in] | factory | reference-vehicle factory (required in LIVE mode) |
| [in] | ensembleK | how many frozen weights.random-factor realizations (= metrics) to keep per type. The exact routers draw a fresh perturbation per vehicle; a shared metric freezes ONE realization, losing the feature's route diversity. With K > 1 every type keeps K metrics – each filled with its own reference vehicle (factory slot k) and therefore its own frozen realization – and a vehicle is assigned its slot by a stable hash of its id, so each vehicle persistently routes on one of K perturbed networks: K = 1 is exactly the single-realization behavior, growing K converges toward the exact routers' per-vehicle diversity at K x customization and memory cost. Pointless without weights.random-factor (the K references fill identical weights). |
Definition at line 153 of file CCHMetricFamily.h.
References CCHGraph< E, V >::edgeIdSpace(), CCHMetricFamily< E, V, K >::myAppliedEffort, CCHMetricFamily< E, V, K >::myGraph, and CCHMetricFamily< E, V, K >::myPendingFlag.
|
inline |
Definition at line 169 of file CCHMetricFamily.h.
References CCHMetricFamily< E, V, K >::myLiveMetrics, and CCHMetricFamily< E, V, K >::myStaticMetrics.
|
privatedelete |
|
inline |
the owner's customization barrier: bump the speed epoch when an effort moved and re-customize when it matters. Lazy, following the CH weightPeriod pattern: metric state is only built for types somebody routes on (myLiveMetrics stays empty in a run that never routes, which then pays nothing here). Once any metric exists, every barrier where an effort moved re-customizes, so a query never sees a metric more than one barrier old – CH's weightPeriod bound. The queried flag only bootstraps type creation; a pending permission flip forces the customize even without queries.
Definition at line 301 of file CCHMetricFamily.h.
References CCHMetricFamily< E, V, K >::customize(), CCHMetricFamily< E, V, K >::myLiveMetrics, CCHMetricFamily< E, V, K >::myMetricStale, CCHMetricFamily< E, V, K >::myQueried, and CCHMetricFamily< E, V, K >::mySpeedEpoch.
Referenced by MSRoutingEngine::adaptEdgeEfforts().
|
inlineprivate |
allocate LIVE metric state for one (type, ensemble slot) (owner's thread only)
Definition at line 684 of file CCHMetricFamily.h.
References CCHGraph< E, V >::arcCount(), CCHGraph< E, V >::cch(), CCHMetricFamily< E, V, K >::myFactory, CCHMetricFamily< E, V, K >::myGraph, CCHMetricFamily< E, V, K >::myLiveMetrics, CCHMetricFamily< E, V, K >::LiveMetric::partial, CCHMetricFamily< E, V, K >::LiveMetric::refVehicle, CCHMetricFamily< E, V, K >::LiveMetric::vClass, and CCHMetricFamily< E, V, K >::LiveMetric::weight.
Referenced by CCHMetricFamily< E, V, K >::seedKey().
|
inline |
refill + customize + publish every type's metric from the live efforts and permissions. Call only while no query is in flight (the publish itself is lock-free: release store here, acquire loads on the query hot path).
Definition at line 316 of file CCHMetricFamily.h.
References CCHGraph< E, V >::arcsOfEdge(), CCHGraph< E, V >::cch(), CCHGraph< E, V >::computeArcWeight(), CCHGraph< E, V >::fillInputWeights(), K, MAX2(), MIN2(), CCHMetricFamily< E, V, K >::myAppliedEffort, CCHMetricFamily< E, V, K >::myFillEffort, CCHMetricFamily< E, V, K >::myFullFillsPending, CCHMetricFamily< E, V, K >::myGateEffort, CCHMetricFamily< E, V, K >::myGraph, CCHMetricFamily< E, V, K >::myLastAccepted, CCHMetricFamily< E, V, K >::myLiveMetrics, CCHMetricFamily< E, V, K >::myMetricStale, CCHMetricFamily< E, V, K >::myPendingFlag, CCHMetricFamily< E, V, K >::myPendingList, CCHMetricFamily< E, V, K >::myPublishedEpoch, CCHMetricFamily< E, V, K >::mySpeedEpoch, CCHMetricFamily< E, V, K >::myUpdateConstant, CCHMetricFamily< E, V, K >::myUpdateFactor, CCHMetricFamily< E, V, K >::myWantedKeys, CCHMetricFamily< E, V, K >::myWantedLock, and CCHMetricFamily< E, V, K >::seedKey().
Referenced by CCHMetricFamily< E, V, K >::atBarrier(), and MSRoutingEngine::initCCH().
whether any type has live metric state yet
Definition at line 517 of file CCHMetricFamily.h.
References CCHMetricFamily< E, V, K >::myLiveMetrics.
|
inlineprivate |
(re)fill a STATIC metric's input weights from the live efforts. A weight-period grid evaluates at the period's begin, so each pair is customized once per fill; a single period evaluates at the query time – free-flow efforts are time-invariant anyway, and marouter's per-iteration travel times are exactly what a Dijkstra query at that time sees. The patch runs once, on the first fill, and what it wrote is re-applied on every refill: the masked set depends only on the metric's type, whereas the vehicle triggering a refill may be of another type.
Definition at line 651 of file CCHMetricFamily.h.
References CCHMetricFamily< E, V, K >::StaticMetric::filled, CCHGraph< E, V >::fillInputWeights(), CCHMetricFamily< E, V, K >::myBegin, CCHMetricFamily< E, V, K >::myFillEffort, CCHMetricFamily< E, V, K >::myGraph, CCHMetricFamily< E, V, K >::myPatch, CCHMetricFamily< E, V, K >::myWeightPeriod, CCHMetricFamily< E, V, K >::StaticMetric::patched, STEPS2TIME, SUMOTime_MAX, CCHMetricFamily< E, V, K >::StaticMetric::vClass, and CCHMetricFamily< E, V, K >::StaticMetric::weights.
Referenced by CCHMetricFamily< E, V, K >::get().
|
inline |
flagStale() under the simulation's name for the permission case
Definition at line 241 of file CCHMetricFamily.h.
References CCHMetricFamily< E, V, K >::flagStale().
Referenced by MSRoutingEngine::invalidateCCHEdge().
the efforts behind the cached metrics changed – a runtime permission change in the simulation (the caller must also invalidate the graph's class masks), or marouter's travel times after an assignment iteration (CCHRouter::reset): every cached metric is refilled and re-customized on the next get().
Definition at line 235 of file CCHMetricFamily.h.
References CCHMetricFamily< E, V, K >::myStale, and CCHMetricFamily< E, V, K >::myStaticLock.
Referenced by CCHMetricFamily< E, V, K >::flagPermissionsStale(), and ROCCHMetrics::reset().
|
inlinestaticprivate |
stable 64-bit FNV-1a for the ensemble slot assignment
Definition at line 674 of file CCHMetricFamily.h.
Referenced by CCHMetricFamily< E, V, K >::published().
|
inline |
the metric for (type key, period of time), built on the first query of the pair; nullptr before init. Thread-safe: the mutex serialises concurrent first queries from parallel routing threads (satisfying primeClassMask's synchronization contract); afterwards the map is read-only for that key (map references are address-stable). A pending flagStale() first refills and re-customizes every cached metric from the live efforts and permissions – in place, so the flagging host guarantees that no query is in flight (the simulation's main thread, marouter's reset between two iterations).
Definition at line 191 of file CCHMetricFamily.h.
References CCHGraph< E, V >::cch(), CCHMetricFamily< E, V, K >::fillStatic(), CCHMetricFamily< E, V, K >::StaticMetric::metric, CCHMetricFamily< E, V, K >::myFactory, CCHMetricFamily< E, V, K >::myGraph, CCHMetricFamily< E, V, K >::myStale, CCHMetricFamily< E, V, K >::myStaticLock, CCHMetricFamily< E, V, K >::myStaticMetrics, CCHMetricFamily< E, V, K >::periodOf(), CCHMetricFamily< E, V, K >::StaticMetric::refVehicle, CCHMetricFamily< E, V, K >::StaticMetric::vClass, and CCHMetricFamily< E, V, K >::StaticMetric::weights.
Referenced by ROCCHMetrics::get(), and MSRoutingEngine::getFreeflowCCHMetric().
|
inline |
the gate effort the edge was last applied with (NaN = never)
Definition at line 528 of file CCHMetricFamily.h.
References CCHMetricFamily< E, V, K >::myAppliedEffort.
Referenced by MSRoutingEngine::saveState().
|
inline |
the number of metrics per type
Definition at line 555 of file CCHMetricFamily.h.
References CCHMetricFamily< E, V, K >::myEnsembleK.
Referenced by MSRoutingEngine::saveState().
|
inline |
the type keys with metric state
Definition at line 546 of file CCHMetricFamily.h.
References CCHMetricFamily< E, V, K >::myByKey.
Referenced by MSRoutingEngine::saveState().
|
inline |
the arcs of the published metric of a type and ensemble slot whose weight differs from a fresh fill at now
Definition at line 561 of file CCHMetricFamily.h.
References CCHGraph< E, V >::fillInputWeights(), CCHMetricFamily< E, V, K >::LiveMetric::frontIndex, CCHMetricFamily< E, V, K >::LiveMetric::metric, CCHMetricFamily< E, V, K >::myByKey, CCHMetricFamily< E, V, K >::myFillEffort, CCHMetricFamily< E, V, K >::myGraph, CCHMetricFamily< E, V, K >::LiveMetric::refVehicle, CCHMetricFamily< E, V, K >::LiveMetric::vClass, and CCHMetricFamily< E, V, K >::LiveMetric::weight.
Referenced by MSRoutingEngine::saveState().
|
inline |
whether the deadband can keep the metrics behind the efforts (then its state and the lagging arcs belong to the simulation state)
Definition at line 523 of file CCHMetricFamily.h.
References CCHMetricFamily< E, V, K >::myUpdateConstant, and CCHMetricFamily< E, V, K >::myUpdateFactor.
Referenced by MSRoutingEngine::saveState().
|
inline |
a runtime permission change (closure / re-opening) hit this edge: queue it bypassing the deadband and divert every query to the exact fallback until customize() has refilled both buffers wholesale (the sparse path cannot repair tail-side arcs of a connection-level change). The caller must also invalidate the graph's class masks.
Definition at line 279 of file CCHMetricFamily.h.
References CCHMetricFamily< E, V, K >::markDirty(), CCHMetricFamily< E, V, K >::myAppliedEffort, CCHMetricFamily< E, V, K >::myFullFillsPending, CCHMetricFamily< E, V, K >::myMetricStale, and CCHMetricFamily< E, V, K >::myPendingFlag.
Referenced by MSRoutingEngine::invalidateCCHEdge().
|
inline |
whether the edge waits for the deadband
Definition at line 533 of file CCHMetricFamily.h.
References CCHMetricFamily< E, V, K >::myPendingFlag.
Referenced by MSRoutingEngine::saveState().
|
inline |
restore the deadband state of an edge (state loading)
Definition at line 538 of file CCHMetricFamily.h.
References CCHMetricFamily< E, V, K >::markDirty(), and CCHMetricFamily< E, V, K >::myAppliedEffort.
Referenced by MSRoutingEngine::loadState().
|
inline |
publish the metric of a type and ensemble slot as a fresh fill at now with the given arcs overwritten (state loading); the other buffer is dropped, so the next customize copies this one
Definition at line 580 of file CCHMetricFamily.h.
References CCHGraph< E, V >::cch(), CCHGraph< E, V >::fillInputWeights(), CCHMetricFamily< E, V, K >::LiveMetric::front, CCHMetricFamily< E, V, K >::LiveMetric::frontIndex, CCHMetricFamily< E, V, K >::LiveMetric::metric, CCHMetricFamily< E, V, K >::myByKey, CCHMetricFamily< E, V, K >::myEnsembleK, CCHMetricFamily< E, V, K >::myFillEffort, CCHMetricFamily< E, V, K >::myGraph, CCHMetricFamily< E, V, K >::LiveMetric::refVehicle, CCHMetricFamily< E, V, K >::seedKey(), CCHMetricFamily< E, V, K >::LiveMetric::vClass, and CCHMetricFamily< E, V, K >::LiveMetric::weight.
Referenced by MSRoutingEngine::loadCCHMetric().
|
inline |
queue an edge whose gate effort changed (the deadband applies later, at the customize barrier)
Definition at line 263 of file CCHMetricFamily.h.
References CCHMetricFamily< E, V, K >::myPendingFlag, and CCHMetricFamily< E, V, K >::myPendingList.
Referenced by MSRoutingEngine::adaptEdgeEfforts(), CCHMetricFamily< E, V, K >::invalidateEdge(), and CCHMetricFamily< E, V, K >::loadEdge().
|
privatedelete |
|
inline |
the end of the weight period containing the given time (SUMOTime_MAX when the weights are static); CCHRouter's PeriodEnd hook
Definition at line 223 of file CCHMetricFamily.h.
References CCHMetricFamily< E, V, K >::myBegin, CCHMetricFamily< E, V, K >::myWeightPeriod, CCHMetricFamily< E, V, K >::periodOf(), and SUMOTime_MAX.
Referenced by ROCCHMetrics::periodEnd().
|
inlineprivate |
the weight period containing time: 0 is everything before begin and the whole run when the weights are static
Definition at line 635 of file CCHMetricFamily.h.
References CCHMetricFamily< E, V, K >::myBegin, CCHMetricFamily< E, V, K >::myWeightPeriod, and SUMOTime_MAX.
Referenced by CCHMetricFamily< E, V, K >::get(), and CCHMetricFamily< E, V, K >::periodEnd().
|
inline |
the published metric for a type key and querying vehicle id (the id picks the ensemble slot – see the LIVE constructor), or nullptr if the query must route on the exact fallback. Query hot path, any thread.
Definition at line 471 of file CCHMetricFamily.h.
References CCHMetricFamily< E, V, K >::fnv1a(), CCHMetricFamily< E, V, K >::LiveMetric::front, CCHMetricFamily< E, V, K >::myByKey, CCHMetricFamily< E, V, K >::myEnsembleK, CCHMetricFamily< E, V, K >::myMetricStale, CCHMetricFamily< E, V, K >::myPublishedEpoch, CCHMetricFamily< E, V, K >::myQueried, CCHMetricFamily< E, V, K >::mySpeedEpoch, CCHMetricFamily< E, V, K >::myWantedKeys, and CCHMetricFamily< E, V, K >::myWantedLock.
Referenced by MSRoutingEngine::getPublishedCCHMetric().
|
inline |
allocate the metric state (all ensemble slots) for one type; call only while no query is in flight (seeding at init, or the customization barrier)
Definition at line 252 of file CCHMetricFamily.h.
References CCHMetricFamily< E, V, K >::buildLiveMetric(), CCHMetricFamily< E, V, K >::myByKey, and CCHMetricFamily< E, V, K >::myEnsembleK.
Referenced by CCHMetricFamily< E, V, K >::customize(), MSRoutingEngine::initCCH(), and CCHMetricFamily< E, V, K >::loadMetric().
|
private |
edge state for the sparse path, shared by both buffers: the gate effort each edge's arcs were last filled from (NaN = never applied / forced), the pending-dirty flag, the pending list and the edges the last customize applied (the other buffer copies their arcs)
Definition at line 757 of file CCHMetricFamily.h.
Referenced by CCHMetricFamily< E, V, K >::CCHMetricFamily(), CCHMetricFamily< E, V, K >::customize(), CCHMetricFamily< E, V, K >::getAppliedEffort(), CCHMetricFamily< E, V, K >::invalidateEdge(), and CCHMetricFamily< E, V, K >::loadEdge().
Definition at line 710 of file CCHMetricFamily.h.
Referenced by CCHMetricFamily< E, V, K >::fillStatic(), CCHMetricFamily< E, V, K >::periodEnd(), and CCHMetricFamily< E, V, K >::periodOf().
|
private |
Definition at line 729 of file CCHMetricFamily.h.
Referenced by CCHMetricFamily< E, V, K >::getKeys(), CCHMetricFamily< E, V, K >::getLaggingArcs(), CCHMetricFamily< E, V, K >::loadMetric(), CCHMetricFamily< E, V, K >::published(), and CCHMetricFamily< E, V, K >::seedKey().
frozen random-factor realizations per type (see the LIVE ctor)
Definition at line 725 of file CCHMetricFamily.h.
Referenced by CCHMetricFamily< E, V, K >::getEnsembleSize(), CCHMetricFamily< E, V, K >::loadMetric(), CCHMetricFamily< E, V, K >::published(), and CCHMetricFamily< E, V, K >::seedKey().
|
private |
reference-vehicle factory (required LIVE, optional STATIC)
Definition at line 702 of file CCHMetricFamily.h.
Referenced by CCHMetricFamily< E, V, K >::buildLiveMetric(), and CCHMetricFamily< E, V, K >::get().
|
private |
the effort the metrics are filled from
Definition at line 698 of file CCHMetricFamily.h.
Referenced by CCHMetricFamily< E, V, K >::customize(), CCHMetricFamily< E, V, K >::fillStatic(), CCHMetricFamily< E, V, K >::getLaggingArcs(), and CCHMetricFamily< E, V, K >::loadMetric().
|
private |
how many customize passes must replace a whole buffer after a permission flip: 2 = refill one, then copy it (the sparse path cannot repair connection-level mask changes: arcsOfEdge deliberately omits the tail side)
Definition at line 752 of file CCHMetricFamily.h.
Referenced by CCHMetricFamily< E, V, K >::customize(), and CCHMetricFamily< E, V, K >::invalidateEdge().
|
private |
the type-independent effort of the LIVE deadband
Definition at line 700 of file CCHMetricFamily.h.
Referenced by CCHMetricFamily< E, V, K >::customize().
the immutable shared topology
Definition at line 696 of file CCHMetricFamily.h.
Referenced by CCHMetricFamily< E, V, K >::buildLiveMetric(), CCHMetricFamily< E, V, K >::CCHMetricFamily(), CCHMetricFamily< E, V, K >::customize(), CCHMetricFamily< E, V, K >::fillStatic(), CCHMetricFamily< E, V, K >::get(), CCHMetricFamily< E, V, K >::getLaggingArcs(), and CCHMetricFamily< E, V, K >::loadMetric().
|
private |
Definition at line 760 of file CCHMetricFamily.h.
Referenced by CCHMetricFamily< E, V, K >::customize().
LIVE or STATIC (fixed at construction)
Definition at line 706 of file CCHMetricFamily.h.
|
private |
every type's state, in creation order (barrier iteration) and by key (query lookup; only mutated while no query is in flight)
Definition at line 728 of file CCHMetricFamily.h.
Referenced by CCHMetricFamily< E, V, K >::atBarrier(), CCHMetricFamily< E, V, K >::buildLiveMetric(), CCHMetricFamily< E, V, K >::customize(), CCHMetricFamily< E, V, K >::empty(), and CCHMetricFamily< E, V, K >::~CCHMetricFamily().
|
private |
a permission flip has not yet been customized into the published metrics (queries divert to the exact fallback while set)
Definition at line 740 of file CCHMetricFamily.h.
Referenced by CCHMetricFamily< E, V, K >::atBarrier(), CCHMetricFamily< E, V, K >::customize(), CCHMetricFamily< E, V, K >::invalidateEdge(), and CCHMetricFamily< E, V, K >::published().
|
private |
post-fill weight hook (STATIC)
Definition at line 704 of file CCHMetricFamily.h.
Referenced by CCHMetricFamily< E, V, K >::fillStatic().
|
private |
Definition at line 758 of file CCHMetricFamily.h.
Referenced by CCHMetricFamily< E, V, K >::CCHMetricFamily(), CCHMetricFamily< E, V, K >::customize(), CCHMetricFamily< E, V, K >::invalidateEdge(), CCHMetricFamily< E, V, K >::isPending(), and CCHMetricFamily< E, V, K >::markDirty().
|
private |
Definition at line 759 of file CCHMetricFamily.h.
Referenced by CCHMetricFamily< E, V, K >::customize(), and CCHMetricFamily< E, V, K >::markDirty().
|
private |
Definition at line 747 of file CCHMetricFamily.h.
Referenced by CCHMetricFamily< E, V, K >::customize(), and CCHMetricFamily< E, V, K >::published().
|
private |
whether a query arrived since the last barrier (bootstraps type creation and re-arms after resets – see atBarrier)
Definition at line 737 of file CCHMetricFamily.h.
Referenced by CCHMetricFamily< E, V, K >::atBarrier(), and CCHMetricFamily< E, V, K >::published().
|
private |
barrier counter of the tracked efforts and the counter value the published metrics were customized from: the staleness bound's safety invariant (see atBarrier / published). Both only change on the owner's thread at the barrier – no query is in flight there – the atomics just publish the values to the query threads.
Definition at line 746 of file CCHMetricFamily.h.
Referenced by CCHMetricFamily< E, V, K >::atBarrier(), CCHMetricFamily< E, V, K >::customize(), and CCHMetricFamily< E, V, K >::published().
the efforts changed behind the cached metrics: refill and re-customize them all on the next get() (see flagStale)
Definition at line 716 of file CCHMetricFamily.h.
Referenced by CCHMetricFamily< E, V, K >::flagStale(), and CCHMetricFamily< E, V, K >::get().
Definition at line 713 of file CCHMetricFamily.h.
Referenced by CCHMetricFamily< E, V, K >::flagStale(), and CCHMetricFamily< E, V, K >::get().
|
private |
Definition at line 712 of file CCHMetricFamily.h.
Referenced by CCHMetricFamily< E, V, K >::get(), and CCHMetricFamily< E, V, K >::~CCHMetricFamily().
Definition at line 723 of file CCHMetricFamily.h.
Referenced by CCHMetricFamily< E, V, K >::customize(), and CCHMetricFamily< E, V, K >::hasDeadband().
Definition at line 722 of file CCHMetricFamily.h.
Referenced by CCHMetricFamily< E, V, K >::customize(), and CCHMetricFamily< E, V, K >::hasDeadband().
|
private |
types that queried but have no metric yet (demand streams, so types can appear after seeding); queries register them under the lock and route via the fallback until the next barrier builds their state
Definition at line 733 of file CCHMetricFamily.h.
Referenced by CCHMetricFamily< E, V, K >::customize(), and CCHMetricFamily< E, V, K >::published().
Definition at line 734 of file CCHMetricFamily.h.
Referenced by CCHMetricFamily< E, V, K >::customize(), and CCHMetricFamily< E, V, K >::published().
Definition at line 711 of file CCHMetricFamily.h.
Referenced by CCHMetricFamily< E, V, K >::fillStatic(), CCHMetricFamily< E, V, K >::periodEnd(), and CCHMetricFamily< E, V, K >::periodOf().