Expand description
Pluggable dispatch strategies (SCAN, LOOK, nearest-car, ETD). Pluggable dispatch strategies for assigning elevators to stops.
§Example: custom dispatch strategy
use elevator_core::prelude::*;
use elevator_core::dispatch::{
DispatchDecision, DispatchManifest, ElevatorGroup,
};
struct AlwaysFirstStop;
impl DispatchStrategy for AlwaysFirstStop {
fn decide(
&mut self,
_elevator: EntityId,
_elevator_position: f64,
group: &ElevatorGroup,
_manifest: &DispatchManifest,
_world: &elevator_core::world::World,
) -> DispatchDecision {
group.stop_entities().first()
.map(|&stop| DispatchDecision::GoToStop(stop))
.unwrap_or(DispatchDecision::Idle)
}
}
let sim = SimulationBuilder::demo()
.dispatch(AlwaysFirstStop)
.build()
.unwrap();Re-exports§
pub use etd::EtdDispatch;pub use look::LookDispatch;pub use nearest_car::NearestCarDispatch;pub use scan::ScanDispatch;
Modules§
- etd
- Estimated Time to Destination dispatch algorithm. Estimated Time to Destination (ETD) dispatch algorithm.
- look
- LOOK dispatch algorithm. LOOK dispatch algorithm — reverses at the last request, not the shaft end.
- nearest_
car - Nearest-car dispatch algorithm. Nearest-car dispatch — assigns each call to the closest idle elevator.
- reposition
- Built-in repositioning strategies. Built-in repositioning strategies for idle elevators.
- scan
- SCAN dispatch algorithm. SCAN (elevator) dispatch algorithm — sweeps end-to-end before reversing.
Structs§
- Dispatch
Manifest - Full demand picture for dispatch decisions.
- Elevator
Group - Runtime elevator group: a set of lines sharing a dispatch strategy.
- Line
Info - Per-line relationship data within an
ElevatorGroup. - Rider
Info - Metadata about a single rider, available to dispatch strategies.
Enums§
- Builtin
Reposition - Serializable identifier for built-in repositioning strategies.
- Builtin
Strategy - Serializable identifier for built-in dispatch strategies.
- Dispatch
Decision - Decision returned by a dispatch strategy.
Traits§
- Dispatch
Strategy - Pluggable dispatch algorithm.
- Reposition
Strategy - Pluggable strategy for repositioning idle elevators.