Coordination and task allocation
UAT 461 Autonomous Navigation and Multi-UAV Systems
Lesson
By the end of this module you will be able to
- Explain the coordination styles of a multi-UAV system and place the allocation problem in the Gerkey and Matarić taxonomy
- Allocate tasks with greedy and with the Hungarian method, using the minimum-sum or the minimise-the-longest-leg criterion, and choose the criterion to suit the mission
- Explain Bertsekas's price auction and its n ε error bound
- Simulate the distributed auction CBAA on several communication graphs and relate the number of rounds to the graph diameter
- Decide how to reallocate when one drone fails, weighing total distance against the number of drones that must change task
Why this matters
With 12 drones and 12 container blocks, who goes where? If each drone chooses for itself, three things tend to happen: two drones choose the same block, one block gets nobody, and one drone flies across the yard although a nearer block is free. Coordination is making each drone’s decisions compatible, and task allocation is the part of coordination that answers who does what. This module answers three questions in turn: how to allocate well, how to allocate without a centre, and what to do when a drone fails on the way.
By the function table of module 6, allocation runs at the station and is repeated when a drone fails, but if the link to the station is lost the team must be able to allocate among themselves. So this module teaches both a centralised method (Hungarian) and a distributed one (CBAA). For the taxonomy and the sequential single-item auction (Koenig et al., 2006) for tasks where each robot does several jobs in a row, see UAT 308 module 5. The case is still the fictional container yard. The first round of the day has 12 blocks taken from a list of 24, and the drones leave from 12 docks on the gate line x = 0. All numbers are invented.
Coordination styles and the taxonomy
Robot teams coordinate in several styles. Centralised optimisation lets one computer find the best plan for the whole team. Market-based coordination lets each robot bid and gives the task to the best bidder. Consensus-based coordination lets neighbours agree on shared values by exchanging only local information. Behaviour-based coordination lets each robot follow simple rules, which suits holding a formation (module 8) better than allocating tasks.
Gerkey and Matarić (2004) classify problems along three axes: a robot does one task at a time or several (ST or MT), a task needs one robot or several (SR or MR), and allocation is made once, instantly, or planned over time (IA or TA). Korsah et al. (2013) extend this into a taxonomy that also considers the relationships between tasks. Our first-round allocation is ST-SR-IA: one drone takes one block, one task at a time, allocated once and immediately. This is the assignment problem, which can be solved to optimality in polynomial time.
The assignment problem and choosing the criterion
Let be the cost of drone taking block , such as flight distance or energy. The problem is to find the one-to-one matching that minimises the sum . The Hungarian method of Kuhn (1955) solves this exactly. Greedy is different: each drone in turn takes the cheapest task still free, which is fast but leaves the later drones with what is left. Engineering work uses ready-made solvers such as SciPy’s scipy.optimize.linear_sum_assignment, which uses the algorithm described by Crouse (2016) (SciPy developers, n.d.).
There is more than one cost worth minimising. The sum (min-sum) saves total energy and flight time. The bottleneck (min-max) makes the longest leg as short as possible, which suits a mission that ends when the last drone finishes. A bottleneck solution raises the allowed leg length step by step and asks whether a full matching still exists using only legs no longer than the limit.
Example 1 Allocating 12 blocks with greedy, minimum sum and bottleneck
The 12 drones are at the docks x = 0, y = 25 to 575 m, 50 m apart. The 12 blocks of the first round are scattered over the yard (assumed). The cost is the straight-line flight distance. Compare the three methods by total distance and longest leg, and then look at a small 4 × 4 example in which the two criteria give different answers (minutes, assumed).
import numpy as np
from scipy.optimize import linear_sum_assignment
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import maximum_bipartite_matching
rng = np.random.default_rng(486)
V = 10.0 # m/s cruise speed
docks = np.column_stack([np.zeros(12), np.linspace(25, 575, 12)]) # 12 drones along the gate, x = 0
zones24 = np.column_stack([rng.uniform(150, 1150, 24), rng.uniform(30, 570, 24)]) # the yard list of 24 reefer blocks
zones = zones24[:12] # blocks of the first wave
cost = np.linalg.norm(docks[:, None] - zones[None], axis=2) # flight distance, m
def greedy(C):
free, cols = set(range(len(C))), []
for i in range(len(C)): # each drone in turn takes its cheapest free task
j = min(free, key=lambda k: C[i, k])
cols.append(j)
free.remove(j)
return np.array(cols)
def min_sum(C):
return linear_sum_assignment(C)[1] # minimise the total (Hungarian family)
def min_max(C):
for t in sorted(C.ravel()): # smallest threshold that still allows a full matching
m = maximum_bipartite_matching(csr_matrix(C <= t), perm_type="column")
if (m >= 0).all():
return m
def show(C, label, cols, unit):
d = C[np.arange(len(C)), cols]
print(f"{label:9s} total {d.sum():7.0f} {unit} longest {d.max():6.0f} {unit}")
for name, fn in (("greedy", greedy), ("min-sum", min_sum), ("min-max", min_max)):
show(cost, name, fn(cost), "m")
print("longest leg of min-sum:", round(cost[np.arange(12), min_sum(cost)].max() / V, 1), "s at", V, "m/s")
small = np.array([[7, 10, 10, 9], [10, 4, 10, 4], [2, 11, 7, 5], [5, 4, 9, 9]]) # 4 drones x 4 tasks, minutes (assumed)
for name, fn in (("greedy", greedy), ("min-sum", min_sum), ("min-max", min_max)):
show(small, name, fn(small), "min")
greedy total 9294 m longest 1213 m
min-sum total 8599 m longest 1142 m
min-max total 8778 m longest 1142 m
longest leg of min-sum: 114.2 s at 10.0 m/s
greedy total 25 min longest 9 min
min-sum total 20 min longest 10 min
min-max total 22 min longest 7 min
In the yard greedy gives a total of 9,294 m and the minimum sum gives 8,599 m, 7.5% shorter than greedy (or, the other way round, greedy is 8.1% longer). The longest leg of the minimum-sum plan is 1,142 m, or 114.2 s at 10 m/s. The bottleneck plan has the same longest leg, 1,142 m, but a total of 8,778 m, 2.1% more than the minimum sum. The longest legs are equal because no plan can have a longest leg shorter than the distance from the farthest block to its nearest dock, which is 1,142 m, and the minimum-sum plan already reaches that lower bound. This is not always so. In the small example the minimum sum gives 20 minutes but has a longest leg of 10 minutes, while the bottleneck gives a longest leg of 7 minutes at the price of a 22-minute total, and greedy gives 25 minutes, worse than both. The lesson is to calculate both criteria and then choose by the mission. In the yard case the minimum sum is enough, so the team takes it as the main plan.
The price auction
The Hungarian method needs a central computer that sees the whole cost matrix. The auction algorithm of Bertsekas (1988) works differently: it imitates an auction. A drone with no task bids for the block that gives it the most benefit after subtracting the current price, and raises that block’s price by the difference between its best and second-best choices plus a small . The block’s previous owner is outbid and must bid again. The makes the auction finish, and the total benefit obtained differs from the optimum by at most , where is the number of drones. If the costs are integers and the result is optimal. Each round uses the information of one drone and the current prices, so the computation can be distributed.
Example 2 The value of ε, the number of rounds, and the n ε bound
Use the matrix of Example 1 converted into benefits (the closer, the better). Run the auction with and compare with the optimum and the bound at .
score = cost.max() + 1 - cost # benefit of drone i taking zone j: higher is better
def price_auction(b, eps):
n = len(b)
price, owner, mine = np.zeros(n), np.full(n, -1), np.full(n, -1)
rounds = 0
while (mine < 0).any():
i = int(np.flatnonzero(mine < 0)[0]) # an unassigned drone bids
value = b[i] - price
j = int(np.argmax(value))
best, second = value[j], np.partition(value, -2)[-2]
price[j] += best - second + eps # raise the price just enough to win, plus eps
if owner[j] >= 0:
mine[owner[j]] = -1 # the previous owner is outbid
owner[j], mine[i] = i, j
rounds += 1
return mine, rounds
best_total = score[linear_sum_assignment(score, maximize=True)].sum()
print(f"optimal benefit {best_total:.1f}")
print("eps rounds benefit gap to optimal bound n*eps")
for eps in (100, 10, 1, 0.1):
mine, rounds = price_auction(score, eps)
got = score[np.arange(12), mine].sum()
print(f"{eps:5g} {rounds:7d} {got:8.1f} {best_total - got:15.1f} {12 * eps:12.1f}")
optimal benefit 6254.8
eps rounds benefit gap to optimal bound n*eps
100 43 6197.6 57.2 1200.0
10 287 6246.4 8.4 120.0
1 1046 6254.8 0.0 12.0
0.1 1808 6254.8 0.0 1.2
At the auction ends in 43 rounds and the benefit is 57.2 below the optimum, far less than the bound of 1,200. The bound is a worst case and is always loose. At the gap falls to 8.4 but 287 rounds are needed, and at the optimum is found in this experiment (gap 0.0) but it takes 1,046 rounds. At 0.1 it takes 1,808 rounds and gains nothing. What this shows is that ε is a dial between quality and number of messages. Set it by the accuracy the mission needs, not as small as possible.
CBAA: an auction without a centre
The price auction still needs a central price store. The CBAA (consensus-based auction algorithm) of Choi et al. (2009) puts the prices on every drone and uses consensus instead. Each round has two phases. In the first, a drone with no task bids for the block it scores highest, provided that score is above the highest bid it believes exists. In the second, drones exchange their bid tables and winner tables with the neighbours they can hear and keep the higher bid (ties go to the lower drone number). A drone that finds itself outbid releases that task and bids again in the next round. This repeats until nobody changes anything.
Choi et al. prove that, under conditions on the scoring function, on a static, connected communication graph CBAA converges to a conflict-free assignment in rounds, where is the diameter of the graph (the longest shortest path between two nodes, counted in hops) and is the number of assignments to be made, here 12. They also prove that the result is at least 50% of optimal in the worst case. The result equals that of sequential greedy, which picks the (drone, block) pair with the highest score across the whole team first and then repeats. This is why the result is usually very good but not as exact as the Hungarian method.
Example 3 CBAA on four communication graphs
The 12-drone team uses the benefit matrix from Example 2. Try four communication graphs: complete (every drone hears every drone, D = 1), lattice (hears two drones on each side, D = 3), ring (D = 6) and path (D = 11). Count the rounds, compare with the bound , and compare the score with the Hungarian result and with sequential greedy.
n = 12
def graph(kind):
A = np.zeros((n, n), bool)
for i in range(n):
if kind == "ring":
A[i, (i + 1) % n] = True
elif kind == "path":
if i + 1 < n:
A[i, i + 1] = True
elif kind == "lattice":
A[i, (i + 1) % n] = A[i, (i + 2) % n] = True
if kind == "complete":
A[:] = True
A = A | A.T
np.fill_diagonal(A, False)
return A
def diameter(A):
d = np.where(A, 1.0, np.inf)
np.fill_diagonal(d, 0)
for k in range(n):
d = np.minimum(d, d[:, [k]] + d[[k], :])
return int(d.max())
def cbaa(A):
y = np.zeros((n, n)) # y[i, j]: bid that agent i believes wins task j
z = np.full((n, n), -1) # z[i, j]: who agent i believes wins task j
x = np.full(n, -1) # task chosen by each agent
for it in range(1, 500):
for i in range(n): # phase 1: unassigned agents bid
if x[i] < 0:
valid = score[i] > y[i]
if valid.any():
j = int(np.argmax(np.where(valid, score[i], -1)))
x[i], y[i, j], z[i, j] = j, score[i, j], i
y0, z0 = y.copy(), z.copy() # phase 2: max-consensus with neighbours
changed = False
for i in range(n):
for j in range(n):
best_y, best_z = y0[i, j], z0[i, j]
for k in np.flatnonzero(A[i]):
if y0[k, j] > best_y or (y0[k, j] == best_y and 0 <= z0[k, j] < best_z):
best_y, best_z = y0[k, j], z0[k, j]
if (best_y, best_z) != (y[i, j], z[i, j]):
y[i, j], z[i, j] = best_y, best_z
changed = True
if x[i] >= 0 and z[i, x[i]] != i: # outbid: give the task up
x[i], changed = -1, True
if not changed and (x >= 0).all():
return x.copy(), it
return x.copy(), None
def sequential_greedy(S):
S, x = S.astype(float).copy(), np.full(n, -1)
for _ in range(n): # take the best remaining (drone, task) pair, repeat
i, j = np.unravel_index(np.argmax(S), S.shape)
x[i] = j
S[i, :], S[:, j] = -1, -1
return x
s_opt = score[linear_sum_assignment(score, maximize=True)].sum()
x_sg = sequential_greedy(score)
print(f"optimal score {s_opt:.0f}, sequential greedy {score[np.arange(n), x_sg].sum():.0f}")
for kind in ("complete", "lattice", "ring", "path"):
A = graph(kind)
x, it = cbaa(A)
s = score[np.arange(n), x].sum()
ok = len(set(x)) == n
print(f"{kind:8s} diameter {diameter(A):2d} rounds {it:3d} conflict-free {ok} same as greedy {(x == x_sg).all()} score {s:.0f} ({100*s/s_opt:.1f} % of optimal) n*D bound {n*diameter(A)}")
optimal score 6255, sequential greedy 6231
complete diameter 1 rounds 10 conflict-free True same as greedy True score 6231 (99.6 % of optimal) n*D bound 12
lattice diameter 3 rounds 13 conflict-free True same as greedy True score 6231 (99.6 % of optimal) n*D bound 36
ring diameter 6 rounds 20 conflict-free True same as greedy True score 6231 (99.6 % of optimal) n*D bound 72
path diameter 11 rounds 21 conflict-free True same as greedy True score 6231 (99.6 % of optimal) n*D bound 132
Every graph gives the same answer, a score of 6,231, which is 99.6% of the optimum of 6,255 and exactly equal to sequential greedy (same as greedy: True). In this case the gap from the optimum is tiny, but it is the theoretical 50% bound that serves as the guarantee. What differs is the number of rounds: the complete graph takes 10, the lattice 13, the ring 20 and the path 21, each below the bound (12, 36, 72 and 132). The diameter of the graph therefore sets how fast the team agrees, which ties to the network design in module 6 and to in module 8. A team with few links agrees slowly. If we assume one round takes one link frame (about 1.2 s at SF7 from Example 3 of module 6, with a bid table short enough for one message), a team on the ring graph needs about 20 × 1.2 = 24 s to agree.
When a drone fails
Allocation is not a one-off. When a drone is lost on the way, its task needs a new owner. There are three options. Full re-solve gives the best total distance but may tell several drones to change tasks while they are flying. Re-solve with a switch cost adds an artificial cost to every pair that is not the current task. Local repair lets the nearest drone take the orphaned block while the others fly on. Note that with 11 drones and 12 blocks one block will be left uncovered in this round, and a choice has to be made about which.
Example 4 Drone 5 is lost 40 s after take-off
All drones fly the minimum-sum plan at 10 m/s, and drone 5 is lost at 40 s. Find the current positions of the other 11 drones and compare the three options by total remaining distance, longest leg, the number of drones that must change block, and the block left uncovered. The switch penalty is 150 m (assumed).
base = min_sum(cost) # plan from example 1 (minimum sum)
T_FAIL = 40.0 # s after take-off
frac = np.minimum(T_FAIL * V / cost[np.arange(12), base], 1.0) # fraction of each leg already flown
cur = docks + frac[:, None] * (zones[base] - docks) # current positions
dead = 4 # drone 5 is lost
alive = [i for i in range(12) if i != dead]
c_now = np.linalg.norm(cur[alive][:, None] - zones[None], axis=2) # 11 drones, 12 zones
print(f"drone {dead+1} lost at {T_FAIL:.0f} s; its zone is {base[dead]+1}; flown {frac[dead]:.2f} of its leg")
def evaluate(cols, label):
flown = np.linalg.norm(cur[alive] - zones[cols], axis=1)
changed = sum(1 for k, i in enumerate(alive) if cols[k] != base[i])
left = sorted(set(range(12)) - set(cols))
print(f"{label:27s} remaining {flown.sum():5.0f} m longest {flown.max():4.0f} m switch zone {changed:2d} uncovered zone {left[0] + 1}")
keep_mask = np.zeros_like(c_now)
for k, i in enumerate(alive):
keep_mask[k, base[i]] = 1
orphan = base[dead]
evaluate(linear_sum_assignment(c_now)[1], "full re-solve")
PEN = 150.0 # metres of extra cost for abandoning a zone (assumed)
evaluate(linear_sum_assignment(c_now + PEN * (1 - keep_mask))[1], "re-solve with switch cost")
repair = np.array([base[i] for i in alive]) # local repair: nearest drone takes the orphan, rest keep going
k = int(np.argmin(c_now[:, orphan]))
repair[k] = orphan
evaluate(repair, "local repair")
drone 5 lost at 40 s; its zone is 4; flown 0.44 of its leg
full re-solve remaining 3479 m longest 742 m switch zone 3 uncovered zone 6
re-solve with switch cost remaining 3488 m longest 734 m switch zone 1 uncovered zone 2
local repair remaining 3550 m longest 742 m switch zone 1 uncovered zone 7
At 40 s drone 5 has flown 44% of its leg. A full re-solve gives a total remaining distance of 3,479 m but makes 3 drones change block. The switch penalty gives 3,488 m (only 0.3% more) with 1 drone changing, and local repair gives 3,550 m (2.0% more) with 1 drone changing as well. The three options differ by less than 2% in total distance but a great deal in how many new commands must be sent and how many drones change course in mid-air, each of which is a risk of a miscommunication and of new paths crossing (module 9). The team therefore takes re-solve with a switch penalty as its standard rule and uses local repair when the link cannot carry commands for several drones.
Module lab
Lab: allocating blocks for a fictional team on the campus map
Desk work plus position measurement on the ground; no drone is flown.
- Choose 6 start points and 6 task points in an open area of the campus. Measure the coordinates with a handheld GNSS receiver (a phone or a department unit) and convert them to metres in a local frame.
- Build the 6 × 6 distance matrix and allocate with greedy, minimum sum and bottleneck using the functions of Example 1. Note which criterion really differs.
- Run the price auction with three values of . Record the number of rounds and the gap from the optimum.
- Run CBAA on graphs of your own design (for example a path and a ring). Record the number of rounds and check that there is no conflict.
- Remove one start point part-way, reallocate with the three methods of Example 4, and choose one with a reason from the numbers.
- Hand in: the distance matrix, the table of results for the three criteria, the table of rounds, and a one-page conclusion on reallocation.
Common mistakes
Watch out
- Using greedy without comparing with the optimum. A small example often shows how much greedy loses.
- Choosing the criterion without asking when the mission ends. The minimum sum saves energy; the bottleneck ends the mission sooner.
- Setting ε too small. The number of messages grows like 1/ε without improving quality.
- Believing CBAA gives the optimum. It guarantees only no conflicts and at least 50% of the optimum.
- Forgetting that the communication graph changes when a drone is lost. Check that the graph is still connected and what the new diameter is.
- Re-solving everything at every event. Count the commands to be sent and the drones that change course in mid-air.
Summary
- An ST-SR-IA problem is an assignment problem that the Hungarian method solves exactly; greedy is fast but can be worse (8.1% longer in this yard).
- The minimum-sum and bottleneck criteria answer different questions; calculate both before choosing.
- The price auction ends within of the optimum, and a smaller ε needs more rounds.
- CBAA agrees on tasks without a centre within rounds, with a result equal to sequential greedy and at least 50% of optimal.
- When a drone fails, weigh total distance against the number of drones that change task; a switch cost keeps the new plan stable.
Self-check questions
- The costs (minutes) of 3 drones for 3 tasks, one row per drone, are [9, 8, 5], [11, 6, 4], [10, 3, 10]. What total does greedy in the order D1, D2, D3 give, what does the minimum sum give, and by what percentage do they differ?
- What are the round bounds for CBAA of the 12-drone team on a ring graph (D = 6) and on a complete graph (D = 1)?
- A price auction with 12 drones at ε = 5: by at most how much can the benefit differ from the optimum?
- Why can a reallocation that makes 3 drones change block be worse than one that makes 1 drone change, when the total distance differs by only 0.3%?
- In the yard of Example 1 the bottleneck and minimum-sum plans have the same longest leg. Why? Which example differs?
Answers
- Greedy: D1 takes task 3 (5), D2 chooses between tasks 1 and 2 and takes task 2 (6), D3 gets task 1 (10), total 21 minutes. Minimum sum: D1 task 1 (9), D2 task 3 (4), D3 task 2 (3), total 16 minutes. Greedy is more.
- rounds and rounds.
- At most benefit units.
- Each drone that changes needs a new command over a slow link that may be missed, and its new path may cross another drone’s in mid-air. This risk is not in the total distance.
- The lower bound on the longest leg of any plan is the distance from the farthest block to its nearest dock (1,142 m), and the minimum-sum plan already reaches it, so the bottleneck plan cannot improve on it. The 4 × 4 example differs: the minimum sum has a longest leg of 10 minutes and the bottleneck reduces it to 7 minutes, with the total rising from 20 to 22 minutes.
Key formulas
| Assignment problem (minimum sum) | |
| Bottleneck problem (minimise the longest leg) | |
| Price-auction bound | |
| CBAA round bound |
Key references
- Gerkey, B. P., & Matarić, M. J. (2004). A formal analysis and taxonomy of task allocation in multi-robot systems. The International Journal of Robotics Research, 23(9), 939–954. link
- Korsah, G. A., Stentz, A., & Dias, M. B. (2013). A comprehensive taxonomy for multi-robot task allocation. The International Journal of Robotics Research, 32(12), 1495–1512. link
- Kuhn, H. W. (1955). The Hungarian method for the assignment problem. Naval Research Logistics Quarterly, 2(1–2), 83–97. link
- Crouse, D. F. (2016). On implementing 2D rectangular assignment algorithms. IEEE Transactions on Aerospace and Electronic Systems, 52(4), 1679–1696. link
- SciPy developers. scipy.optimize.linear_sum_assignment. SciPy v1.18 reference guide. link
- Bertsekas, D. P. (1988). The auction algorithm: A distributed relaxation method for the assignment problem. Annals of Operations Research, 14(1), 105–123. link
- Choi, H.-L., Brunet, L., & How, J. P. (2009). Consensus-based decentralized auctions for robust task allocation. IEEE Transactions on Robotics, 25(4), 912–926. link
- Koenig, S., Tovey, C., Lagoudakis, M., Markakis, V., Kempe, D., Keskinocak, P., Kleywegt, A., Meyerson, A., & Jain, S. (2006). The power of sequential single-item auctions for agent coordination. In Proceedings of AAAI-06 (pp. 1625–1629). AAAI Press. link
Further reading
Study the assigned knowledge units in advance, review media and take the module quiz
In class / field
Lab or field practice from worksheets with a safety checklist
Learning evidence: Checked worksheets and quiz results