Task Scheduling
How MAFIS assigns tasks to agents in lifelong mode and what schedulers are available.
In lifelong MAPF, agents continuously receive new tasks after completing their current ones. The component that decides which goal to assign to which agent is the TaskScheduler.
Available Schedulers
Random
Picks a pickup or delivery cell uniformly at random. Serves as the baseline scheduler.
Closest-first
Two-phase batch assignment. Phase 1 creates random task candidates from all pickup cells. Phase 2 assigns each agent the nearest task from the pool via greedy matching. Preserves locality benefit without positional convergence.
Balanced
Assigns tasks to the least-recently-used cell, breaking ties by distance. Biases future assignments toward under-occupied regions.
Round-trip
Minimizes total round-trip distance. For pickups, selects the cell that minimizes dist(agent → pickup) + min(dist(pickup → any delivery cell)). For deliveries, selects the nearest delivery cell.
Task Model
Agents follow an 8-state task cycle using zones defined by the topology:
- Free → Scheduler assigns a pickup cell from the topology’s pickup zone
- TravelEmpty → Agent travels to pickup cell (no cargo)
- Loading → Agent loads cargo at pickup cell (1-tick minimum dwell)
- TravelToQueue → Agent travels to the back of a delivery queue line
- Queuing → Agent shuffles forward in queue (one slot per tick)
- TravelLoaded → Agent travels to delivery cell (promoted from queue front)
- Unloading → Agent unloads cargo at delivery cell
- Free → Task complete (throughput increments), cycle repeats
Each completed delivery = one throughput unit. If the topology has no queue lines, agents skip steps 4-5 and go directly from Loading to TravelLoaded.