# CSCI 573 Linear and Mixed Integer Programming Sven Koenig.

## Presentation on theme: "CSCI 573 Linear and Mixed Integer Programming Sven Koenig."— Presentation transcript:

CSCI 573 Linear and Mixed Integer Programming Sven Koenig

Linear Programming (LP) A cement manufacturer produces two types of cement: A and B. They cannot make more than 1600 kilograms a day due to a shortage of transport vehicles. A sales contract forces them to produce at least 500 kilograms of cement B per day. It takes 0.48 (0.24) minutes to make a kilogram of cement A (B) and the plant operates 8 hours a day. The profit is \$4 (\$3) per kilogram of cement A (B). How many kilograms of cement A and B should they make to maximize their profit?

Linear Programming (LP) A = produced kg’s of cement A per day B = produced kg’s of cement B per day Maximize 4 A + 3 B Subject to A + B ≤ 1600 A + B ≤ 1600 B ≥ 500 B ≥ 500 0.48 A + 0.24 B ≤ 480 0.48 A + 0.24 B ≤ 480 A ≥ 0, B ≥ 0 A ≥ 0, B ≥ 0

Almost Linear Programming (LP) A cement manufacturer produces two types of cement: A and B. They cannot make more than 1600 bags a day due to a shortage of transport vehicles. A sales contract forces them to produce at least 500 bags of cement B per day. It takes 0.48 (0.24) minutes to make a bag of cement A (B) and the plant operates 8 hours a day. The profit is \$4 (\$3) per bag of cement A (B). How many bags of cement A and B should they make to maximize their profit?

Appendix Linear Programming (LP) A manufacturer produces animal feed with 2 active ingredients and a filler ingredient. One kg of feed mix must contain 90g of nutrient A, 50g of nutrient B, 20g of nutrient C and 2g of nutrient D. The ingredients have the following nutrient values and costs. What should be the amount of ingredients in one kg of feed mix to minimize cost? (The filler ingredient costs nothing.) ABCD\$/kg Active Ingredient 1 (g/kg) 10080401040 Active Ingredient 2 (g/kg) 20015020---60

Appendix Linear Programming (LP) A = kg of ingredient 1 per kg of feed mix B = kg of ingredient 2 per kg of feed mix Minimize 40 A + 60 B Subject to A + B ≤ 1 A + B ≤ 1 100 A + 200 B ≥ 90 100 A + 200 B ≥ 90 80 A + 150 B ≥ 50 80 A + 150 B ≥ 50 40 A + 20 B ≥ 20 40 A + 20 B ≥ 20 10 A ≥ 2 10 A ≥ 2 A ≥ 0, B ≥ 0 A ≥ 0, B ≥ 0

Appendix Linear Programming (LP) Exact solution: A = 0.3667 B = 0.2667 Feasible region (all of these points satisfy the constraints) Solution (a point in the feasible region that minimizes the objective function)

Appendix Linear Programming (LP) LPs can be solved in polynomial time. In practice, one often uses variants of the simplex method (which is not guaranteed to run in polynomial time but often runs very fast).

Appendix Mixed Integer Programming (MIP) What if there is a fixed cost of \$15 if any of active ingredient 2 is used?

Appendix Mixed Integer Programming (MIP) A = kg of ingredient 1 per kg of feed mix B = kg of ingredient 2 per kg of feed mix X = 1 if B > 0, 0 otherwise Minimize 40 A + 60 B + 15 X Subject to A + B ≤ 1 A + B ≤ 1 100 A + 200 B ≥ 90 100 A + 200 B ≥ 90 80 A + 150 B ≥ 5 80 A + 150 B ≥ 5 40 A + 20 B ≥ 20 40 A + 20 B ≥ 20 10 A ≥ 2 10 A ≥ 2 B ≤ X B ≤ X A ≥ 0, B ≥ 0, X ≥ 0 A ≥ 0, B ≥ 0, X ≥ 0 X is integer X is integer

Appendix Mixed Integer Programming (MIP) What if they need to satisfy only three of the four nutrient constraints?

Appendix Mixed Integer Programming (MIP) A = kg of ingredient 1 per kg of feed mix B = kg of ingredient 2 per kg of feed mix X1 = 1 if constraint 1 is satisfied, 0 otherwise X2 = … Minimize 40 A + 60 B + 15 X Subject to A + B ≤ 1 A + B ≤ 1 100 A + 200 B ≥ 90 X1 100 A + 200 B ≥ 90 X1 80 A + 150 B ≥ 5 X2 80 A + 150 B ≥ 5 X2 40 A + 20 B ≥ 20 X3 40 A + 20 B ≥ 20 X3 10 A ≥ 2 X4 10 A ≥ 2 X4 X1 + X2 + X3 + X4 ≥ 3 X1 + X2 + X3 + X4 ≥ 3 A ≥ 0, B ≥ 0, 1 ≥ X1 ≥ 0, 1 ≥ X2 ≥ 0, 1 ≥ X3 ≥ 0, 1 ≥ X4 ≥ 0 A ≥ 0, B ≥ 0, 1 ≥ X1 ≥ 0, 1 ≥ X2 ≥ 0, 1 ≥ X3 ≥ 0, 1 ≥ X4 ≥ 0 X1, X2, X3 and X4 are integer X1, X2, X3 and X4 are integer

Appendix Mixed Integer Programming (MIP) MIPs can likely not be solved in polynomial time (solving them is NP-hard). Viewing MIPs as LPs and rounding variables to the closest integer can result in large errors. In practice, one often uses CPLEX, industrial-strength software that can solve LPs and MIPs.

Appendix Source for LP and MIP Material This problem and many more examples can be found in the OR Notes by J. E. Beasly at people.brunel.ac.uk/~mastjjb/jeb/or/contents.html

An AI Problem Assume that there are N robots in the plane at initial locations R1, …, RN. There are M target locations T1, …, TM in the same plane. Each target has to be visited by at least one robot. The robots do not need to return to their initial locations. Write a mixed integer program that determines which robot should visit which target locations and in which order if the team objective is to minimize the sum of the travel distances of all robots.

An AI Problem Multi-robot routing problems can be solved optimally with Mixed Integer Programming (MIP) methods, such as CPLEX: Index sets and constants: V R = Set of robot vertices V T = Set of target vertices c(i,j) = Path cost from vertex i to vertex j Variables: x ij = Is vertex j visited by some robot directly after vertex i? (1 = yes, 0 = no)

An AI Problem Multi-robot routing problems can be solved optimally with Mixed Integer Programming (MIP) methods, such as CPLEX: (C1) (C2) (C3)

An AI Problem Multi-robot routing problems can be solved optimally with Mixed Integer Programming (MIP) methods, such as CPLEX: (C1) Each target vertex is entered exactly once (C2) Each (robot or target) vertex is left at most once (C3) There are no subtours (= cycles)

An AI Problem Objective only

An AI Problem Objective and constraint C1 only (a possible solution, not necessarily the optimal one)

An AI Problem Objective and constraints C1 and C2 only (a possible solution, not necessarily the optimal one)

An AI Problem Objective and constraints C1, C2 and C3 (a possible solution, not necessarily the optimal one)

An AI Problem The number of subtour elimination constraints (C3) is exponential in the number of targets. Only small multi-robot routing problems can be solved optimally with MIP methods, even after tuning them (for example, by using cutting plane techniques).

An AI Problem See page 5 of “Simple Auctions with Performance Guarantees for Multi-Robot Task Allocation” by Lagoudakis et al. (IROS 2004) idm-lab.org/bib/abstracts/Koen04i.html