Presentation is loading. Please wait.

Presentation is loading. Please wait.

Assignment Problem Example

Similar presentations


Presentation on theme: "Assignment Problem Example"— Presentation transcript:

1 Assignment Problem Example
Matrix of costs X Y Z A 1 5 6 B 7 11 C 3 4 8

2 Set up initial residual graph
# – edge costs A 1 X 5 6 5 s 7 B Y t 11 3 4 8 C Z

3 Add in initial prices # – edge costs # – prices A X s B Y t C Z
1 X 5 1 4 6 Minimum of incoming edges zero’s every place else 6 5 s 7 B Y t 11 3 4 8 C Z

4 Calculate reduced edge costs: cpu,v = cu,v + p(u)-p(v)
# – prices # – reduced edge costs A 1 X 1 5 1 1 6 4 5 4 3 s 7 B Y t 11 5 4 2 6 3 4 8 2 C Z 6

5 Calculate shortest paths using Dijkstra’s using reduced costs
# – edge costs # – prices # – reduced edge costs 8 3 1 5 6 7 11 4 A X 1 1 1 4 4 3 s B Y t 5 4 2 6 2 C Z 6

6 Calculate shortest paths using Dijkstra’s using reduced costs
# – prices # – reduced edge costs A X 1 1 1 4 4 3 s B Y t 5 4 2 6 2 C Z 6

7 Calculate shortest paths using Dijkstra’s using reduced costs
# – prices # – reduced edge costs A X 1 1 1 4 4 3 s B Y t 5 4 Distance dps,v A: 0 B: 0 C: 0 X: 0 Y: 0 Z: 0 2 6 2 C Z 6

8 Shortest path to t is augmenting path
# – prices # – reduced edge costs A X 1 1 1 Min path to t 4 4 3 s B Y t 5 4 Distance dps,v A: 0 B: 0 C: 0 X: 0 Y: 0 Z: 0 2 6 2 C Z 6

9 Use it to get Minimum Cost Matching of size 1
# – edge costs # – prices # – reduced edge costs 1 A X 1 1 1 4 4 3 s B Y t 5 4 Distance dps,v A: 0 B: 0 C: 0 X: 0 Y: 0 Z: 0 2 6 Min cost matching, size 1 A -> X cost = 1 2 C Z 6

10 Rebuild graph using minimum cost matching
# – edge costs # – old prices A -1 X 5 1 6 5 s 7 B Y t 11 4 Distance dps,v A: 0 B: 0 C: 0 X: 0 Y: 0 Z: 0 3 4 Min cost matching, size 1 A -> X cost = 1 8 C Z 6

11 Calculate new prices: p(v) = p(v) + dps,v
# – edge costs # – old prices A -1 X 5 1 6 5 s 7 B Y t 11 4 Distance dps,v A: 0 B: 0 C: 0 X: 0 Y: 0 Z: 0 3 4 Min cost matching, size 1 A -> X cost = 1 8 C Z 6

12 Calculate new prices: p(v) = p(v) + dps,v (in this case, no change)
# – edge costs # – prices A -1 X 5 1 6 5 s 7 B Y t 11 4 Distance dps,v A: 0 B: 0 C: 0 X: 0 Y: 0 Z: 0 3 4 Min cost matching, size 1 A -> X cost = 1 8 C Z 6

13 Calculate reduced edge costs: cpu,v = cu,v + p(u)-p(v)
(note: all reduce costs ≥ 0) # – edge costs # – prices # – reduced edge costs -1 A X 5 1 1 6 4 5 4 3 s 7 B Y t 11 5 4 2 6 3 4 Min cost matching, size 1 A -> X cost = 1 8 2 C Z 6

14 Calculate shortest paths using Dijkstra’s using reduced costs
# – prices # – reduced edge costs A X 1 1 4 4 3 s B Y t 5 4 2 6 Min cost matching, size 1 A -> X cost = 1 2 C Z 6

15 Calculate shortest paths using Dijkstra’s using reduced costs
# – prices # – reduced edge costs A X 1 1 4 4 3 s B Y t 5 4 Distance dps,v A: 2 B: 0 C: 0 X: 2 Y: 0 Z: 2 2 6 Min cost matching, size 1 A -> X cost = 1 2 C Z 6

16 Shortest path to t is next augmenting path
# – prices # – reduced edge costs A X 1 1 4 4 3 s B Y t 5 4 Distance dps,v A: 2 B: 0 C: 0 X: 2 Y: 0 Z: 2 2 6 Min cost matching, size 1 A -> X cost = 1 2 C Z 6

17 Use it to get Minimum Cost Matching of size 2
# – edge costs # – prices # – reduced edge costs A X 1 1 4 4 3 s B Y t 5 4 Distance dps,v A: 2 B: 0 C: 0 X: 2 Y: 0 Z: 2 2 6 4 Min cost matching, size 2 A -> X cost = 1 C -> Y cost = 4 2 C Z 6

18 Rebuild graph using minimum cost matching
# – edge costs # – old prices A -1 X 5 1 6 5 s 7 B Y t 11 4 Distance dps,v A: 2 B: 0 C: 0 X: 2 Y: 0 Z: 2 3 -4 Min cost matching, size 2 A -> X cost = 1 C -> Y cost = 4 8 C Z 6

19 Calculate new prices: p(v) = p(v) + dps,v
# – edge costs # – old prices A -1 X 5 1 6 5 s 7 B Y t 11 4 Distance dps,v A: 2 B: 0 C: 0 X: 2 Y: 0 Z: 2 3 -4 Min cost matching, size 2 A -> X cost = 1 C -> Y cost = 4 8 C Z 6

20 Calculate new prices: p(v) = p(v) + dps,v
# – edge costs # – prices A -1 X 5 2 3 6 changed 5 s 7 B Y t 11 4 Distance dps,v A: 2 B: 0 C: 0 X: 2 Y: 0 Z: 2 3 -4 Min cost matching, size 2 A -> X cost = 1 C -> Y cost = 4 8 C Z 8 changed

21 Calculate reduced edge costs: cpu,v = cu,v + p(u)-p(v)
# – prices # – reduced edge costs -1 A X 5 3 2 3 6 2 5 3 s 7 B Y t 11 3 4 8 3 -4 Min cost matching, size 2 A -> X cost = 1 C -> Y cost = 4 8 C Z 8

22 Calculate shortest paths using Dijkstra’s using reduced costs
# – edge costs # – prices # – reduced edge costs A X 3 2 3 2 3 s B Y t 3 4 8 Min cost matching, size 2 A -> X cost = 1 C -> Y cost = 4 C Z 8

23 Calculate shortest paths using Dijkstra’s using reduced costs
# – edge costs # – prices # – reduced edge costs A X 3 2 3 2 3 s B Y t 3 4 Distance dps,v A: 2 B: 0 C: 3 X: 2 Y: 3 Z: 2 8 Min cost matching, size 2 A -> X cost = 1 C -> Y cost = 4 C Z 8

24 Shortest path to t is next augmenting path
# – edge costs # – prices # – reduced edge costs A X 3 2 3 2 3 s B Y t 3 4 Distance dps,v A: 2 B: 0 C: 3 X: 2 Y: 3 Z: 2 8 Min cost matching, size 2 A -> X cost = 1 C -> Y cost = 4 C Z 8

25 Use it to get Minimum Cost Matching of size 3
# – edge costs # – prices # – reduced edge costs -1 A X 3 2 3 6 2 5 3 s B Y t 3 4 Distance dps,v A: 2 B: 0 C: 3 X: 2 Y: 3 Z: 2 8 Min cost matching, size 2 A -> X cost = 1 C -> Y cost = 4 C Z 8

26 Use it to get Minimum Cost Matching of size 3
# – edge costs # – prices Undo previous matching # – reduced edge costs -1 A X 3 2 3 6 2 5 3 s B Y t 3 4 Distance dps,v A: 2 B: 0 C: 3 X: 2 Y: 3 Z: 2 8 Min cost matching C -> Y cost = 4 C Z 8

27 Use it to get Minimum Cost Matching of size 3
# – edge costs # – prices # – reduced edge costs A -1 X 3 2 3 6 Add two new matchings 2 5 3 s B Y t 3 4 Distance dps,v A: 2 B: 0 C: 3 X: 2 Y: 3 Z: 2 8 Min cost matching, size 2 A -> Z cost = 6 C -> Y cost = 4 B -> X cost = 5 C Z 8

28 Final matching, cost = 15 A X 6 5 B Y 4 C Z


Download ppt "Assignment Problem Example"

Similar presentations


Ads by Google