pub struct AdaptiveParking { /* private fields */ }Expand description
Mode-gated reposition: dispatches to an inner strategy chosen
by the current TrafficMode.
Closes the playground-reported “chaotic repositioning” complaint:
the single-strategy defaults either lock cars to the lobby
(ReturnToLobby) or shuttle them toward the hottest stop
(PredictiveParking) regardless of traffic shape. Adaptive
picks per mode:
| Mode | Inner |
|---|---|
UpPeak | ReturnToLobby |
InterFloor | PredictiveParking |
DownPeak | PredictiveParking (today) |
Idle | no-op (stay put) |
The DownPeak row uses PredictiveParking for now — it’ll
become a dedicated upper-floor-biased variant once
TrafficDetector emits DownPeak (needs the destination-log
that today’s ArrivalLog doesn’t carry). Falls back to a
PredictiveParking-like default if the detector is missing
from World (e.g. hand-built tests bypassing Simulation).
Implementations§
Source§impl AdaptiveParking
impl AdaptiveParking
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Create with defaults: ReturnToLobby::new() (home = stop 0)
and PredictiveParking::new() (default rolling window).
Sourcepub const fn with_home(self, index: usize) -> Self
pub const fn with_home(self, index: usize) -> Self
Override the home stop used during UpPeak. Same semantics as
ReturnToLobby::with_home.
Sourcepub const fn with_window_ticks(self, window_ticks: u64) -> Self
pub const fn with_window_ticks(self, window_ticks: u64) -> Self
Override the window used for InterFloor / DownPeak
predictive parking. Same semantics as
PredictiveParking::with_window_ticks.
§Panics
Panics on window_ticks = 0, matching PredictiveParking.