FeasibleAssignments

The vehicle-to-task matchings available at this instant, as something a policy can enumerate and search rather than a predicate it applies after guessing.

The distinction is not cosmetic. A rule like "send the nearest vehicle" only ever needs to score the candidates it thought of; a policy that scores every available action and takes the best needs the action set itself to be an object it can walk. That is the shape a cost-function or value-function policy has, and it is the shape a decision epoch has in the sequential decision-making sense — state in, feasible actions enumerated, one chosen. Providing it here is what keeps a dispatcher's wake adoptable as a decision epoch later without the interface changing.

Feasibility is reachability, and nothing more. A pairing is feasible when the vehicle can get to the task's pickup along the guide path. Everything else a modeller might mean by "feasible" — enough charge, the right attachment, a shift that has begun — belongs to a bidding rule or a scoring function, because those are judgements about desirability that vary by model, while reachability is a fact about the space that does not.

Cheap to construct and lazily evaluated: candidates is a sequence, so a policy that wants the first acceptable pairing does not pay for the rest. Distances are computed on demand rather than precomputed, since a policy scoring by something other than distance should not pay for a matrix it never reads.

Properties

Link copied to clipboard

The vehicles under consideration, in the order they declared availability.

Link copied to clipboard

True when no pairing is available at all -- every vehicle unable to reach every task, or either side empty. A policy should check this before searching rather than after.

Link copied to clipboard

The tasks under consideration, in the order the selection rule chose.

Link copied to clipboard
val size: Int

How many vehicle-to-task pairings are available. Counts feasibility, so it is not simply the product of the two list sizes.

Functions

Link copied to clipboard

The best candidate by a score of the policy's choosing, lower being better, or null when nothing is feasible.

Link copied to clipboard

Every feasible pairing, tasks in selection-rule order and vehicles in declaration order within each task, so a policy that breaks ties by taking the first gets a reproducible answer.

Link copied to clipboard

Every vehicle that could take this task.

Every task this vehicle could take.

Link copied to clipboard
fun cost(vehicle: FleetVehicle, task: Dispatcher.Task): Double

Distance from where the vehicle stands to the task's pickup, along the guide path, or Double.POSITIVE_INFINITY when it cannot get there.

Link copied to clipboard

True when the vehicle can reach the task's pickup and has room for the load.

Link copied to clipboard
open override fun toString(): String