Dispatcher
Decides which vehicle goes where, and owns the line of work waiting to be done.
The existence of this object is the design. Under the passive paradigm the equivalent decision is made inside a pool's allocation rule, at the moment an entity happens to ask, over whichever vehicles happen to be free -- which makes batching, look-ahead and auctions inexpressible, not because they are hard but because there is nowhere to put them. Here the decision has a home, a process of its own, and the ability to consume simulated time while deciding.
It owns the TaskQ rather than delegating it to the system or accepting one from the modeller, because that queue is not a holding pen the subsystem happens to need. It is this object's pending-work list: the collection its policy ranks, a batching policy batches, and an auction announces from. A queue supplied from outside would force the dispatcher to reach into a foreign object to do its one job.
Constructors
Types
Properties
Substitutable while the model is not running.
The assignment policy by name, so a scenario or an app can change it without holding a policy object.
The waiting line, and the only queue this subsystem reports.
Orders what a policy sees. Null means the queue discipline alone decides.
The order a vehicle visits the stops it has committed to. Substitutable while not running.
Functions
Between replications the board and the available set are emptied. The queue itself is cleared by Queue.afterReplication; this drops the references that outlive it.
The live assignment for a task, or null when nobody is committed to it.
Abandons a task a vehicle raised for itself.
Tells vehicle what to do about the next stop it asks about.
Asks the fleet to run one cycle of a line.
Asks the fleet to send some vehicle somewhere, for its own reasons rather than to carry anything.
Asks the dispatcher to look at the board again.
Takes a task back from a vehicle that has not yet collected its load, and gives the vehicle something else to do.