Integer Programming (Ip) : Ha Thi Xuan Chi, PHD
Integer Programming (Ip) : Ha Thi Xuan Chi, PHD
PROGRAMMING
(IP)
Ha Thi Xuan Chi, PhD
07/29/2021 1
Outline
■ Introduction of IP
■ Classification of IP models
■ Logical constraints transform IP constraints
■ Formulation of IP models
■ Methods for solving IP models
07/29/2021 2
Introduction
What is IP ?
■ Like an LP except that the variables are required to be integers
07/29/2021 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
07/29/2021 4
Introduction
LP model vs IP model
07/29/2021 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
07/29/2021 6
Classifications of IP Models
07/29/2021 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 ≤
07/29/2021 8
Logical constraints transform
IP constraints
■ Simple method
■ Big M method
07/29/2021 9
Simple method
x = 1 if 𝑖 , 𝑗 is selected
𝑖, 𝑗 { 0 , otherwise
07/29/2021 10
Simple method
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
07/29/2021 11
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.
07/29/2021 12
EX: Cal Aircraft Manufacturing Company
07/29/2021 13
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
07/29/2021 14
Big M: Either-Or Constraints
■
General
Transform to IP constraints:
≤ b1 + M (1 − y )
≤ b2 + My
y : binary variables
M: big positive number
07/29/2021 15
Big M: Either-Or Constraints
07/29/2021 16
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
07/29/2021 17
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
07/29/2021 18
Big M: If and then Constraints
07/29/2021 19
Formulation of IP models
07/29/2021 20
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
07/29/2021 21
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 Labor hr Cloth yd Var. cost Price
Shirts 3 4 $6 $12
Shorts 2 3 $4 $8
Pants 6 4 $8 $15
■ There are 150 hours of labor available per week and 160
square yards of cloth. Find a solution to maximize the
weekly profit
07/29/2021 22
Fixed Charge Problem (contd.)
07/29/2021 24
Set Covering Problems
07/29/2021 25
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
07/29/2021 26
Set Covering Problems
07/29/2021 27
Methods for solving IP models
07/29/2021 28
Methods To Solve Integer Programming
Graphical method
x2
3
Z= 3x1 + 2x2
x1
1 2 3
LP Relaxation: x1 = 2.5, x2 = 1.5, Z= 10.5
07/29/2021 29
Methods for solving IP models
x2
Graphical method
3
Z= 3x1 + 2x2
x1
1 2 3
x2
Graphical method
3 Z= 3x1 + 2x2
x1
1 2 3
07/29/2021 31
Methods for solving IP models
Branch and Bound
07/29/2021 32
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.
07/29/2021 33
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*.)
07/29/2021 34
Example: B&B for BIPs
07/29/2021 35
Solution tree
x = (1, 0, 4/5,0)
x =(1, 1, 0, 12)
07/29/2021 36
Solution tree (cont.)
x = (1, 1, 0,1/2)
x =(1, 1, 0, 1/2)
07/29/2021 37
Solving MIP by Branch-and-Bound
Algorithm.
07/29/2021 38
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.
07/29/2021 39
Example 1 for MIP
07/29/2021 40
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
07/29/2021 42
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)
07/29/2021 43
Example for Pure IP
07/29/2021 44
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 07/29/20 x2=8 The optimal
21
x1≤1 Z=78 x1≥2 integer solution
Infeasible
x1=1, Solution 45
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
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
07/29/20 46
Additional Applications
07/29/2021 47
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
07/29/2021 48
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
07/29/2021 49
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)
07/29/2021 50
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)
07/29/2021 51
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
07/29/2021 52
Homework
■ 12.12a
■ 12.1-3a
■ 12.1-4
■ 12.3-5
■ 12.5-1
■ 12.7.7
■ 12.7-10
07/29/2021 53