Assignment Algorithms
Total Page:16
File Type:pdf, Size:1020Kb
Lecture 8: Assignment Algorithms Prof. Krishna R. Pattipati Dept. of Electrical and Computer Engineering University of Connecticut Contact: [email protected]; (860) 486-2890 © K. R. Pattipati, 2001-2016 Outline • Examples of assignment problems • Assignment Algorithms . Auction and variants . Hungarian Algorithm (also called Kuhn-Munkres Algorithm) . Easy to understand, but not for practical applications . Successive shortest path algorithm (Hungarian; Jonker, Volgenant and Castanon (JVC)) . Signature … Not efficient computationally • Special cases • M-Best Assignment Algorithms . Murty (1968) . Stone & Cox (1995) . Popp, Pattipati & Bar-Shalom (1999) VUGRAPH 2 Examples of assignment problems • Assignment problem . Also known as weighted bipartite matching problem • Bipartite graph . Has two sets of nodes 푆, 푇 ⇒ 푉 = 푆 ∪ 푇 . And a set of edges 퐸 connecting them • A matching on a bipartite graph G = (S, T, E) is a subset of edges 푋 ∈ 퐸 ∋ no two edges in 푋 are incident to the same node Matching S T 1 1 2 2 3 3 4 4 5 . Nodes 1, 2, 3, 4 of 푆 are matched or covered . Node 5 is uncovered or exposed VUGRAPH 3 Matching problems • Two types of matching problems: m = |S|; n = |T| . Cardinality matching problem o Find a matching with maximum number of arcs max xij (,)i j E s.t. xij 1 i xij 1 j xij 0,1 . Weighted matching problem or the assignment problem maxwij x ij or min c ij x ij , c ij w ij (,)(,)i j E i j E s.t. xij 1 i 1, , n (or =) (,)i j E xij 1 j 1, , m (,)i j E (or =) xij 0,1 o Problem can also be written as σ max훼 푖 푤푖훼푖 훼 ~ permutation of columns of 푊 (= assignment of object i to person i) VUGRAPH 4 Examples of assignment problems . Examples o Assigning people to machines o Correlating reports from two sensors o System of distinct representatives (cardinality matching problem) o Cardinality matching ~ maximum flow (~ analogous to) cardinality matching maximum flow 1 4 1 4 ∞ ∞ 1 1 2 5 2 5 s 1 ∞ 1 t 3 6 1 1 6 m + n nodes ∞ ∞ 3 capacity ퟐ <−> ퟒ ퟏ <−> ퟓ m + n + 2 nodes (Lecture 9) VUGRAPH 5 Examples of assignment problems o 푛 × 푛 assignment or bipartite matching ~ minimum cost network flow problem … (Lecture 10) bipartite matching MCNF 4 capacity, cost 4 1 4 1 ∞,4 –3 6 ∞,∞ 1,0 1,0 2 ∞,2 ∞,6 2 1 5 s 1,0 ∞,1 5 1,0 t 0 2 ∞,5 ∞,0 1,0 ∞ 5 1,0 ∞,–3 3 6 2 3 ∞,2 6 2n nodes 2n + 2 nodes 4 6 3 c 2 1 0 ij 52 ⇒ Can use RELAX to solve assignment problem (Lecture 10) ⇒ In this particular case, even 휖 – relax works as well as RELAX even on sequential computers (Lecture 10) VUGRAPH 6 Optimality conditions • Dual of the assignment problem . Assume equality constraints & 푚 = 푛 w/o loss of generality Primal Dual max wx nn ij ij (,)i j E min ij p ij11 s.t. xij 1 i 1, , n (,)i j E s.t. ipw j ij , i, j E xij 1 j 1, , n (,)i j E xij 0,1 , i , j E 푥푖푗 > 0 ⇒ 휋푖 + 푝푗 = 푤푖푗 at optimum: 휋푖 = max 푤푖푘 − 푝푘 CS conditions imply: ቋ 푘∈out(푖) 푥푖푗 = 0 ⇒ 휋푖 + 푝푗 > 푤푖푗 = 푤푖푗 − 푝푗 . To provide physical interpretation, let 푖 = person and 푗 = object o 푝푗 ~ price of object 푗 = amount of money that a person is willing to pay when assigned to 푗 o (푤푖푗 − 푝푗) ~ profit margin if person 푖 is assigned to object 푗 = benefit person 푖 associates with being assigned to object 푗 o So, if (푖, 푗) is an optimal pair (i.e., part of an optimal solution), then the profit ∗ margin 휋푖 is iw ij p j max w ik p k kiout VUGRAPH 7 Optimality conditions . Using this fact, we can simplify the dual problem considerably nn Note that every can minq , p min p i ij be decreased by a ij11 constant and every p s.t. p w, ( i , j ) E j i j ij increased by without (or) ip j w ij , j out( i ); i 1,2,.., n affecting q. o Suppose that somebody gave us prices of objects {푝푗} o Then, for a given set of {푝푗}, the optimal imax {wp ij j } jiout( ) o Dual problem is equivalent to nn minq p min pj max { w ij p j } p jiout( ) ji11 o Note: no constraints on 푝푗 VUGRAPH 8 Auction algorithm for the assignment problem . Start with an initial set of object prices, 푝푗: 1 ≤ 푗 ≤ 푛 (e.g., 푝푗 = 0 or max푖 푤푖푗) . Initially, either no objects are assigned or else have 휖-complementary slackness satisfied 휋푖 − 휖 = max 푤푖푘 − 푝푘 − 휖 ≤ 푤푖푗 − 푝푗, 푗 = arg max 푤푖푘 − 푝푘 푘 푘 휋푖 − 휖 ≤ 푤푖푗 − 푝푗 = 휋푖, ∀ 푖, 푗 ∈ out 푖 ∋ 푗 is assigned to 푖 ⇒ 휋푖 = 푤푖푗 − 푝푗 ≥ max 푤푖푘 − 푝푘 − 휖 ⇒ CS Conditions 푘 ⇒ Partial 휖-optimal assignment • Auction algorithm consists of two phases . Bidding phase: o Each unassigned person 푖 computes the “current value” of object 푗 (i.e., potential profit if 푖 is assigned to 푗) & bids for the object of his choice . Assignment phase: o Each object (temporarily) offers itself to the highest bidder • Bidding phase . Each unassigned person 푖 computes the value of object 푗 ∈ out(푖) 푣푖푗 = 푤푖푗 − 푝푗; 푗 ∈ out(푖) VUGRAPH 9 Auction has Two phases: Bidding & Assignment . Let ∗ 휋푖 = max. value = max 푣푖푗 = 푣푖푗 푗∈out(푖) . Find the next best value (second best profit) 휙푖 = max 푣푖푗 푗∈out(푖) 푗≠푗∗ ∗ ∗ ∗ ∗ . Person 푖 then bids for object 푗 at a price of 푏푖푗 = 푝푗 + 휋푖 − 휙푖 + 휖=푤푖푗 −휙푖 + 휖 ∗ ∗ ∗ . Note: actually, can have 푏푖푗 ∈ 푝푗 + 휖, 푝푗 + 휋푖 − 휙푖 + 휖 … but the above choice provides best performance (more later, from the dual cost structure) ∗ . Q: what if 푗 is the only object ⇒ set 휙푖 = −∞ or a number ≪ 휋푖 . This process is highly parallelizable • Assignment phase . For each object 푗, if 푃(푗) is the set of persons from whom 푗 received a bid, then 푝푗 = max 푏푖푗 = 푏푖∗푗 푖∈푃(푗) . Announce the new price to all persons ∗ . Assign person 푖 to object 푗 ⇒ 푥푖∗푗 = 1 ′ . De-assign any previous assignment 푖 to 푗 ⇒ 푥푖′푗 = 0 . If there was no bid, don’t do anything . This process is also highly 푝푎푟푎푙푙푒푙푖푧푎푏푙푒 VUGRAPH 10 Properties of Auction algorithm • Properties ′ ′ . If 푝푗 is price of object 푗 before assignment & 푝푗 after assignment, we have 푝푗 ≥ 푝푗, ∀푗 ⇒ 푝푗 ↑ ′ ′ ⇒ 푝푗∗ = 푝푗∗ + 휋푖 − 휙푖 + 휖 ⇒ 푝푗∗ ≥ 푝푗∗ . Maintains 휖-complementary slackness for assigned objects . Suppose object 푗∗ accepts bid of person 푖 ′ ′ ′ 휋 = 푤푖푗∗ − 푝 ∗ = 휙푖 − 휖 = max 푤푖푗 − 푝푗 − 휖 ≥ max 푤푖푗 − 푝 − 휖 푖 푗 푗∈out(푖) 푗∈out(푖) 푗 푗≠푗∗ 푗≠푗∗ ′ ′ 푤푖푗∗ − 푝 ∗ ≥ max 푤푖푗 − 푝푗 − 휖 푗 푗∈out 푖 ⇒ 휖-CS conditions continue to hold . Profit margin of 푖 after assignment ′ ′ ′ ′ 휋푖 = max 푤푖푗 − 푝푗 = max 푤푖푗∗ − 푝 ∗, max 푤푖푗 − 푝푗 푗∈out(푖) 푗 푗∈out(푖) 푗≠푗∗ ≤ max 푤푖푗∗ − 푝′푗∗, max 푤푖푗 − 푝푗 = max 휙푖 − 휖, 휙푖 = 휙푖 푗∈out 푖 푗≠푗∗ ′ 푝푗∗ = 푝푗 + 휋푖 − 휙푖 + 휖 ⇒ price increases by least 휖 ′ ′ ′ 휋푖 = 푤푖푗∗ − 푝푗∗ = 휙푖 − 휖 ≥ 휋푖 − 휖 ⇒ profit goes down by at least 휖 VUGRAPH 11 Coordinate descent interpretation . Coordinate descent interpretation of bidding and assignment phases o Jacobi-like relaxation step for minimizing the dual function 푞(푝) In each bidding and assignment phase, the price 푝푗 of each object 푗 bidded upon is increased to either a value that minimizes 푞(푝) when all other prices are kept constant, or else exceeds the largest such value by no more than 휖 Dual cost slope = –3 range of along 푝푗 possible 푝푗 slope = –2 slope = 1 slope = –1 slope = 0 휖 푤 − 휙 푤 − 휙 푖1푗 푖1 푖3푗 푖3 푤푖4푗 − 휙푖4 푝푗 푤푖2푗 − 휙푖2 푛 푛 Recall: 푞 푝 = σ푗=1 푝푗 + σ푖=1 max 푤푖푗 − 푝푗 푗∈out(푖) ⇒ max 푤푖푗 − 푝푗 = max 푤푖푗 − 푝푗 , max 푤푖푗′ − 푝푗′ 푗∈out(푖) 푗′∈out 푖 ,푗′≠푗 = max 푤푖푗 − 푝푗 , 휙푖 VUGRAPH 12 Coordinate descent interpretation • If 푝푗 < 푤푖푗 − 휙푖, 푖 bids for object 푗 the amount 푤푖푗 − 휙푖 + 휖 • Accepted bid by 푗: max 푤푖푗 − 휙푖 + 휖 푖 • Also, note that the right directional derivative of 푞(푝) along 푝푗 = 푒푗 is + 푑푗 = 1 − (# of persons 푖 with 푗 ∈ out 푖 ∋ 푝푗 < 푤푖푗 − 휙푖) ′ • This is because we can increase 푝푗 only if 휙푖 = 푤푖푗′ − 푝푗′ ≤ 푤푖푗 − 푝푗 where 푗 is second best . This interpretation leads to two other variations of auction • Each assigned person 푖 also bids for his own assigned object 푗, 푏푖푗 = 푤푖푗 − 휙푖 + 휖 푤푖4푗 푤푖3푗 푝푗 푤푖2푗 휙푖4 휙푖3 푤푖1푗 휙푖2 휙푖1 푤푖1푗 − 휙푖1 푤 − 휙 푤 − 휙 푖2푗 푖2 푤푖3푗 − 휙푖3 푖4푗 푖4 푝푗 VUGRAPH 13 Gauss-Seidel method • Gauss-Seidel . Only one person bids at a time . Price rise is taken into account before the next person bids . Problem: can’t parallelize, but has much faster convergence on sequential implementations . ∃ 푣푎푟푖푎푡푖표푛푠 in between Jacobi and Gauss-Seidel (e.g. bids by a subset of persons)… Research Problem . Q: Can we maintain optimality even in the presence of 휖? . A: Yes!! • Suppose 푖 is assigned object 푗푖, ∀푖 = 1,2, … , 푛 • Each step of the algorithm maintains wp iji i j i wp n ijjii i i i i • If f* is the optimal primal value (note: maximization) f w p n f n ijii i j i i i 1 • If 푎 are integer & 휖 < ⇒ 푛휖 < 1 ⇒ optimality 푖푗 푛 .