Operations Research Ch02
Operations Research Ch02
Operations Research Ch02
of SEEM, CUHK
Chapter 2
Integer Programming
2.1. Introduction
In many practical applications, some decision variables actually
make sense only if they have integer values.
For example, it is often necessary to assign people, machines, and
vehicles to activities in integer quantities.
Integer programming (IP) problems /
integer linear programming (ILP) problems /
linear integer programming (LIP) problems
are linear programming (LP) problems in which some or all the
decision variables are restricted to integer (or discrete) values.
xj =
1, if decision j is yes,
0, if decision j is no.
Task
c11 = 1
s1 = 1
Machine 1
c14 = 3
s2 = 1
c12 = 4
Job 1
d1 = 1
Job 2
d2 = 1
Job 3
d3 = 1
Job 4
d4 = 1
c13 = 6
c21 = 9
c22 = 7
Machine 2
c23 = 10
c24 = 9
c31 = 4
s3 = 1
Machine 3
c33 = 11
c34 = 7
c41 = 8
s4 = 1
c32 = 5
Machine 4
c42 = 7
c43 = 8
c44 = 5
s1 + s2 + s3 + s4 = 4
d1 + d2 + d3 + d4 = 4
xij =
(Cost)
(Machine
(Machine
(Machine
(Machine
(Job 1)
(Job 2)
(Job 3)
(Job 4)
1)
2)
3)
4)
Destination
c11 = 10
s1 = 15
d1 = 5
Shop 2
d2 = 15
Shop 3
d3 = 15
Shop 4
d4 = 15
c12 = 2
Factory 1
c14 = 11
s2 = 25
Shop 1
c13 = 20
c21 = 12
c22 = 7
Factory 2
c23 = 9
c24 = 20
c31 = 4
c32 = 14
s3 = 10
Factory 3
c33 = 16
c34 = 18
s1 + s2 + s3 = 50
d1 + d2 + d3 + d4 = 50
10
10
1
0
3
11
12
2.2.2. Approximation
Some IP problems with general integer variables can be approximated by LP problems.
Example 2.4. IP Problem:
Maximize z =
subject to
5x1 + 4x2
x1 + x2 5
10x1 + 6x2 45
x1 0, x2 0
x1, x2 integers.
13
5x1 + 4x2
x1 + x2 5
10x1 + 6x2 45
x1 0, x2 0.
14
x2 Feasible? z
1
Yes
19
2
Yes
23 *
1
No
2
No
15
However, the solutions of many IP problems cannot be approximated by the solutions of the corresponding LP relaxation problems.
1. Integrality conditions cannot be ignored for IP problems with
binary variables because binary variables are used to model logical conditions.
Example 2.5.
x1 =
16
x2
x2 0.5
x2 3.5
x2 0.
17
18
3. There is no guarantee that the rounded solution will be the optimal integer solution. In fact, it may even be far from optimal.
Example 2.7. IP Problem:
Maximize z = 3x1 + 10x2
subject to
2x1 + 7x2 14
x1
6
x1 0, x2 0
x1, x2 integers.
LP Relaxation Problem:
Maximize z = 3x1 + 10x2
subject to
2x1 + 7x2 14
x1
6
x1 0, x2 0.
19
20
21
x2
x1
22
23
24
Example 2.9.
Assume that there is a 1000-core 10 GHz computer system.
Assume that each core of this system can calculate and compare
the objective function values of 1010 integer points in 1 second.
Then, this computer solve a BIP problem with only 80 variables in
about 3830 years by exhaustive enumeration.
n Number of solutions Time required
40
240
0.11 seconds
50
250
1.88 minutes
60
260
1.33 days
70
270
3.74 years
80
280
3830.85 years
yj =
1,
0,
if decision j is yes,
if decision j is no.
25
26
Project 1
Project 2
Project 3
Project 4
Project 5
Available funds
Expenditures (M$)/year
Expected
Year 1 Year 2 Year 3 Returns (M$)
5
1
8
20
4
7
10
40
3
9
2
20
7
4
1
15
8
6
10
30
(M$)
25
25
25
27
Solution
Let z = total expected returns (million dollars).
For j = 1, 2, 3, 4, 5, let
yj =
1,
0,
if project j is selected,
if project j is not selected.
+ 15y4 + 30y5
+ 7y4 + 8y5 25
+ 4y4 + 6y5 25
+ y4 + 10y5 25
28
j=1
yj K.
Street A
29
Street B
Street
I
Street
G
Street
F
Street
K
Street C
Street
H
Street D
Street E
6
Street
J
Solution
Let z = number of telephones to be installed.
For j = 1, 2, . . . , 8, let
yj =
1,
0,
30
31
j=1
yj = K.
j=1
yj K.
32
33
Decision
Number
1
2
3
4
(M = million)
Yes-or-No
Decision
Capital
Question
Variable NPV Required
Build factory in LA?
y1
$9M $6M
Build factory in SF?
y2
$5M $3M
Build warehouse in LA?
y3
$6M $5M
Build warehouse in SF?
y4
$4M $2M
Capital available: $10M
34
Solution
Let z = total net present value ($).
For j = 1, 2, 3, 4, let
yj =
1,
0,
if decision j is yes,
if decision j is no.
35
36
...
is equivalent to
i=1
N
X
i=1
biyi
yi = 1
yi binary, for i = 1, 2, . . . , N.
or
bN
37
38
39
Solution
Let z = total profit (thousand dollars)
Let xj = number of product j produced per week (j = 1, 2)
Let
1,
0,
1,
y2 =
0,
1,
y3 =
0,
y1 =
40
4
12
= 0
= 1
f (x) =
k + cx, if x > 0,
0,
if x = 0,
41
42
IP Formulation
Let M be a positive number such that M x, for all feasible x, and
let
y=
1, if x > 0,
0, if x = 0.
= ky + cx
My
0
binary.
43
Note:
In practice, some care is taken to choose a value of M that definitely
is large enough to avoid eliminating any feasible solution, but as small
as possible otherwise in order to avoid unduly enlarging the feasible
region for the LP-relaxation and to avoid numerical instability.
44
Solution
Let z = total cost ($ per month).
For j = 1, 2, 3, let
xj = company
j long-distance minutes per month
1, if x > 0,
j
yj =
0, if x = 0.
j
Let Mj 200 be a constant (j = 1, 2, 3).
45
46
47
IP Formulation
Let M be a positive number such that
g (x , x , . . . , x ) b + M
2 1 2
n
2
for all feasible solutions (x1, x2, . . . , xn).
Then, the problem can be reformulated as follows:
y binary.
48
49
Solution
Let z = total profit (thousand dollars).
Let xj = number of product j produced (j = 1, 2, 3).
Let M1 2000, M2 2000 and M3 1200 be constants.
50
51
52
IP Formulation
Let M be a positive number such that
g (x , x , . . . , x ) b
N 1 2
n
N +M
for all feasible solution (x1, x2, . . . , xn).
53
N
X
i=1
yi = K
yi binary, for i = 1, 2, . . . , N .
54
55
IP Formulation
Let M be a positive number such that
g(x1, x2, . . . , xn ) M
h(x1, x2, . . . , xn ) M
y binary.
56
y1 + y2 + y3 + y4 M y
y5 M (1 y)
y binary
57
x=
N
X
i=0
2i yi
yi binary, for i = 0, 1, 2, . . . , N
58
Example 2.17.
Use the binary representation for integer variables to reformulate the
following PIP problem as BIP problem.
Max z = 3x1 + 4x2
s.t.
x1
5
2x1 + 3x2 30
x1 0, x2 0
x1, x2 are integers.
59
Solution
Since 0 x1 5 and 22 5 < 22+1, we let
x1 = y0 + 2y1 + 4y2 .
Since 0 x2 10 and 23 10 < 23+1, we let
x2 = y3 + 2y4 + 4y5 + 8y6.
Thus, the equivalent BIP formulation of the problem is:
Max z = 3 ( y0 + 2y1 + 4y3 ) + 4 ( y3 + 2y4 + 4y5 + 8y6 )
s.t.
y0 + 2y1 + 4y2
5
2 ( y0 + 2y1 + 4y2 ) + 3 ( y3 + 2y4 + 4y5 + 8y6 ) 30
yi 0, binary, i = 0, 1, 2, 3, 4, 5, 6.
60
61
Branching
Consider the following problems:
(P )
Maximize
subject to
(PA) Maximize
subject to
(PB ) Maximize
subject to
z = cT x
x X = XA XB
z = cT x
x XA
z = cT x
x XB
62
63
Bounding
Consider the following problems:
(P ) Maximize
subject to
(P ) Maximize
subject to
z = cT x
xX = Z
z = cT x
x
64
65
Fathoming
Fathoming of a subproblem, and thereby dismissing from further
consideration, generally is done by an analysis of its relaxation in
the three ways described below.
Criterion 1: An upper bound of the optimal objective function
value of the subproblem the objective function value of the incumbent, or
Criterion 2: The subproblem has no feasible solutions, or
Criterion 3: An optimal solution of the subproblem has been
found.
66
67
Iteration
Step 1: Branching
Among the remaining (unfathomed) subproblems, select the one
with the best bound or the one that was created most recently.
Among the integer-restricted variables that have a non-integer value
in the optimal solution for the LP relaxation of the subproblem,
choose the first one in the natural ordering of the variable to be the
branching variable.
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.
(Note:
xj = greatest integer xj .)
68
Step 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.
69
Step 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.
Test 1: Its upper bound z , where z is the value of z for the
incumbent.
Test 2: Its LP relaxation has no feasible solution.
Test 3: 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 .)
70
Optimality Test
Stop when there are no remaining subproblems; the incumbent is
optimal. (If there is no incumbent, the conclusion is that the problem
has no feasible solutions.) Otherwise, perform another iteration.
5x1 + 4x2
x1 + x2 5
10x1 + 6x2 45
x1 0, x2 0
x1, x2 integers.
71
72
Initialization
Initializing the Current Optimal Value
Set the current optimal value z = .
Obtaining a Bound for the Original Problem
Deleting the integer constraints and solving the resulting LP relaxation of the original problem by the graphical method or the
simplex method, we obtain
(x1, x2) = (3.75, 1.25) with z = 23.75.
Set the bound for the original problem = 23.75.
73
74
Iteration 1
Creating Branches for the Original Problem
The first integer-restricted variable that has a non-integer value is
x1 = 3.75, so x1 becomes the branching variable.
Since 3 x1 4, we then create the following two subproblems:
Subproblem 1: Original problem plus additional constraint:
x1 3.
Subproblem 2: Original problem plus additional constraint:
x1 4.
75
76
77
Iteration 2
Select a Subproblem for Branching
With only one remaining subproblem, we select Subproblem 2 for
branching.
Create Branches for the Subproblem 2
The first integer-restricted variable that has a non-integer value is
x2 = 5/6, so x2 becomes the branching variable.
Since 0 x2 1, we then create the following two subproblems:
Subproblem 3: Subproblem 2 plus additional constraint:
x2 0.
Subproblem 4: Subproblem 2 plus additional constraint:
x2 1.
78
79
Result
There are no remaining subproblems, so the current solution is optimal. Thus (x1 , x2) = (3, 2) with z = 23.
80
x1 d 3
LP1
(x1, x2) = (3, 2), z = 23
Fathomed
(x1*, x2*) = (3, 2), z* = 23
LP2
(x1, x2) = (4, 0.833), z | 23.3 > 23
(x1*, x2*) = (3, 2), z* = 23
x2 d 0
LP3
(x1, x2) = (4.5, 0), z = 22.5 d 23
Fathomed
(x1*, x2*) = (3, 2), z* = 23
x2 1
LP4
Infeasible
Fathomed
(x1*, x2*) = (3, 2), z* = 23
81
82
Initialization
Initializing the Current Optimal Value
Set the current optimal value z = .
Obtaining a Bound for the Original Problem
Deleting the integer constraints and solving the resulting LP relaxation of the original problem by the graphical method or the
simplex method, we obtain
(x1, x2) = (3.75, 2.25) with z = 41.25.
Set the bound for the original problem = 41.25.
83
84
Iteration 1
Creating Branches for the Original Problem
The first integer-restricted variable that has a non-integer value is
x1 = 3.75, so x1 becomes the branching variable.
Since 3 x1 4, we then create the following two subproblems:
Subproblem 1: Original problem plus additional constraint:
x1 3.
Subproblem 2: Original problem plus additional constraint:
x1 4.
85
86
87
Iteration 2
Select a Subproblem for Branching
With only one remaining subproblem, we select Subproblem 2 for
branching.
Create Branches for the Subproblem 2
The first integer-restricted variable that has a non-integer value is
x2 = 1.8, so x2 becomes the branching variable.
Since 1 x2 2, we then create the following two subproblems:
Subproblem 3: Subproblem 2 plus additional constraint:
x2 1.
Subproblem 4: Subproblem 2 plus additional constraint:
x2 2.
88
89
90
Iteration 3
Select a Subproblem for Branching
With only one remaining subproblem, we select Subproblem 3 for
branching.
Create Branches for the Subproblem 3
The first integer-restricted variable that has a non-integer value is
x1 4.44, so x1 becomes the branching variable.
Since 4 x1 5, we then create the following two subproblems:
Subproblem 5: Subproblem 3 plus additional constraint:
x1 4.
Subproblem 6: Subproblem 3 plus additional constraint:
x1 5.
91
92
93
Result
There are no remaining subproblems, so the current solution is optimal. Thus (x1 , x2) = (5, 0) with z = 40.
94
Branch-and-Bound Tree
LP0
(x1, x2) = (3.75, 2.25), z = 41.25
z* = f
x1 4
x1 d 3
LP1
(x1, x2) = (3, 3), z = 39
Fathomed
(x1*, x2*) = (3, 3), z* = 39
LP2
(x1, x2) = (4, 1.8), z = 41 > 39
(x1*, x2*) = (3, 3), z* = 39
x2 2
x2 d 1
LP3
(x1, x2) = (4.44, 1), z | 40.6 > 39
(x1*, x2*) = (3, 3), z* = 39
x1 5
x1 d 4
LP5
(x1, x2) = (4, 1), z = 37 d 39
Fathomed
(x1*, x2*) = (3, 3), z* = 39
LP4
Infeasible
Fathomed
(x1*, x2*) = (3, 3), z* = 39
LP6
(x1, x2) = (5, 0), z = 40 > 39
Fathomed
(x1*, x2*) = (5, 0), z* = 40
95
10
1
0
3
96
Initialization
Initializing the Current Optimal Value
Set the current optimal value z = .
Obtaining a Bound for the Original Problem
Deleting the integer constraints and solving the resulting LP relaxation of the original problem by the simplex method, we obtain
(x1, x2, x3, x4) = (1.25, 1.5, 1.75, 0) with z = 14.25.
Set the bound for the original problem = 14.25.
97
98
Iteration 1
Creating Branches for the Original Problem
The first integer-restricted variable that has a non-integer value is
x1 = 1.25, so x1 becomes the branching variable.
Since 1 x1 2, we then create the following two subproblems:
Subproblem 1: Original problem plus additional constraint:
x1 1.
Subproblem 2: Original problem plus additional constraint:
x1 2.
99
100
101
Iteration 2
Select a Subproblem for Branching
With only one remaining subproblem, we select Subproblem 1 for
branching.
Create Branches for the Subproblem 1
The first integer-restricted variable that has a non-integer value is
x2 = 1.2, so x2 becomes the branching variable.
Since 1 x2 2, we then create the following two subproblems:
Subproblem 3: Subproblem 1 plus additional constraint:
x2 1.
Subproblem 4: Subproblem 1 plus additional constraint:
x2 2.
102
103
104
Iteration 3
Select a Subproblem for Branching
With more than one subproblem, the one with the largest bound
(Subproblem 3) is selected for branching.
Create Branches for the Subproblem 3
The first integer-restricted variable that has a non-integer value is
x1 = 5/6, so x1 becomes the branching variable.
Since 0 x1 1, we then create the following two subproblems:
Subproblem 5: Subproblem 3 plus additional constraint:
x1 0.
Subproblem 6: Subproblem 3 plus additional constraint:
x1 1.
105
106
107
Result
There are no remaining subproblems, so the current solution is optimal. Thus (x1 , x2, x3 , x4 ) = (0, 0, 2, 0.5) with z = 13.5.
108
Branch-and-Bound Tree
LP0
x = (1.25, 1.5, 1.75, 0), z = 14.25
z* = f
x1 2
x1 d 1
LP1
x = (1, 1.2, 1.8, 0), z = 14.2
z* = f
x2 d 1
x2 2
LP2
Infeasible
Fathomed
z* = f
x1 1
LP4
x = (5/6, 2, 11/6, 0), z = 12.17
z* = f
z = 12.17 d 13.5 Fathomed
LP3
x = (5/6, 1, 11/6, 0), z = 14.17
z* = f
x1 d 0
LP5
x = (0, 0, 2, 0.5), z = 13.5
Fathomed
x* = (0, 0, 2, 0.5), z* = 13.5
LP6
Infeasible
Fathomed
x* = (0, 0, 2, 0.5), z* = 13.5
109
10
1
0
0
110
Initialization
Initializing the Current Optimal Value
Set the current optimal value z = .
Obtaining a Bound for the Original Problem
Note that the binary restriction on each variable xj (j = 1, 2, 3, 4)
is equivalent to the following set of constraints:
0 xj 1
x integer.
j
+ 4x4
+ 2x4 10
+ x4 1
0
+ x4 0
1
1
1
x4 1
xj 0, for j = 1, 2, 3, 4
xj integer, for j = 1, 2, 3, 4.
111
112
Deleting the integer constraints and solving the resulting LP relaxation of the original problem by the simplex method, we obtain
(x1, x2, x3, x4) = (5/6, 1, 0, 1) with z = 16.5.
Set the bound for the original problem = 16.5.
Performing Fathoming Tests for the Original Problem
Test 1: Bound = 16.5 > z = = failed.
Test 2: (5/6, 1, 0, 1) is a feasible solution to the LP relaxation of
the original problem = failed.
Test 3: (5/6, 1, 0, 1) violates the integer restrictions for x1 =
failed.
The original problem is not fathomed.
113
Iteration 1
Creating Branches for the Original Problem
The first integer-restricted variable that has a non-integer value is
x1 = 5/6, so x1 becomes the branching variable.
Since x1 is a binary variable, we then create the following two subproblems:
Subproblem 1: Fix x1 = 0 in the original problem.
Maximize z = 5x2 + 6x3 + 4x4
subject to
3x2 + 5x3 + 2x4 10
x3 + x4 1
x3
0
x2
+ x4 0
xj binary, for j = 2, 3, 4.
114
115
116
117
Iteration 2
Select a Subproblem for Branching
With only one remaining subproblem, we select Subproblem 2 for
branching.
Create Branches for the Subproblem 2
The first integer-restricted variable that has a non-integer value is
x2 = 0.8, so x2 becomes the branching variable.
Since x2 is binary variable, we then create the following two subproblems:
118
119
120
121
Iteration 3
Select a Subproblem for Branching
With more than one subproblem, the one with the largest bound
(Subproblem 4) is selected for branching.
Create Branches for the Subproblem 4
The first integer-restricted variable that has a non-integer value is
x4 = 0.5, so x4 becomes the branching variable.
Since x4 is a binary variable, we then create the following two subproblems:
122
123
124
125
Iteration 4
Select a Subproblem for Branching
With more than one subproblem, the one with the largest bound
(Subproblem 5) is selected for branching.
Create Branches for the Subproblem 5
The first integer-restricted variable that has a non-integer value is
x3 = 0.2, so x3 becomes the branching variable.
Since the resulting branching variable x3 is the last variable, fixing
its value at either 0 or 1 actually creates a single solution rather
than subproblems requiring further investigation.
126
Fix x3 = 0 in Subproblem 5
(x1, x2, x3, x4) = (1, 1, 0, 0) with z = 14 is a feasible solution to the
original problem.
Since (x1, x2, x3, x4) = (1, 1, 0, 0) has integer values for all its
integer-restricted variables, it is fathomed by test 3.
Since z = 14, satisfies z > z = 9, we then update
(x1 , x2, x3 , x4 ) = (1, 1, 0, 0) with z = 14.
Fix x3 = 1 in Subproblem 5
(x1, x2, x3, x4) = (1, 1, 1, 0) is an infeasible solution to the original
problem.
It is fathomed by test 2.
127
Result
There are no remaining subproblems, so the current solution is optimal. Thus (x1 , x2, x3 , x4 ) = (1, 1, 0, 0) with z = 14.
128
Branch-and-Bound Tree
LP0
x = (5/6, 1, 0, 1), z = 16.5
z* = f
x1 = 1
x1 = 0
LP1
x = (0, 1, 0, 1), z = 9
Fathomed
x* = (0, 1, 0, 1), z* = 9
LP2
x = (1, 0.8, 0, 0.8), z = 16.2
x* = (0, 1, 0, 1), z* = 9
x2 = 1
x2 = 0
LP3
x = (1, 0, 0.8, 0), z = 13.8
x* = (0, 1, 0, 1), z* = 9
z = 13.8 d 14 Fathomed
LP4
x = (1, 1, 0, 0.5), z = 16
x* = (0, 1, 0, 1), z* = 9
x4 = 0
x4 = 1
LP5
x = (1, 1, 0.2, 0), z = 15.2
x* = (0, 1, 0, 1), z* = 9
x3 = 0
x3 = 1
LP7
x = (1, 1, 0, 0), z = 14 > 9
Fathomed
x* = (1, 1, 0, 0), z* = 14
LP6
Infeasible
Fathomed
x* = (0, 1, 0, 1), z* = 9
LP8
Infeasible
Fathomed
x* = (1, 1, 0, 0), z* = 14