pub fn pair_is_useful(ctx: &RankContext<'_>, respect_aboard_path: bool) -> boolExpand description
Whether assigning ctx.car to ctx.stop is worth ranking.
Combines two checks every dispatch strategy needs at the top of its
rank implementation:
- Servability — capacity, full-load bypass, and the loading-phase boarding filter. A pair that can’t exit an aboard rider, board a waiter, or answer a rider-less hall call is a no-op move (and a zero-cost one when the car is already parked there) which would otherwise stall doors against unservable demand.
- Path discipline (only when
respect_aboard_pathistrue) — refuses pickups that would pull a car carrying routed riders off the direct path to every aboard rider’s destination. Without it, a stream of closer-destination hall calls can indefinitely preempt a farther aboard rider’s delivery (the “never reaches the passenger’s desired stop” loop).
Strategies with their own direction discipline (SCAN, LOOK, ETD,
Destination) pass respect_aboard_path: false because their
sweep/direction terms already rule out backtracks. Strategies without
it (NearestCar, RSR) pass respect_aboard_path: true. Custom
strategies should pass true unless they enforce direction
discipline themselves.
Aboard riders without a published route (game-managed manual riders)
don’t constrain the path — any pickup is trivially on-the-way for
them, so the path check trivially passes when no aboard rider has a
Route::current_destination.