100 likes | 195 Views
1. 2. 3. 4. 5. 6. Lecture 23 – HW #9. Discrete Optimization Models Problem 11-9 on page 615 Cameras can be placed at intersections to monitor bad drivers. 65. 40. 43. 48. 72. 36. Objective.
E N D
1 2 3 4 5 6 Lecture 23 – HW #9 • Discrete Optimization Models • Problem 11-9 on page 615 • Cameras can be placed at intersections to monitor bad drivers 65 40 43 48 72 36
Objective • Determine the nodes to place cameras so that every link (road) is monitored and the cost for installation is minimized.
Part A. The AMPL Model • # Problem 9-11 on page 615 • var x1 binary; # x1 = 1 if camera is placed at 1 • # x1 = 0; otherwise • var x2 binary; var x3 binary; var x4 binary; • var x5 binary; var x6 binary; • minimize CostToCover: 40*x1 + 65*x2 + 43*x3 + 48*x4 + 72*x5 +36*x6; • subject to Link1To2: x1 + x2 >= 1; • subject to Link1To4: x1 + x4 >= 1; • subject to Link2To3: x2 + x3 >= 1; • subject to Link2To5: x2 + x5 >= 1; • subject to Link3To5: x3 + x5 >= 1; • subject to Link3To6: x3 + x6 >= 1; • subject to Link4To5: x4 + x5 >= 1; • subject to Link5To6: x5 + x6 >= 1; • solve; • display x1, x2, x3, x4, x5, x6;
Output For Part B • AMPL Version 20020516 Win32 • ampl: model a:A.txt; • CPLEX 8.0.0: optimal integer solution; objective 155 • 3 MIP simplex iterations • 0 branch-and-bound nodes • x1 = 1 • x2 = 0 • x3 = 1 • x4 = 0 • x5 = 1 • x6 = 0 • ampl:
Optimal Solution Part A • Optimal Cost = 155 1 2 3 4 5 6
Part C. • The city is experiencing a severe budget deficit. • We seek to minimize the number of uncovered roads while using at most 2 cameras. • New variables and constraints: • y12 binary; • # y12 = 1 if link (1,2) is uncovered; = 0 otherwise • Constraint: x1 + x2 + y12 > 1
Part C. AMPL Model • # Problem 9-11 on page 615 • var x1 binary; # x1 = 1 if camera is placed at 1 • # x1 = 0; otherwise • var x2 binary; var x3 binary; var x4 binary; • var x5 binary; var x6 binary; • var y12 binary; # y12 = 1 if link (1,2) is not covered • # y12 = 0 if link (1,2) is covered • var y14 binary; • var y23 binary; • var y25 binary; • var y35 binary; • var y36 binary; • var y45 binary; • var y56 binary;
Part C. Model Continued • minimize UnCoveredLinks: • y12 + y14 + y23 + y25 + y35 + y36 + y45 + y56; • subject to Link1To2: x1 + x2 + y12 >= 1; • subject to Link1To4: x1 + x4 + y14 >= 1; • subject to Link2To3: x2 + x3 + y23 >= 1; • subject to Link2To5: x2 + x5 + y25 >= 1; • subject to Link3To5: x3 + x5 + y35 >= 1; • subject to Link3To6: x3 + x6 + y36 >= 1; • subject to Link4To5: x4 + x5 + y45 >= 1; • subject to Link5To6: x5 + x6 + y56 >= 1; • subject to MaxOf2Cameras: x1 + x2 + x3 + x4 + x5 + x6 <= 2; • solve; • display x1, x2, x3, x4, x5, x6; • display y12, y14, y23, y25, y35, y36, y45, y56;
Part C. Output • AMPL Version 20020516 Win32 • ampl: model a:C.txt; • CPLEX 8.0.0: optimal integer solution; objective 2 • 10 MIP simplex iterations • 0 branch-and-bound nodes • x1 = 0 x2 = 0 x3 = 1 • x4 = 0 x5 = 1 x6 = 0 • y12 = 1 y14 = 1 y23 = 0 • y25 = 0 y35 = 0 y36 = 0 • y45 = 0 y56 = 0
Optimal Solution Part A • Optimal Cost = 155 1 2 3 4 5 6