Professional Documents
Culture Documents
C8 Integer Programing
C8 Integer Programing
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
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
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
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
05/23/2023 15
Big M: Either-Or Constraints
■ |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
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
05/23/2023 21
Formulation of IP models
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
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.)
05/23/2023 26
Set Covering Problems
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
05/23/2023 30
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
05/23/2023 31
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
05/23/2023 33
Methods for solving IP models
Branch and Bound
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
05/23/2023 37
Solution tree
x = (1, 0, 4/5,0)
x =(1, 1, 0, 12)
05/23/2023 38
Solution tree (cont.)
x = (1, 1, 0,1/2)
x =(1, 1, 0, 1/2)
05/23/2023 39
Solving MIP by Branch-and-Bound
Algorithm.
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
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
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
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
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
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