pub trait RepositionStrategy: Send + Sync {
// Required method
fn reposition(
&mut self,
idle_elevators: &[(EntityId, f64)],
stop_positions: &[(EntityId, f64)],
group: &ElevatorGroup,
world: &World,
out: &mut Vec<(EntityId, EntityId)>,
);
// Provided method
fn builtin_id(&self) -> Option<BuiltinReposition> { ... }
}Expand description
Pluggable strategy for repositioning idle elevators.
After the dispatch phase, elevators that remain idle (no pending assignments) are candidates for repositioning. The strategy decides where each idle elevator should move to improve coverage and reduce expected response times.
Implementations receive the set of idle elevator positions and the
group’s stop positions, then return a target stop for each elevator
(or None to leave it in place).
Required Methods§
Sourcefn 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)>, )
Decide where to reposition idle elevators.
Push (elevator_entity, target_stop_entity) pairs into out.
The buffer is cleared before each call — implementations should
only push, never read prior contents. Elevators not pushed remain idle.
Provided Methods§
Sourcefn builtin_id(&self) -> Option<BuiltinReposition>
fn builtin_id(&self) -> Option<BuiltinReposition>
If this strategy is a known built-in variant, return it so
Simulation::set_reposition
callers don’t have to pass a separate BuiltinReposition id
that might drift from the dispatcher’s actual type.
Mirrors the pattern introduced for DispatchStrategy::builtin_id
in #410: the runtime impl identifies itself so the snapshot
identity always matches the executing behaviour, instead of
depending on the caller to keep two parameters consistent.
Default None — custom strategies should override to return
BuiltinReposition::Custom with a stable name for snapshot
fidelity.