You are on page 1of 55

INTEGER

PROGRAMMING
(IP)
Ha Thi Xuan Chi, PhD

05/23/2023 1
Outline

■ Introduction of IP
■ Classification of IP models
■ Logical constraints transform IP constraints
■ Formulation of IP models
■ Methods for solving IP models

05/23/2023 2
Introduction

What is IP ?
■ Like an LP except that the variables are required to be integers

05/23/2023 3
Introduction
When is IP used?
■ Decision variables cannot be divided up
o assigning people to tasks
o routing trucks through a system
o products that come in whole units
■ Problems that contain a number of yes-or-no or on-or-off
decisions.
o facility location
o capital investments
o design of a production and distribution network
o airline applications

05/23/2023 4
Introduction
LP model vs IP model

Linear Program: Integer Program:


Max 3x1 + 2x2 Max 3x1 + 2x2
s.t. 3x1 + x2 < 9 s.t. 3x1 + x2 < 9
x1 + 3x2 < 7 x1 + 3x2 < 7
-x1 + x2 < 1 -x1 + x2 < 1
x1, x2 > 0 x1, x2 > 0 and integer

05/23/2023 5
Classifications of IP Models
■ Pure IP Model: Where all variables must take integer
values.
Maximize z = 3x1 + 2x2
subject to x 1 + x2 ≤ 6
x1, x2 > 0 and integer
■ Mixed IP Model: Where some variables must be integer
while others can take real values.
Maximize z = 3x1 + 2x2
subject to x 1 + x2 ≤ 6
x1, x2 > 0 and x1: integer

05/23/2023 6
Classifications of IP Models

■ 0-1 IP Model: Where all variables must take values 0


or 1 .
Maximize z = x1 - x2
subject to x1 + 2x2 ≤ 2
2 x1 - x2 ≤ 1
x1, x2 = 0 or 1

05/23/2023 7
Classifications of IP Models
(cont.)
■ LP Relaxation: The LP obtained by omitting all integer or 0-1 constraints on
variables is called the LP relaxation of IP.
■ Integer Program:
Maximize z = 21 x1 + 11x2
subject to
7 x1 + 4x2 ≤ 13
x1, x2 ≥ 0, x1 and x2 integer
■ LP Relaxation:
Maximize z = 21 x1 + 11x2
subject to
7 x1 + 4x2 ≤ 13
x1, x2 ≥ 0
■ Result: Optimal objective function value of IP ≤
05/23/2023 8
Logical constraints transform
IP constraints
■ Simple method
■ Big M method

05/23/2023 9
Simple method

{
x 𝑖 , 𝑗= 1 if 𝑖 , 𝑗 is selected
0 , otherwise

Logical constraints IP constraints


1. If i, then j. 1. xi - xj ≤ 0
2. Either i or j, but not both. 2. xi + xj = 1
3. Either i or j or both.
3. xi + xj ≥ 1
4. If i, then j is not.
4. xi + xj ≤ 1
05/23/2023 10
Simple method

Logical constraints IP constraints

5. If no i , then no j 5. −xi + xj ≤ 0
6. At most one of i,j and k 6. xi + xj + x k ≤ 1
7. At most two of items i,j 7. xi + xj + x k ≤ 2
and k
8. xi + xj + x k = 1
8. Exactly one of i,j, and k
9. At least one of items i,j 9. xi + xj + x k ≥ 1
and k

05/23/2023 11
Logical constraint (video)

05/23/2023 12
Ex: Simple method
One constraint must be met if another constraint is to be satisfied
(Williams (1977)
1. If no depot is sited here, then it will not be possible to supply any of
the customers from the depot.
2. If the library’s subscription to this journal is cancelled, then we must
retain at least one subscription to another journal in this class.
3. If we manufacture product A, we must also manufacture product B or
at least one of products C and D.
4. If this station is closed, then both branch lines terminating at the
station must also be closed.
5. No more than five of the ingredients in this class may be included in
the blend at any one time.
6. If we do not place an electronic module in this position, then no wires
can connect into this position.
05/23/2023 13
Suggested solutions

1. −xi + xj ≤ 0
2. xi + …+ xk ≥ 1
3. xA - ( xB + xC + xD )≤ 0
4. x A + xB + x C ≥ 3
5. x1 + x2 + x3 + x 4 + x 5 ≤ 5
6. −xi + xj ≤ 0

05/23/2023 14
EX: Cal Aircraft Manufacturing Company

LA factory (x1), SFO factory(x2), LA warehouse(x3),SFO warehouse (x4)


1. Build new factory in Los Angeles, San Francisco, or both.
2. Build new warehouse (only one).
3. Warehouse must be built close to city of a new factory.

What are the constraints between decisions?


1. Either build new factory in Los Angeles, San Francisco, or both:
x1 + x2 ≥1
2. No more than one warehouse: x3 + x4 = 1
3. Warehouse in LA only if Factory is in LA: x1 – x3 ≤ 0.
Warehouse in SFO only if Factory is in SFO: x2 - x4 ≤ 0

05/23/2023 15
Big M: Either-Or Constraints

At least one of two constraints f(x) ≤ b1 and g(x) ≤ b2 must be satisfied,


and impossible to satisfy both constraints simultaneously.

■ |xj −50|≥5
■ xj − 50 ≥ 5 and 50−xj ≥ 5
■ Let
■ Transform to IP:
55−xj ≤ M(1−y)
xj − 45 ≤ M y

05/23/2023 16
Big M: Either-Or Constraints
General
Transform to IP constraints:
≤ b1 + M (1 − y )
≤ b2 + My

y : binary variables
M: big positive number

05/23/2023 17
Big M: Either-Or Constraints

■ Dorian Auto is considering manufacturing three types of auto: compact,


midsize, large.
■ Resources required and profits obtained from these cars are given below.
■ We have 6,000 tons of steel and 60,000 hours of labor available.
■ If any car is produced, we must produce at least 1,000 units of that car.

Compact Midsize Large


Steel Req. 1.5 tons 3 tons 5 tons
Labor Req. 30 hours 25 hours 40 hours
Profit $2000 $3000 $4000
■ Find a production plan to maximize the profit.

05/23/2023 18
Big M: Either-Or Constraints
■ x1, x2, x3 = number of compact, midsize and large cars produced
■ y1, y2, y3 = 1 or 0 if compact , midsize and large cars are produced or
not
Maximize z = 2x1 + 3x2 + 4x3
subject to
1.5x1 + 3x2 + 5x3 ≤ 6000
30x1 + 25x2 + 40x3 ≤ 60000
x1 ≤ My1; x2 ≤ My2; x3 ≤ My3
1000 - x1 ≤ M(1-y1)
1000 - x2 ≤ M(1-y2)
1000 - x3 ≤. M(1-y3)
x1, x2, x3 >= 0 and integer; y1, y2, y3 = 0 or 1
05/23/2023 19
Big M: If and then Constraints
■ If f(x) ≤ b1 , then g(x) ≤ b2
■ Mean: if f(x) ≤ b1 is not met, there is no restriction on the
satisfaction of g(x) ≤ b2
Transform to IP:
f(x) ≤ b1 +M(1−y1)
g(x) ≤ b2 +M(1−y2)
y2 ≥ y1 , yi = 0; 1
■ If y1 = 1: (f(x) ≤ b1 : happen)
y2 =1, if-then requirement is satisfied

05/23/2023 20
Big M: If and then Constraints

If 2x1 + x2 ≤ 5, then 2x3 – x4 ≥ 2.


Transform to IP:
2x1 + x2 ≤ 5 + M(1- y1 )
2x3 – x4 ≥ 2 + M(1- y2 )
y2 ≥ y1
y1,2∈ {0, 1}
y1 = 1: 2x1 + x2 ≤ 5
y2 ≥ y1 => y2 =1 : 2x3 – x4 ≥ 2

05/23/2023 21
Formulation of IP models

■ Capital Budgeting Problem


■ Fixed Charge Problem
■ Set Covering Problems

05/23/2023 22
Capital Budgeting Problem
■ Stockco Co. is considering four investments

Investment 1 2 3 4
choice
Cash $5000 $7000 $4000 $3000
outflow
NPV $16000 $22000 $12000 $8000

■ It has $14,000 available for investment


■ Which investments should be executed to maximize the NPV?
■ IP:
Maximize z = 16x1 + 22x2 + 12x3 + 8x4
subject to
5x1 + 7x2 + 4x3 + 3x4 ≤ 14
x1, x2,x3, x4 = 0, 1

05/23/2023 23
Fixed Charge Problem
(a typical production planning problem)
■ Cloth company manufactures 3 types of clothing: shirts,
shorts, and pants
■ Machinery must be rented on a weekly basis to make each
type of clothing. Rental Cost:
– $200 per week for shirt machinery
– $150 per week for shorts machinery
– $100 per week for pants machinery

■ There are 150 hours of labor available per week and 160
square yards of cloth. Find a solution to maximize the
weekly profit
05/23/2023 24
Fixed Charge Problem (contd.)

■ x1; x2; x3 : number of shirts, shorts, pants produced


each week
■ y1; y2; y3 : 1 if shirts, shorts, pants are produced and 0
otherwise
Max. z = 6 x1 + 4 x2 + 7 x3 - 200 y1 - 150 y2 - 100 y3
subject to: 3 x1 + 2 x2 + 6 x3 ≤ 150
4 x1 + 3 x2 + 4 x3 ≤ 160
x1 ≤ M y1, x2 ≤ M y2, x3 ≤ M y3
x1, x2, x3 ≥0, and integer; y1, y2, y3 = 0 or 1
05/23/2023 25
Set Covering Problems

■ Western Airlines has decided to have hubs in USA.


■ Western runs flights between the following cities:
Atlanta, Boston, Chicago, Denver, Houston, Los Angeles, New
Orleans, New York, Pittsburgh, Salt Lake City, San Francisco, and
Seattle.
■ Western needs to have a hub within 1000 miles of each of these
cities.
■ Determine the minimum number of hubs

05/23/2023 26
Set Covering Problems

Cities within 1000 miles


Atlanta (AT) AT, CH, HO, NO, NY, PI
Boston (BO) BO, NY, PI
Chicago (CH) AT, CH, NY, NO, PI
Denver (DE) DE, SL
Houston (HO) AT, HO, NO
Los Angeles (LA) LA, SL, SF
New Orleans (NO) AT, CH, HO, NO
New York (NY) AT, BO, CH, NY, PI
Pittsburgh (PI) AT, BO, CH, NY, PI
Salt Lake City (SL) DE, LA, SL, SF, SE
San Francisco (SF) LA, SL, SF, SE
Seattle (SE) SL, SF, SE

05/23/2023 27
Set Covering Problems
■ xi = 1 if a hub is located in city i, otherwise xi = 0
Minimize: xAT + xBO + xCH + xDE + xHO + xLA + xNO + xNY + xPI + xSL
+ xSF + xSE
subject to AT BO CH DE HO LA NO NY PI SL SF SE Required
AT 1 0 1 0 1 0 1 1 1 0 0 0 xAT >= 1
BO 0 1 0 0 0 0 0 1 1 0 0 0 xBO >= 1
CH 1 0 1 0 0 0 1 1 1 0 0 0 xCH >= 1
DE 0 0 0 1 0 0 0 0 0 1 0 0 xDE >= 1
HO 1 0 0 0 1 0 1 0 0 0 0 0 xHO >= 1
LA 0 0 0 0 0 1 0 0 0 1 1 0 xLA >= 1
NO 1 0 1 0 1 0 1 0 0 0 0 0 xNO >= 1
NY 1 1 1 0 0 0 0 1 1 0 0 0 xNY >= 1
PI 1 1 1 0 0 0 0 1 1 0 0 0 xPI >= 1
SL 0 0 0 1 0 1 0 0 0 1 1 1 xSL >= 1
SF 0 0 0 0 0 1 0 0 0 1 1 1 xSF >= 1
SE 0 0 0 0 0 0 0 0 0 1 1 1 xSE >= 1

05/23/2023 28
Set Covering Problems

05/23/2023 29
Methods for solving IP models

■ Graphical method (for 2 variables)


■ Branch and Bound (for more than 2 variables)
– Binary Integer Programs (0-1)
– Pure Integer Programs
– Mixed Integer (Real) Programs

■ Cutting Planes (for more than 2 variables)

05/23/2023 30
Methods To Solve Integer Programming

Graphical method
x2

3
Z= 3x1 + 2x2

2 Optimal (2.5, 1.5)

x1
1 2 3
LP Relaxation: x1 = 2.5, x2 = 1.5, Z= 10.5
05/23/2023 31
Methods for solving IP models

x2
Graphical method

3
Z= 3x1 + 2x2

2 Optimal (2.5, 1.5)

x1
1 2 3

LP Relaxation: x1 = 2.5, x2 = 1.5, Z= 10.5


05/23/2023 32
Methods for solving IP models

x2
Graphical method
3 Z= 3x1 + 2x2

2 Infeasible solution (3, 2)

Optimal (2.5, 1.5)


1
Not optimal solution (2, 1)

x1
1 2 3

IP Relaxation: x1 = 2.5, x2 = 1.5, Z= 10.5

05/23/2023 33
Methods for solving IP models
Branch and Bound

■ DIVIDE and CONQUER.


■ From “large” problem is divided into smaller and smaller
subproblems until these subproblems can be conquered.
■ The dividing (branching) is done by partitioning the entire set of
feasible solutions into smaller and smaller subsets.
■ The conquering (fathoming) is done partially by
o giving a bound for the best solution in the subset;
o discarding the subset if the bound indicates that it can’t contain an optimal solution.

■ There are 3 steps: branching, bounding and fathoming.

05/23/2023 34
Solving BIP by Branch-and-
Bound algorithm
■ Initialization: Set Z* =-∞. Apply the bounding step, fathoming
step, and optimality test described below to the whole problem.
If not fathomed, classify this problem as the one remaining
“subproblem” for performing the first full iteration below.
■ Steps for each iteration:
1. Branching: Among the remaining (unfathomed) subproblems,
select the one that was created most recently. (Break ties according
to which has the larger bound.) Branch from the node for this
subproblem to create two new subproblems by fixing the next
variable (the branching variable) at either 0 or 1.

05/23/2023 35
Solving BIP by Branch-and-
Bound algorithm (cont.)
2. Bounding: For each new subproblem, obtain its bound by applying the
simplex method to its LP relaxation and rounding down the value of Z
for the resulting optimal solution.
3. Fathoming: For each new subproblem, apply the three fathoming tests,
and discard those subproblems that are fathomed (by testing).
o Test 1 (F1) : Its bound <= Z*, where Z* is the value of Z for the current
incumbent.
o Test 2 (F2): Its LP relaxation has no feasible solutions.
o Test 3 (F3): The optimal solution for its LP relaxation has integer values for
the integer-restricted variables. (If this solution is better than the incumbent, it
becomes the new incumbent and test 1 is reapplied to all unfathomed
subproblems with the new larger Z*.)

05/23/2023 36
Example: B&B for BIPs

Max Z = 9x1 + 5x2 + 6x3 + 4x4


Subject to:
6x1 + 3x2 + 5x3 + 2x4 ≤ 10
x3 + x4 ≤ 1
-x1 + x3 ≤ 0
-x2 + x4 ≤ 0
xi ≤ 1, xi ≥ 0, xi integer

05/23/2023 37
Solution tree

x = (1, 0, 4/5,0)

x =(1, 1, 0, 12)

05/23/2023 38
Solution tree (cont.)

Note: the resulting bounds for the subproblems are:


Bound for subproblem 3: Z≤13
Bound for subproblem 3: Z≤16
x =(0, 1, 0, 1) x = (1, 0, 4/5,0)
Incumbent,
Z*=9

x = (1, 1, 0,1/2)

x =(1, 4/5,0, 4/5)

x =(1, 1, 0, 1/2)

05/23/2023 39
Solving MIP by Branch-and-Bound
Algorithm.

■ Initialization: Set Z* =-∞. Apply the bounding step, fathoming step,


and optimality test described below to the whole problem. If not
fathomed, classify this problem as the one remaining subproblem for
performing the first full it-eration below.
■ Steps for each iteration:
1. Branching:
o Among the integer-restricted variables that have a noninteger value in
the optimal solution for the LP relaxation of the subproblem.
o Let xj be this variable and xj* its value in this solution. Branch from the
node for the subproblem to create two new subproblems by adding the
respective constraints xj≤[xj*] and xj ≥[xj*] + 1.

05/23/2023 40
Solving MIP by Branch-and-
Bound Algorithm (cont.)
2. Bounding: For each new subproblem, obtain its bound by applying the simplex
method (or the dual simplex method when reoptimizing) to its LP relaxation and using the
value of Z for the resulting optimal solution.
3. Fathoming: For each new subproblem, apply the three fathoming tests given
below,and discard those subproblems that are fathomed by any of the tests.
o Test 1 (F1) : Its bound Z*, where Z* is the value of Z for the current incumbent.
o Test 2 (F2): Its LP relaxation has no feasible solutions.
o Test 3 (F3): The optimal solution for its LP relaxation has integer values for the
integer-restricted variables. (If this solution is better than the incumbent, it becomes
the new incumbent and test 1 is reapplied to all unfathomed subproblems with the new
larger Z*.
o Optimality test: Stop when there are no remaining subproblems; the current
incumbent is optimal. Otherwise, perform another iteration.

05/23/2023 41
Example 1 for MIP

Minimize: 4x1 + 6x2


subject to 2x1 + 2x2 ≥ 5
x1 − x2 ≤ 1
x1, x2 ≥ 0 and integer.

05/23/2023 42
Solution for Example 1: MIP
x1=1.75,
x2=0.75
Z=11.5
x1≤1 x1≥2
x1=1, x1=2,
x2=1.5 x2=1
Z=13 Z=14
x2≤1 x2≥2
x1=0.5 Incumbent (F3)
infeasible x2=2
Z=14
(F2) x1≤0 x1≥1
x1=0 x1=1
x2=2.5 x2=2
Z=15 Z=16

The optimal integer solution: x1=2, x2=1, Z=14


05/23/20 43
Example 2 for MIP

Max Z = 4x1 - 2x2 + 7x3 - x4


Subject to:
x1 + 5x3 ≤ 10
x1 + x 2 - x3 ≤ 1
6x1 + 5x2 ≤ 0
-x1 + 2x3 – 2x4 ≤ 3
xi ≥ 0, xi integer x1, x2, x3,

05/23/2023 44
Example 2 for MIP (cont.)
Incumbent: x = (0,0,2,0.5)

Z*=13.5

x = (5/6,1.11/6,0)

x = (1,1.2,1.8,0)

x = (1.25,1.5,1.75,0) x = (5/6,2,11/6,0)

05/23/2023 45
Example for Pure IP

Max. z= 5x1 + 9x2


s.t. 5x1 + 11x2 ≤ 94
10x1 + 6x2 ≤ 87
x1 , x2 ≥ 0 and integer.

05/23/2023 46
x1=4.9125,
x2=6.3125
Z=81.375
 
x1≤4   x1≥5
x1=4,
x2=6.7273 x1=5,x2=6.1667
Z=80.5455 Z=80.5
   
x2≥7 x2≤6 x2≥7
x2≤6
x1=4, x2=6 x1=3.4, x2=7
Z=74 x1=5.1,x2=6 Infeasible Solution
Z=80
ZL=79.5    
   
x1≤3
x1≥4
x1≤5 x1≥6
x1=3,x2=7.1818
Z=79.6364 Infeasible
  Solution x1=5,x2=6 x1=6,x2=4.5

x2≤7 x2≥8  
Z=79   Z=70.5  

x1=3,x2=7 x1=1.2,
Z=78 05/23/20 x2=8 The optimal
23
  x1≤1 Z=78 x1≥2 integer solution
 
Infeasible
x1=1, Solution 47
x2=8.0909  
Z=77.8182 
x1=4.9125
x2=6.3125
x2≤6 Z=81.375 x2 ≥ 7

x1=5.1 x1=3.4
x2=6 x2=7
Z=79.5 Z=80
x1≤5 x1≥6 x1≤3 x1 ≥ 4

x1=5 x1=6 y1=3


No feasible
x2=6 x2=4.5 x2=7.1818
solution
Z=79 Z=70.5 Z=79.6364

x2≤7 x2 ≥ 8
x1=3 x1=1.2
x2=7 x2=8
Z=78 x1≤1 Z=78
x1≥2
x1=1,
x2=8.0909 No feasible
Z=77.8182 solution

05/23/20 48
Additional Applications

■ Location of fire stations needed to cover all cities


■ Location of fire stations to cover all regions
■ Truck dispatching problem
■ Political redistricting
■ Capital investments

05/23/2023 49
Applications of Binary
Variables
■ Making “yes-or-no” type decisions
– Build a factory?
– Manufacture a product?
– Do a project?
– Assign a person to a task?
■ Logical constraints
– Alternative constraints
– Conditional constraints

05/23/2023 50
Applications of Binary
Variables
■ Representing non-linear functions
– Fixed Charge Problem
■ If a product is produced, must incur a fixed setup cost.
■ If a warehouse is operated, must incur a fixed cost.
– Piecewise linear representation
– Diseconomies of scale
– Approximation of nonlinear functions
■ Set-covering, and set partitioning
– Make a set of assignments that “cover” a set of requirements.
– Partition a set into subsets meeting given requirements

05/23/2023 51
Some Other Applications
■ Investment Analysis
– Should we make a certain fixed investment?
– Examples: Turkish Petroleum Refineries (1990), South African National
Defense Force (1997), Grantham, Mayo, Van Otterloo and Company (1999)
■ Site Selection
– Should a certain site be selected for the location of a new facility?
– Example: AT&T (1990)
■ Designing a Production and Distribution Network
– Should a certain plant remain open? Should a certain site be selected for a
new plant? Should a distribution center remain open? Should a certain site
be selected for a new distribution center? Should a certain distribution center
be assigned to serve a certain market area?
– Examples: Ault Foods (1994), Digital Equipment Corporation (1995)

05/23/2023 52
Some Other Applications
■ Dispatching Shipments
– Should a certain route be selected for a truck? Should a certain size truck be
used? Should a certain time period for departure be used?
– Examples: Quality Stores (1987), Air Products and Chemicals, Inc. (1983),
Reynolds Metals Co. (1991), Sears, Roebuck and Company (1999)
■ Scheduling Interrelated Activities
– Should a certain activity begin in a certain time period?
– Examples: Texas Stadium (1983), China (1995)
■ Scheduling Asset Divestitures
– Should a certain asset be sold in a certain time period?
– Example: Homart Development (1987)
■ Airline Applications:
– Should a certain type of airplane be assigned to a certain flight leg? Should a
certain sequence of flight legs be assigned to a crew?
– Examples: American Airlines (1989, 1991), Air New Zealand (2001)

05/23/2023 53
Special Kinds of Integer
Programming Models
■ Knapsack Problem
■ Set Covering Problem
■ Set Partitioning Problem
■ Set Packing Problem
■ The Traveling Salesman Problem
■ The Quadratic Assignment Problem

05/23/2023 54
Homework

■ 12.12a
■ 12.1-3a
■ 12.1-4
■ 12.3-5
■ 12.5-1
■ 12.7.7
■ 12.7-10

05/23/2023 55

You might also like