Wholesale Warehouse is a great example of one way to schedule tasks in a HASH simulation.
The model consists of a warehouse building layout containing different types of workers and multiple loading/unloading zones. Each zone and worker type is represented by a different color. Pallets arrive at the warehouse by trucks, where they are unloaded to the Reception zone. Depending on the type, workers handle, register, and then move the pallets to storage to await an order request. Once an order has been received, a pallet is removed from storage to the Dispatch zone before being loaded onto a truck for delivery.
Worker assignments are handled in this simulation by a manager. Since the pallet has a fairly linear travel through the warehouse, the manager agent has a list of worker types and delivery keys in order of the pallets’ progression. The manager uses these lists to access different worker and plan combinations to determine who should move the pallet and to which location.
const types = ["unloader", "transfer", "acceptor", "placement", "control", "loader"]; const delivery_keys = ["ATPICK", "UDROP", "ADROP", "TDROP", "STORAGE", "SDROP", "CDROP", "LDROP", "DTDROP"];
Arrival Truck Pickup (ATPICK) → Unloader Drop-off (UDROP) → Acceptor Drop-off (ADROP) → …… → Delivery Truck Drop-off (DTDROP)
Also stored within the manager agent is a dictionary of worker types. Each entry contains a list of available workers (those without a current task), a task queue, and a list of task positions (pickup/drop-off locations). Since workers may have one or more jobs within the warehouse, the task positions are stored in ‘plan’ keys. A ‘placement’ worker, for example, can either execute plan ‘a’ (delivery to storage) or plan ‘b’ (pickup from storage) depending on the task requested.
Once the manager receives a delivery message from a truck or worker agent, it finds the task key index in the list of delivery keys and increments it by 1 to get the next step in the process. If the pallet reaches the end of the order process, then a delivery truck is notified instead of incrementing. Once the next step is determined, a task is created containing information from the worker and plan combination needed to get the job done. The task is then added to the worker type’s task queue before being assigned to an available worker agent.
To avoid collisions and delivery to the same position for a worker type, delivery/pickup locations are popped off the front of the worker type’s position lists when assigning tasks and then added back in at the end of the time step. This ensures that workers deliver to all delivery positions before returning back to the first location.