pub struct PredictiveParking { /* private fields */ }Expand description
Predictive parking: park idle elevators near stops with the highest recent per-stop arrival rate.
Reads the ArrivalLog and CurrentTick world resources
(always present under a built sim) to compute a rolling window of
arrivals. Cars are greedily assigned to the highest-rate stops that
don’t already have a car nearby, so the group spreads across the
hottest floors rather than clustering on one.
Parallels the headline feature of Otis Compass Infinity — forecast demand from recent traffic, pre-position cars accordingly. Falls back to no-op when no arrivals have been logged.
Implementations§
Source§impl PredictiveParking
impl PredictiveParking
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Create with the default rolling window
(DEFAULT_ARRIVAL_WINDOW_TICKS).
Sourcepub const fn with_window_ticks(window_ticks: u64) -> Self
pub const fn with_window_ticks(window_ticks: u64) -> Self
Create with a custom rolling window (ticks). Shorter windows react faster to traffic shifts; longer windows smooth out noise.
§Panics
Panics on window_ticks == 0. A zero window would cause
ArrivalLog::arrivals_in_window to return 0 for every stop —
the strategy would silently no-op, which is almost never what
the caller meant.
Trait Implementations§
Source§impl Default for PredictiveParking
impl Default for PredictiveParking
Source§impl RepositionStrategy for PredictiveParking
impl RepositionStrategy for PredictiveParking
Source§fn reposition(
&mut self,
idle_elevators: &[(EntityId, f64)],
stop_positions: &[(EntityId, f64)],
group: &ElevatorGroup,
world: &World,
out: &mut Vec<(EntityId, EntityId)>,
)
fn reposition( &mut self, idle_elevators: &[(EntityId, f64)], stop_positions: &[(EntityId, f64)], group: &ElevatorGroup, world: &World, out: &mut Vec<(EntityId, EntityId)>, )
Source§fn builtin_id(&self) -> Option<BuiltinReposition>
fn builtin_id(&self) -> Option<BuiltinReposition>
Simulation::set_reposition
callers don’t have to pass a separate BuiltinReposition id
that might drift from the dispatcher’s actual type. Read moreSource§fn min_arrival_log_window(&self) -> u64
fn min_arrival_log_window(&self) -> u64
ArrivalLog retention
(in ticks) the strategy needs to function. Strategies that read
the log directly with a custom rolling window must override this
so Simulation::set_reposition
can widen
ArrivalLogRetention
to keep the data alive long enough for the query. Read more