Algorithm Search⌘K

Proofs: Jonker-Volgenant algorithm

These are the human proofs of Jonker-Volgenant algorithm, at full length.

The Jonker-Volgenant algorithm returns a minimum-cost assignment full

This proof shows: correctness, termination.

Let C=(cij)C = (c_{ij}) be an n×nn \times n real matrix with n≥2n \ge 2 (the cases n≤1n \le 1 are handled directly). The algorithm keeps column prices vjv_j and a partial assignment: xix_i is the column of row ii or nil, and yjy_j is the row of column jj or nil, with xi=jx_i = j exactly when yj=iy_j = i. For each row put ui=min⁡j(cij−vj)u_i = \min_j (c_{ij} - v_j). Then

ui+vj≤cijfor all i,j(1)u_i + v_j \le c_{ij} \quad \text{for all } i, j \tag{1}

holds for any prices. The invariant is

(CS) for each assigned row ii, cixi−vxi=uic_{i x_i} - v_{x_i} = u_i.

Lemma 1 (the initialization keeps (CS)). (CS) holds after lines L2 to L4, and every change of prices and of the assignment in lines L5 to L10 keeps it. Lines L7 to L10 stop.

Proof. After line L3 for every column, vj=min⁡icijv_j = \min_i c_{ij}, so cij−vj≥0c_{ij} - v_j \ge 0 for all i,ji, j, and ui≥0u_i \ge 0. Line L4 assigns row i∗i^* to column jj only if ci∗j=vjc_{i^* j} = v_j, a reduced cost of 0, which is the least possible. So (CS) holds.

Lowering a price vkv_k raises cik−vkc_{ik} - v_k for every row and changes nothing else. For an assigned row ii with xi≠kx_i \ne k, its value at xix_i is unchanged and its other values do not go down, so xix_i stays a minimum.

At line L6, row ii was a minimum row of exactly one column k=xik = x_i in line L3, so vk=cikv_k = c_{ik} was set there. Line L6 changes only the price of the column of the row it treats, and different rows treated there have different columns, so vkv_k is unchanged when row ii is treated, and cik−vk=0c_{ik} - v_k = 0. Let δ=min⁡j≠k(cij−vj)≥0\delta = \min_{j \ne k}(c_{ij} - v_j) \ge 0, with the current prices. After vk←vk−δv_k \leftarrow v_k - \delta, the value of row ii at kk is δ\delta, which is the least of its values. So (CS) holds for ii, and for the other rows by the first paragraph.

At line L9, row ii is free, a=cij1−vj1=uia = c_{ij_1} - v_{j_1} = u_i and b=min⁡j≠j1(cij−vj)b = \min_{j \ne j_1}(c_{ij} - v_j). If a<ba < b, the new price makes the value of ii at j1j_1 equal to bb, which is the new minimum of row ii, and line L10 assigns ii to j1j_1. If a=ba = b, no price changes, and ii is assigned to j1j_1 or j2j_2, both of value a=uia = u_i. The row i0i_0 that loses its column becomes free, so (CS) no longer speaks of it. Other rows are covered by the first paragraph.

Each pass makes at most 2n2n bids, and a row that is not allowed to bid goes to the list of free rows, so each pass stops. □\square

After line L10, the free rows are exactly the rows with $x_i = $ nil: every row that loses its column at line L10 is put back on a list, and rows that were never assigned in L4 start on the list.

Lemma 2 (one augmentation). Suppose (CS) holds when line L12 starts for a free row ff. Then lines L13 to L17 stop with a free column end\text{end}, and after lines L18 and L19 (CS) holds, row ff is assigned, and every row assigned before is still assigned.

Proof. For an assigned row ii and any column j′j', write rij′=cij′−vj′−ui≥0r_{ij'} = c_{ij'} - v_{j'} - u_i \ge 0 for its reduced cost; by (CS), rixi=0r_{i x_i} = 0. In line L17, with i=yji = y_j, the quantity (cij′−vj′)−(cij−vj)(c_{ij'} - v_{j'}) - (c_{ij} - v_j) equals rij′−rij=rij′r_{ij'} - r_{ij} = r_{ij'}, so h=dj+rij′h = d_j + r_{ij'}. The prices do not change during lines L12 to L17.

Invariants of the search. While lines L13 to L17 run:

(a) a column enters RR with dj=μd_j = \mu for the current μ\mu, and then djd_j never changes; the value μ\mu never decreases; (b) every column j∉Rj \notin R has dj≥μd_j \ge \mu, and TT is a set of columns outside RR with dj=μd_j = \mu whose values do not change while they are in TT; (c) a value djd_j and the row pred[j]\text{pred}[j] are always set together, and either pred[j]=f\text{pred}[j] = f and dj=cfj−vjd_j = c_{fj} - v_j, or pred[j]=yk\text{pred}[j] = y_k for a column kk that was in RR at that moment and dj=dk+rykjd_j = d_k + r_{y_k j}.

Line L14 sets μ\mu to the least djd_j outside RR, so (b) holds after it, and the new μ\mu is at least the old one by (b). Line L16 moves a column of TT, with dj=μd_j = \mu, into RR. Line L17 changes only columns outside R∪TR \cup T, and each new value is h=dj+rij′≥dj=μh = d_j + r_{ij'} \ge d_j = \mu; a value equal to μ\mu puts the column into TT. This gives (a), (b) and (c).

Termination. Each pass of the loop that does not stop moves one column into RR. Only assigned columns enter RR: a free column in TT stops the loop at line L15, and a free column that reaches μ\mu at line L17 stops it at once. Row ff is free, so at most n−1n - 1 columns are assigned, and at most n−1n - 1 columns enter RR. When TT is empty, some column is outside RR, so line L14 is defined. So the loop stops, with a free column end∉R\text{end} \notin R and dend=μd_{\text{end}} = \mu.

A key inequality. Put dˉj=min⁡(dj,μ)\bar d_j = \min(d_j, \mu) with the final values; by (a) and (b), dˉj=dj\bar d_j = d_j for j∈R∪{end}j \in R \cup \{\text{end}\} and dˉj=μ\bar d_j = \mu for the other columns. We claim: for each k∈Rk \in R, with row i=yki = y_k, and each column jj,

dˉj≤dk+rij.(2)\bar d_j \le d_k + r_{ij}. \tag{2}

When kk was moved into RR, the value of μ\mu was dkd_k. If jj was already in RR, then dj≤dkd_j \le d_k by (a). If jj was in TT, then dj=dkd_j = d_k and it does not change later. If line L17 then compared jj, afterwards dj≤dk+rijd_j \le d_k + r_{ij}, and values only go down. If line L17 stopped before comparing jj, this was the last pass, so the final μ\mu equals dkd_k and dˉj≤μ=dk\bar d_j \le \mu = d_k. In every case (2) holds, as rij≥0r_{ij} \ge 0. Also, for every jj,

dˉj≤dj≤cfj−vj,(3)\bar d_j \le d_j \le c_{fj} - v_j, \tag{3}

since line L12 sets djd_j to this value and it only decreases.

New prices. Line L18 sets vj′=vj+dˉj−μv'_j = v_j + \bar d_j - \mu for all jj (no change outside RR). Then for any row ii that was assigned and any column jj,

cij−vj′=ui+rij−dˉj+μ.c_{ij} - v'_j = u_i + r_{ij} - \bar d_j + \mu.

Let k=xik = x_i before line L19. If k∉Rk \notin R, then dˉk=μ≥dˉj\bar d_k = \mu \ge \bar d_j and rik=0r_{ik} = 0, so cik−vk′=ui≤cij−vj′c_{ik} - v'_k = u_i \le c_{ij} - v'_j. If k∈Rk \in R, (2) gives cij−vj′≥ui−dk+μ=cik−vk′c_{ij} - v'_j \ge u_i - d_k + \mu = c_{ik} - v'_k. So every row keeps a minimum at its old column; we use this for the rows that line L19 does not move.

The path. By (c), following pred\text{pred} from end\text{end} gives jt=endj_t = \text{end}, it−1=pred[jt]=yjt−1i_{t-1} = \text{pred}[j_t] = y_{j_{t-1}}, and so on, to a column j1j_1 with pred[j1]=f\text{pred}[j_1] = f; each jsj_s with s<ts < t is in RR, and it entered RR before js+1j_{s+1} received its pred\text{pred}, so the walk goes back in time and stops. The equalities of (c) hold with the final values, since values in RR do not change: dj1=cfj1−vj1d_{j_1} = c_{f j_1} - v_{j_1} and djs+1=djs+risjs+1d_{j_{s+1}} = d_{j_s} + r_{i_s j_{s+1}}, where is=yjsi_s = y_{j_s}. Line L19 assigns ff to j1j_1 and each isi_s to js+1j_{s+1}, and no other row changes.

For a moved row isi_s: cisjs+1−vjs+1′=uis+risjs+1−djs+1+μ=uis−djs+μc_{i_s j_{s+1}} - v'_{j_{s+1}} = u_{i_s} + r_{i_s j_{s+1}} - d_{j_{s+1}} + \mu = u_{i_s} - d_{j_s} + \mu, which is the least value of row isi_s by (2) with k=jsk = j_s. For row ff: cfj1−vj1′=dj1−dˉj1+μ=μc_{f j_1} - v'_{j_1} = d_{j_1} - \bar d_{j_1} + \mu = \mu, and for any jj, cfj−vj′=(cfj−vj)−dˉj+μ≥μc_{fj} - v'_j = (c_{fj} - v_j) - \bar d_j + \mu \ge \mu by (3). So (CS) holds after line L19, ff is assigned, and the other rows keep a column. □\square

Theorem. LAPJV stops and returns a permutation xx of least total cost, with uu and vv satisfying (1) and equality on the pairs (i,xi)(i, x_i).

Proof. By Lemma 1, (CS) holds when line L11 starts. Line L11 treats each free row once, and by Lemma 2 each augmentation keeps (CS), assigns its row and unassigns no row. So at the end every row is assigned to a distinct column, and xx is a permutation. The returned ui=cixi−vxiu_i = c_{i x_i} - v_{x_i} equals min⁡j(cij−vj)\min_j (c_{ij} - v_j) by (CS), so (1) holds, with equality on the chosen pairs.

Let σ\sigma be any permutation. By (1),

∑iciσ(i)≥∑i(ui+vσ(i))=∑iui+∑jvj=∑i(ui+vxi)=∑icixi,\sum_i c_{i \sigma(i)} \ge \sum_i (u_i + v_{\sigma(i)}) = \sum_i u_i + \sum_j v_j = \sum_i (u_i + v_{x_i}) = \sum_i c_{i x_i},

because σ\sigma and xx are both bijections onto the columns. So xx has the least cost. ■\blacksquare

Back to Jonker-Volgenant algorithm