17
1 Lecture 26 – Problem 11-19 Page 617 Military Problem with Three Commanders Six Radar Stations Each Commander Should Be Assigned Two Radar Stations C1 C2 C3 S1 S2 S3 S4 S5 S6 Cost = 42 M Cost = 68 M Cost = 47 M

1 Lecture 26 – Problem 11-19 Page 617 Military Problem with Three Commanders Six Radar Stations Each Commander Should Be Assigned Two Radar Stations C1C2C3

Embed Size (px)

Citation preview

Page 1: 1 Lecture 26 – Problem 11-19 Page 617 Military Problem with Three Commanders Six Radar Stations Each Commander Should Be Assigned Two Radar Stations C1C2C3

1

Lecture 26 – Problem 11-19 Page 617

Military Problem with Three CommandersSix Radar StationsEach Commander Should Be Assigned Two Radar

Stations

C1 C2 C3

S1 S2 S3 S4 S5 S6

Cost = 42 M Cost = 68 M Cost = 47 M

Page 2: 1 Lecture 26 – Problem 11-19 Page 617 Military Problem with Three Commanders Six Radar Stations Each Commander Should Be Assigned Two Radar Stations C1C2C3

2

Another Feasible Assignment

C1 C2 C3

S1 S3 S2 S5 S4 S6

Cost = 65 M Cost = 40 M Cost = 39 M

Total Cost For This Assignment is

65+40+39 = 144

Page 3: 1 Lecture 26 – Problem 11-19 Page 617 Military Problem with Three Commanders Six Radar Stations Each Commander Should Be Assigned Two Radar Stations C1C2C3

3

Cost Matrix In 000,000s

Symmetrical – See Page 617

1 2 3 4 5 6

1 - 42 65 29 31 55

2 - 20 39 40 21

3 - 68 55 22

4 - 30 39

5 - 47

6 -

Page 4: 1 Lecture 26 – Problem 11-19 Page 617 Military Problem with Three Commanders Six Radar Stations Each Commander Should Be Assigned Two Radar Stations C1C2C3

4

The Data File – See p 617

set N := 1 2 3 4 5 6;param cost :=1 2 421 3 651 4 291 5 311 6 552 3 202 4 392 5 402 6 213 4 683 5 553 6 224 5 304 6 395 6 47 ;

Page 5: 1 Lecture 26 – Problem 11-19 Page 617 Military Problem with Three Commanders Six Radar Stations Each Commander Should Be Assigned Two Radar Stations C1C2C3

5

AMPL Model – Page 1

set N; # the set of radar stationsparam cost{N,N} default 0; # cost[i,j] denotes the construction cost for # linking i and jdata data26.txt;display N;display cost;set N1;let N1 := N diff {1};display N1;

Page 6: 1 Lecture 26 – Problem 11-19 Page 617 Military Problem with Three Commanders Six Radar Stations Each Commander Should Be Assigned Two Radar Stations C1C2C3

6

AMPL Model – Page 2

# Since the cost matrix is symmetrical, fill in bottom half

for {i in N1} for {j in N: j < i} let cost[i,j] := cost[j,i];

display cost;

Page 7: 1 Lecture 26 – Problem 11-19 Page 617 Military Problem with Three Commanders Six Radar Stations Each Commander Should Be Assigned Two Radar Stations C1C2C3

7

AMPL Model - Page 3

var x{N,N} binary; # x[i,j] = 1, if i and j are a pair # = 0, otherwise

subject to OnePerRow {i in N}: sum {j in N: i<>j} x[i,j] = 1;

subject to OnePerCol {j in N}: sum {i in N: i<>j} x[i,j] = 1;

Page 8: 1 Lecture 26 – Problem 11-19 Page 617 Military Problem with Three Commanders Six Radar Stations Each Commander Should Be Assigned Two Radar Stations C1C2C3

8

AMPL Model – Page 4

subject to Symmetry {i in N, j in N}: x[i,j] = x[j,i];

minimize TotalCost: sum{i in N, j in N} cost[i,j]*x[i,j];

expand OnePerRow, OnePerCol, Symmetry, TotalCost;

solve;

display x;

Page 9: 1 Lecture 26 – Problem 11-19 Page 617 Military Problem with Three Commanders Six Radar Stations Each Commander Should Be Assigned Two Radar Stations C1C2C3

9

Output – Page 1

set N := 1 2 3 4 5 6;

cost :=1 2 421 3 651 4 291 5 311 6 552 3 202 4 392 5 402 6 213 4 683 5 553 6 224 5 304 6 395 6 47;

Page 10: 1 Lecture 26 – Problem 11-19 Page 617 Military Problem with Three Commanders Six Radar Stations Each Commander Should Be Assigned Two Radar Stations C1C2C3

10

Output – Page 2

set N1 := 2 3 4 5 6;

cost [*,*]: 1 2 3 4 5 6 :=1 . 42 65 29 31 552 42 . 20 39 40 213 65 20 . 68 55 224 29 39 68 . 30 395 31 40 55 30 . 476 55 21 22 39 47 .;

Page 11: 1 Lecture 26 – Problem 11-19 Page 617 Military Problem with Three Commanders Six Radar Stations Each Commander Should Be Assigned Two Radar Stations C1C2C3

11

Output – Page 3

s.t. OnePerRow[1]:x[1,2] + x[1,3] + x[1,4] + x[1,5] + x[1,6] = 1;

s.t. OnePerRow[2]:x[2,1] + x[2,3] + x[2,4] + x[2,5] + x[2,6] = 1;

s.t. OnePerRow[3]:x[3,1] + x[3,2] + x[3,4] + x[3,5] + x[3,6] = 1;

s.t. OnePerRow[4]:x[4,1] + x[4,2] + x[4,3] + x[4,5] + x[4,6] = 1;

s.t. OnePerRow[5]:x[5,1] + x[5,2] + x[5,3] + x[5,4] + x[5,6] = 1;

s.t. OnePerRow[6]:x[6,1] + x[6,2] + x[6,3] + x[6,4] + x[6,5] = 1;

Page 12: 1 Lecture 26 – Problem 11-19 Page 617 Military Problem with Three Commanders Six Radar Stations Each Commander Should Be Assigned Two Radar Stations C1C2C3

12

Output – Page 4

s.t. OnePerCol[1]:x[2,1] + x[3,1] + x[4,1] + x[5,1] + x[6,1] = 1;

s.t. OnePerCol[2]:x[1,2] + x[3,2] + x[4,2] + x[5,2] + x[6,2] = 1;

s.t. OnePerCol[3]:x[1,3] + x[2,3] + x[4,3] + x[5,3] + x[6,3] = 1;

s.t. OnePerCol[4]:x[1,4] + x[2,4] + x[3,4] + x[5,4] + x[6,4] = 1;

s.t. OnePerCol[5]:x[1,5] + x[2,5] + x[3,5] + x[4,5] + x[6,5] = 1;

s.t. OnePerCol[6]:x[1,6] + x[2,6] + x[3,6] + x[4,6] + x[5,6] = 1;

Page 13: 1 Lecture 26 – Problem 11-19 Page 617 Military Problem with Three Commanders Six Radar Stations Each Commander Should Be Assigned Two Radar Stations C1C2C3

13

Output – Page 5

s.t. Symmetry[1,1]:0 = 0;

s.t. Symmetry[1,2]:x[1,2] - x[2,1] = 0;

s.t. Symmetry[1,3]:x[1,3] - x[3,1] = 0;

s.t. Symmetry[1,4]:x[1,4] - x[4,1] = 0;

s.t. Symmetry[1,5]:x[1,5] - x[5,1] = 0;

s.t. Symmetry[1,6]:x[1,6] - x[6,1] = 0;

Page 14: 1 Lecture 26 – Problem 11-19 Page 617 Military Problem with Three Commanders Six Radar Stations Each Commander Should Be Assigned Two Radar Stations C1C2C3

14

Output – Page 6

s.t. Symmetry[6,1]:-x[1,6] + x[6,1] = 0;

s.t. Symmetry[6,2]:-x[2,6] + x[6,2] = 0;

s.t. Symmetry[6,3]:-x[3,6] + x[6,3] = 0;

s.t. Symmetry[6,4]:-x[4,6] + x[6,4] = 0;

s.t. Symmetry[6,5]:-x[5,6] + x[6,5] = 0;

s.t. Symmetry[6,6]:0 = 0;

Page 15: 1 Lecture 26 – Problem 11-19 Page 617 Military Problem with Three Commanders Six Radar Stations Each Commander Should Be Assigned Two Radar Stations C1C2C3

15

Output – Page 7

minimize TotalCost:

42*x[1,2] + 65*x[1,3] + 29*x[1,4] + 31*x[1,5] + 55*x[1,6] + 42*x[2,1]

+ 20*x[2,3] + 39*x[2,4] + 40*x[2,5] + 21*x[2,6] + 65*x[3,1] +

20*x[3,2] + 68*x[3,4] + 55*x[3,5] + 22*x[3,6] + 29*x[4,1] +39*x[4,2]

+ 68*x[4,3] + 30*x[4,5] + 39*x[4,6] + 31*x[5,1] + 40*x[5,2] +

55*x[5,3] + 30*x[5,4] + 47*x[5,6] + 55*x[6,1] + 21*x[6,2] + 22*x[6,3]

+ 39*x[6,4] + 47*x[6,5];

Page 16: 1 Lecture 26 – Problem 11-19 Page 617 Military Problem with Three Commanders Six Radar Stations Each Commander Should Be Assigned Two Radar Stations C1C2C3

16

Output – Page 8

CPLEX 8.0.0: optimal integer solution; objective 1808 MIP simplex iterations0 branch-and-bound nodesx [*,*]: 1 2 3 4 5 6 :=1 0 0 0 0 1 02 0 0 1 0 0 03 0 1 0 0 0 04 0 0 0 0 0 15 1 0 0 0 0 06 0 0 0 1 0 0;

Page 17: 1 Lecture 26 – Problem 11-19 Page 617 Military Problem with Three Commanders Six Radar Stations Each Commander Should Be Assigned Two Radar Stations C1C2C3

17

Optimal Assignment

C1 C2 C3

S1 S5 S2 S3 S4 S6

Cost = 31 M Cost = 20 M Cost = 39 M

Total Cost For This Assignment is

31+20+39 = 90 – Why did CPLEX give 180?