73 220 Lecture13

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 30

Intro to Integer Programming

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

Objective function: Maximize z = 50C + 40S

Constraints:
Cloth availability: 3C + 5S < 150
Labour Availability: 10C + 4S < 200

C, S > 0 and integer

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

x(i,j) = # of vehicles to ship from plant i to warehouse j;


j=A,B,C,D
Objective Function:

Minimize z = 2,100,000y(1) + 850,000y(2) +


1,800,000y(3) + 1,100,000y(4) + 900,000y(5) +
56x(1,A) + 21x(1,B) + 32x(1,C) + 65x(1,D) + 18x(2,A)
+ 46x(2,B) + 7x(2,C) + 35x(2,D) + 12x(3,A) +
71x(3,B) + 41x(3,C) + 52x(3,D) + 30x(4,A) + 24x(4,B)
+ 61x(4,C) + 28x(4,D) + 45x(5,A) + 50x(5,B) +
26x(5,C) + 31x(5,D)
7
Formulation contd.
Constraints:
Supply: x(1,A) + x(1,B) + x(1,C) + x(1,D) < 12,000 y(1)
x(2,A) + x(2,B) + x(2,C) + x(2,D) < 18,000 y(2)
x(3,A) + x(3,B) + x(3,C) + x(3,D) < 14,000 y(3)
x(4,A) + x(4,B) + x(4,C) + x(4,D) < 10,000 y(4)
x(5,A) + x(5,B) + x(5,C) + x(5,D) < 16,000 y(5)

Demand: x(1,A) + x(2,A) + x(3,A) + x(4,A) + x(5,A) =6000


x(1,B) + x(2,B) + x(3,B) + x(4,B) + x(5,B) = 14,000
x(1,C) + x(2,C) + x(3,C) + x(4,C) + x(5,C) = 8000
x(1,D) + x(2,D) + x(3,D) + x(4,D) + x(5,D) = 10,000

x(i,j) > 0 and y(i) = 0 or 1

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

x1 x4 LHS RHS LHS=RHS? Allowed?


0 0 0 1 No No
0 1 1 1 Yes Yes
1 0 1 1 Yes Yes
1 1 2 1 No No
Match, so constraint formulation correct

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

3 Max z = 3x1 + 2x2

2 LP Optimal (2.5, 1.5)


x1 + 3x2 < 7
1

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

● From graph on next slide, see that this


point lies outside feasible region, making
solution infeasible

17
(Cont.)
● Rounded Up Solution
x2
5 -x1 + x2 < 1

3x1 + x2 < 9
4

3 Max 3x1 + 2x2


ILP Infeasible (3, 2)
2 LP Optimal (2.5, 1.5)
x1 + 3x2 < 7
1

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%)*

NOTE: Sensitivity analysis information for IPs is not


meaningful since it assumes continuous variables. To
investigate model sensitivity, must resolve model
with different values. IP problems are often EXTREMELY
sensitive to changes in certain parameters!

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

Formulate an integer programming problem that will help you


solve the problem.

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?'

'I don't remember exactly,' the woman replied, 'but I do recall


that whether I divided the eggs by 2,3,4,5 or 6 there was
always one egg left over. When I took the eggs out in groups
of seven, I emptied the basket.'

What is the least number of eggs that broke?

Solution: 301 is the least number of eggs

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?

Solution: 79 is the least number of mangos

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.

YOU LEARN DECISION ANALYSIS BY


DOING DECISION ANALYSIS!!

30

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy