Integer Programming
Types of Integer Programming
Models
An LP in which all the variables are restricted to be
integers is called an all-integer linear program
(ILP).
The LP that results from dropping the integer
requirements is called the LP Relaxation of the ILP.
If only a subset of the variables are restricted to be
integers, the problem is called a mixed-integer
linear program (MILP).
Binary variables are variables whose values are
restricted to be 0 or 1. If all variables are
restricted to be 0 or 1, the problem is called a 0-1
or binary integer linear program.
Example: All-Integer LP
Consider the following all-integer linear program:
Max 3x1 + 2x2
s.t.
3x1 + x2 < 9
x1 + 3x2 < 7
-x1 + x2 < 1
x1, x2 > 0 and integer
Example: All-Integer LP
Solving the problem as a linear program
ignoring the integer constraints, the optimal
solution to the linear program gives fractional
values for both x1 and x2. From the graph on the
next slide, we see that the optimal solution to the
linear program is:
x1 = 2.5, x2 = 1.5, z = 10.5
Example: All-Integer LP
x2
5
-x1 + x2 < 1
3x1 + x2 < 9
Max 3x1 + 2x2
LP Optimal (2.5, 1.5)
x1 + 3x2 < 7
x1
Example: All-Integer LP
If we round up the fractional solution (x1 =
2.5, x2 = 1.5) to the LP relaxation problem, we get
x1 = 3 and x2 = 2. From the graph on the next slide,
we see that this point lies outside the feasible
region, making this solution infeasible.
Example: All-Integer LP
x2
Rounded Up5Solution
-x1 + x2 < 1
3x1 + x2 < 9
Max 3x1 + 2x2
ILP Infeasible (3, 2)
LP Optimal (2.5, 1.5)
x1 + 3x2 < 7
x1
Example: All-Integer LP
Rounding Down
By rounding the optimal solution down to x1 =
2, x2 = 1, we see that this solution indeed is an
integer solution within the feasible region, and
substituting in the objective function, it gives z = 8.
We have found a feasible all-integer solution,
but have we found the OPTIMAL all-integer
solution?
The answer is NO! The optimal solution is x1
= 3 and x2 = 0 giving z = 9, as evidenced in the next
two slides.
Example: All-Integer LP
Complete Enumeration of Feasible ILP Solutions
There are eight feasible integer solutions to this
problem:
x1 x 2 z
1. 0
0
0
2. 1
0
3
3. 2
0
6
4. 3
0
9
optimal solution
5. 0
1
2
6. 1
1
5
7. 2
1
8
8. 1
2
7
Example: All-Integer LP
x2
5
-x1 + x2 < 1
3x1 + x2 < 9
Max 3x1 + 2x2
ILP Optimal (3, 0)
x1 + 3x2 < 7
1
x1
Example: Metropolitan Microwaves
Metropolitan Microwaves, Inc. is planning to
expand its operations into other electronic
appliances. The company has identified seven new
product lines it can carry. Relevant information
about each line follows on the next slide.
Example: Metropolitan Microwaves
Product Line
1.
2.
3.
4.
5.
6.
7.
Black & White TVs
Color TVs
Large Screen TVs
VHS VCRs
Beta VCRs
Video Games
Home Computers
Initial Floor Space Exp. Rate
Invest. (Sq.Ft.)
of Return
$ 6,000
12,000
20,000
14,000
15,000
2,000
32,000
125
150
200
40
40
20
100
8.1%
9.0
11.0
10.2
10.5
14.1
13.2
Example: Metropolitan Microwaves
Metropolitan has decided that they should not stock large screen
TVs unless they stock either B&W or color TVs. Also, they will not
stock both types of VCRs, and they will stock video games if they
stock color TVs. Finally, the company wishes to introduce at least
three new product lines.
If the company has $45,000 to invest and 420 sq. ft. of floor
space available, formulate an integer linear program for Metropolitan
to maximize its overall expected rate of return.
Example: Metropolitan Microwaves
Define the Decision Variables
xj = 1 if product line j is introduced;
= 0 otherwise.
Define the Objective Function
Maximize total overall expected return:
Max .081(6000)x1 + .09(12000)x2 + .11(20000)x3
+ .102(14000)x4 + .105(15000)x5 + .141(2000)x6
+ .132(32000)x7
Example: Metropolitan Microwaves
Define the Constraints
1) Money:
6x1 + 12x2 + 20x3 + 14x4 + 15x5 + 2x6 + 32x7 < 45
2) Space:
125x1 +150x2 +200x3 +40x4 +40x5 +20x6 +100x7
< 420
3) Stock large screen TVs only if stock B&W or
color:
x1 + x2 > x3 or x1 + x2 - x3 > 0
Example: Metropolitan Microwaves
Define the Constraints (continued)
4) Do not stock both types of VCRs:
x4 + x5 < 1
5) Stock video games if they stock color TV's:
x2 - x6 > 0
6) At least 3 new lines:
x1 + x2 + x3 + x4 + x5 + x6 + x 7 > 3
7) Variables are 0 or 1:
xj = 0 or 1 for j = 1, , , 7
Example: Toms Tailoring
Tom's Tailoring has five idle tailors and four custom garments to make.
The estimated time (in hours) it would take each tailor to make each
garment is shown in the next slide. (An 'X' in the table indicates an
unacceptable tailor-garment assignment.)
Garment
Wedding gown
Clown costume
Admiral's uniform
Bullfighter's outfit
Tailor
1 2
19 23
11 14
12 8
X 20
3
20
X
11
20
4
21
12
X
18
5
18
10
9
21
Example: Toms Tailoring
Formulate an integer program for determining the tailor-garment
assignments that minimize the total estimated time spent making the
four garments. No tailor is to be assigned more than one garment
and each garment is to be worked on by only one tailor.
-------------------This problem can be formulated as a 0-1 integer program. The LP
solution to this problem will automatically be integer (0-1).
Example: Toms Tailoring
Define the decision variables
xij = 1 if garment i is assigned to tailor j
= 0 otherwise.
Number of decision variables =
[(number of garments)(number of tailors)]
- (number of unacceptable assignments)
= [4(5)] - 3 = 17
Example: Toms Tailoring
Define the objective function
Minimize total time spent making garments:
Min 19x11 + 23x12 + 20x13 + 21x14 + 18x15 + 11x21
+ 14x22 + 12x24 + 10x25 + 12x31 + 8x32 + 11x33
+ 9x35 + 20x42 + 20x43 + 18x44 + 21x45
Example: Toms Tailoring
Define the Constraints
Exactly one tailor per garment:
1) x11 + x12 + x13 + x14 + x15 = 1
2) x21 + x22 + x24 + x25 = 1
3) x31 + x32 + x33 + x35 = 1
4) x42 + x43 + x44 + x45 = 1
Example: Toms Tailoring
Define the Constraints (continued)
No more than one garment per tailor:
5) x11 + x21 + x31 < 1
6) x12 + x22 + x32 + x42 < 1
7) x13 + x33 + x43 < 1
8) x14 + x24 + x44 < 1
9) x15 + x25 + x35 + x45 < 1
Nonnegativity: xij > 0 for i = 1, . . ,4 and j = 1, . . ,5
Classic Knapsack Problem
You want to maximize the value of items you can pack into a single
suitcase (or knapsack). However, you are limited to a weight of 50
lbs.
Item
Value ($)
Weight (lbs)
15
18
20
10
18
21
13
11
12
11
23
Classic Knapsack Problem
Solving the problem:
--- Without Integer constraints
--- With Integer constraints
What is the difference in solution?
Additional constraints (Integer Problem version):
--- could not select item A without selecting item D
--- you could select at most 3 items
24
Stockco is considering four investments. Investment 1 will yield a net
present value (NPV) of $16,000; investment 2, an NPV of $22,000;
investment 3, an NPV of $12,000; and investment 4, an NPV of $8,000.
Each investment requires a certain cash outflow at the present time:
investment 1, $5,000; investment 2, $7,000; investment 3, $4,000; and
investment 4, $3,000. Currently, $14,000 is available for investment.
Formulate an IP whose solution will tell Stockco how to maximize the NPV
obtained from investments 14. Modify the Stockco formulation to account
for each of the following requirements:
Stockco can invest in at most two investments.
If Stockco invests in investment 2, they must also invest in investment 1.
If Stockco invests in investment 2, they cannot invest in investment 4.
Special 0-1 Constraints
When xi and xj represent binary variables designating whether
projects i and j have been completed, the following special
constraints may be formulated:
At most k out of n projects will be completed:
xj < k
Project j is conditional on project i:
xj - xi < 0
Project i is a corequisite for project j:
xj - xi = 0
Projects i and j are mutually exclusive:
xi + xj < 1
Facility Location Problems
There are six cities (cities 16) in Kilroy County. The county must determine
where to build fire stations. The county wants to build the minimum number of
fire stations needed to ensure that at least one fire station is within 15 minutes
(driving time) of each city. The times (in minutes) required to drive between the
cities in Kilroy County are shown in Table below. Formulate an IP that will tell
Kilroy how many fire stations should be built and where they should be located.