73 220 Lecture13
73 220 Lecture13
73 220 Lecture13
73-220
Lecture 13
1
Agenda
● Review Last Class
– Network models
● Integer Programming
– Pure integer problems
– Mixed integer problems
– Binary variables
● Solution Methods
– LP relaxation
– Excel solver
● Next Class
2
Types of Integer Programming
Problems
● All integer (all variables are restricted to
be integer; X >= 0 & integer)
● Mixed integer (some variables are
restricted to be integer)
● Binary (all variables are restricted to be
either 0 or 1; 0 <= X <=1 & integer)
– Open new world of modeling options!
3
Pure Integer Programming
Problem
A tailor makes wool tweed sport coats and wool slacks. He
is able to get a shipment of 150 square yards of wool cloth
from Scotland each month to make coats and slacks, and he
has 200 hours of his own labour to make them each month.
A coat requires 3 square yards of wool and 10 hours to
make, and a pair of pants requires 5 square yards of wool
and 4 hours to make. He earns $50 in profit from each coat
he makes and $40 from each pair of slacks. He wants to
know how many coats and slacks to produce to maximize
profit.
4
Formulation: Pure Integer
Problem
Decision Variables: C= number of coats to make
S=number of slacks to make
Constraints:
Cloth availability: 3C + 5S < 150
Labour Availability: 10C + 4S < 200
5
Mixed Integer Problem
A company has five plants (pant 1, 2, 3, 4, and 5) that
manufacture a lightweight vehicle and four regional
distribution centers (warehouse A, B, C, and D). With the
recent declining demand for the product, the firm is
considering reducing its fixed operating costs by closing one
or more plants, even though it would incur an increase in
transportation
A costs.B The relevant
C costs
D forCapac
the problem
Fixed are
provided in the following table. The transportation
ity costs are
cost
1 vehicle
56shipped.
21 32 65 12,00 2,100,0
$ per
0 00
2 18 46 7 35 18,00 850,00
0 0
3 12 71 41 52 14,00 1,800,0
0 00
4 30 24 61 28 10,00 1,100,0
0 00
5 45 50 26 31 16,00 900,00
0 0
Deman 6,000 14,000 8,000 10,000
d
6
Formulation: Mixed Integer Problem
Decision Variables:
y(i) = 1 if plant i is open i=1,2,3,4,5
= 0 if plant i is not open
8
Integer Programming: Binary Variables
Example
Project 1 2 3 4 5
Return 17 4 13 9 10 (thousands of $)
Labor 12 14 15 6 10 30 (amt available)
Capital 130 160 90 200 150 450 (amt available)
Define logical variables:
Xj = 1 if project j is selected, and 0 if not
At most k out of n projects will be completed: Σxj < k
Exactly k out of n projects will be completed: Σxj = k
Project i conditional on project j: xi - xj < 0
Project i corequisite for project j: xj - xi = 0
Project i prerequisite for project j: xi,t-1 - xj,t > 0 ( t = 1, … , k)
Projects i & j mutually exclusive*: xi + xj < 1, or xi + xj = 1
9
Exercise
● Capital Budgeting Problem, 6 projects
1. Project 2 must be done
2. Two of projects 1, 3, 5, 6 must be undertaken
3. Projects 3 & 5 must be undertaken simultaneously
4. Projects 1 or 4, but not both, must be done
5. Project 4 requires 1 & 3 be completed
6. If projects 1 & 3 are done, 4 must be done
● Must check constraint; use 0-1 grid
10
Checking 0-1 Constraints
● 4th constraint: x1 + x4 = 1
– must have either project 1 or project 4
11
Possible IP Outcomes
● Same as LP
– Unique optimal soln
– Alternate optimal solns
– Unbounded problem
– Infeasible problem
12
Solving IP Models
● IPs are difficult to solve relative to linear
programs
● If LP solution is integer, optimal soln!
● Solution Methods
– LP Relaxation Method
– Complete Enumeration
– Computer Solution
– Branch and Bound (will not cover)
– Cutting Plane (will not cover)
13
Solution Methods: IP
● LP Relaxation
– find regular LP solution and round off (could also truncate, or
round up or down)
– solution may be far from optimal; works best for large
decision variable values
– Rounding can lead to poor solutions or even infeasible
solutions!
– For max: Z(LP) > Z(IP)
– For min: Z(LP) < Z(IP)
● Enumeration
– exhaustive check of all possible solutions
– not feasible for large problems.
14
LP Relaxation
– Max z = 3x1 + 2x2
-x1 + x2 < 1
3x1 + x2 < 9
x1 + 3x2 < 7
x1, x2 > 0 and integer
– Solve problem as a linear program ignoring integer
constraints
– optimal solution to linear program gives fractional values for
either x1 or x2, or both.
– From graph on next slide, see that optimal solution to linear
program is:
x1 = 2.5, x2 = 1.5, z = 10.5
15
Example: All-Integer LP
● LP Relaxation
x2
5 -x1 + x2 < 1
3x1 + x2 < 9
4
x1
1 2 3 4 5
6 7
16
(Cont.): Rounding Up
● If we round up fractional solution (x1 =
2.5, x2 = 1.5) to LP relaxation problem,
get x1 = 3 and x2 = 2
17
(Cont.)
● Rounded Up Solution
x2
5 -x1 + x2 < 1
3x1 + x2 < 9
4
x1
1 2 3 4 5 6 7
18
(Cont.): Round Down
● By rounding optimal solution down to x1 = 2, x2
= 1, see that solution indeed is an integer
solution within feasible region, and substituting
in objective function, gives z = 8
● Have found a feasible all-integer solution, but
have we found the OPTIMAL all-integer
solution?
● Answer is NO! Optimal solution is x1 = 3 and
x2 = 0 giving z = 9, as evidenced in next two
slides.
19
Full Enumeration
● There are 8 feasible integer solutions to
problem:
x1 x2 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
20
(Cont.)
x2
5 -x1 + x2 < 1
3x1 + x2 < 9
4
Max 3x1 + 2x2
3
2
ILP Optimal (3, 0)
x1 + 3x2 < 7
1
x1
1 2 3 4 5 6 7
21
Computer Solution
● Many practical applications involve only
binary integer variables and, hence, many
computer codes are written only for this
case (such as LINDO/PC)
● Computer codes based on a branch-and-
bound solution procedure are available
for solving integer linear programs
● Much more time consuming to solve IPs
● Excel solves IP models
22
Excel Solver & IP
● In Excel Add Constraint dialog box, select
int to restrict variables to integer; Solver
automatically sets RHS to integer
● Select bin for 0-1; still Non-negativity &
Linear Model
● Set Options > Tolerance to 0 (default 5%)*
23
Homework: Question 1
● How can we model this using integer
programming concepts?
x = 3, 6, 9, 12
24
Homework: Question 2
A food is manufactured by refining raw oils and blending them
together. The raw oils come in two categories:
•Vegetable oil:
•VEG1
•VEG2
•Non-vegetable oil:
•OIL1
•OIL2
•OIL3
The prices for buying each oil are given below (in £/ton)
VEG1 VEG2 OIL1 OIL2 OIL3
115 128 132 109 114
25
Homework: Question 2 contd.
The final product sells at £180 per ton. Vegetable oils and
non-vegetable oils require different production lines for
refining. It is not possible to refine more than 210 tons of
vegetable oils and more than 260 tons of non-vegetable oils.
There is no loss of weight in the refining process and the cost
of refining may be ignored.
There is a technical restriction relating to the hardness of the
final product. In the units in which hardness is measured this
must lie between 3.5 and 6.2. It is assumed that hardness
blends linearly and that the hardness of the raw oils is:
VEG1 VEG2 OIL1 OIL2 OIL3
8.8 6.2 1.9 4.3 5.1
26
Homework: Question 2 contd.
It is required to determine what to buy and how to blend the raw
oils so that the company maximizes its profit.
The following extra conditions are imposed on the food
manufacture problem stated above as a result of the production
process involved:
a. the food may never be made up of more than 3 raw oils
b. if an oil (vegetable or non-vegetable) is used, at least 30
tons of that oil must be used
c. if either of VEG1 or VEG2 are used then OIL2 must also
be used
27
Homework: Question 3
A woman was carrying a basket of eggs to market when a
passer-by bumped her. She dropped the basket and all the
eggs broke. The passer-by, wishing to pay for her loss, asked,
'How many eggs were in your basket?'
28
Homework: Question 4
Three men who had a monkey bought a pile of mangoes. At night one of the
men came to the pile of mangoes while the others slept and, finding that there
was just one more mango than could be exactly divided by three, tossed the
extra mango to the monkey and took away one third of the remainder. Then
he went back to sleep.
Presently another of them awoke and went to the pile of mangoes. He also
found just one too many to be divided by three so he tossed the extra one to
the monkey, took one third of the remainder, and returned to sleep.
After a while the third rose also, and he too gave one mango to the monkey
and took away the whole number of mangoes which represented precisely
one third of the rest.
Next morning the men got up and went to the pile. Again they found just one
too many, so they gave one to the monkey and divided the rest evenly. What
is the least number of mangoes with which this can be done?
29
Next Class
● Homework
– Solve the problems given in today’s notes
– Do some questions from Chapter 8
● Read Sections 8.3-4, be familiar with binary
decision variables
● Next class
– Discuss the four homework problems.
30