postService

fun postService(destination: String, kind: ServiceKind = ServiceKind.Reposition, priority: Int = 1): Dispatcher.ServiceTask(source)

Asks the fleet to send some vehicle somewhere, for its own reasons rather than to carry anything.

The errand goes on the same board as transport requests and is decided by the same policy, so it competes with them and is subject to the same selection rule. That is the point: "go and fetch an empty pallet from the yard" is work the fleet does, and a model in which it did not compete for vehicles would understate what the fleet is being asked to do.

Any available vehicle may take it, which is what distinguishes an errand from the things that look like errands and are not. Charging is not one: no other vehicle can charge this one, so it is a ksl.modeling.fleet.policies.Disposition. Repair is not one either, for the same reason — it is an InterruptionPolicyIfc. If only one particular vehicle can do it, it does not belong here.

Nothing is suspended on it, and three consequences follow from that alone:

  • It may be cancelled, unlike a transport request. "You were going to park, but work has arrived" is a real thing to want and is safe, because cancelling strands nobody.

  • The vehicle stays re-taskable for the whole errand, not merely until it arrives. There is no load to take possession of, so nothing makes the assignment irrevocable.

  • It contributes nothing to waitForAssignment, which decomposes what a load waited for.

What it does count towards. The dispatcher's NumTasksPosted and NumTasksCompleted, and the carrying vehicle's own NumTasksCompleted — so an errand is a duty cycle like any other, which is what a rule such as LeastUsedVehiclePolicy and a FailureBasis.TASKS_COMPLETED failure model should both see.

It shares the reported waiting line, and that is worth knowing before you use it. A11 says TaskQ's time in queue is the wait for transport, which holds exactly while every task in it is a transport request. Post errands and the row becomes the wait for any work the fleet was asked to do. That is the honest reading of one queue serving one fleet, and the alternative — a second queue — would give a policy two boards to allocate over and this subsystem two waiting lines to explain. NumTasksPosted against the deliveries a model counts for itself is how to see the mix.

Return

the posted task, which may be passed to cancel

Parameters

destination

where the vehicle is to end up. Checked against the network now.

kind

what the errand is. ServiceKind.Reposition is the one implemented.

priority

the task's queue priority, for a ranked selection rule.