Integer Programming
Integer Programming
Integer Programming
Integer programming (IP) deals with solving linear models in which some or all
the variables are restricted to be integer. There are algorithms especially designed
for IP problems which basically find the optimal solution by solving a sequence
of linear programming (LP) problems.
The simplex algorithm studied in Chapter 2 is based on the fact that the feasi-
ble region (the set of feasible solutions) of an LP problem is convex. This property
plays a key role in the solution of linear models. In fact, the number of extreme
points of a convex set of solutions is finite, and we have shown that the optimal
solution is obtained in an extreme point. Therefore, even though the number of
solutions is reduced when variables are restricted to be integer, IP problems are
usually much more difficult to solve than LP problems because the set of feasible
solutions is no longer convex.
According to the nature of the variables, we can distinguish three types of IP
models.
205
206 Chapter 6. Integer Programming
Day Employees
1. Monday 15
2. Tuesday 13
3. Wednesday 15
4. Thursday 18
5. Friday 14
6. Saturday 16
7. Sunday 10
Employees work five consecutive days and have the next two days off. It
becomes necessary to organize groups of employees to work in different shifts,
so that the number of employees required is satisfied every day of the week. The
objective is to employ the minimum number of workers. We define the following
decision variables:
We can make sure that the number of employees required every day of the
week is satisfied by introducing a constraint in the model. Each of the constraints
requires to have the necessary number of employees each day. We obtain the
OpenCourseWare, UPV/EHU
6.1. Some applications of integer programming 207
following IP model:
min z = x1 + x2 + x3 + x4 + x5 + x6 + x7
subject to
x1 + x4 + x5 + x6 + x7 ≥ 15
x1 + x2 + x5 + x6 + x7 ≥ 13
x1 + x2 + x3 + x6 + x7 ≥ 15
x1 + x2 + x3 + x4 + x7 ≥ 18
x1 + x2 + x3 + x4 + x5 ≥ 14
x2 + x3 + x4 + x5 + x6 ≥ 16
x3 + x4 + x5 + x6 + x7 ≥ 10
x1 , x2 , x3 , x4 , x5 , x6 , x7 ≥ 0 and integer
1 2 3 4
Weight (kg) 3 6 5 5
Value (euro) 15 25 12 10
We may also want to take into account other constraints in the problem, such as
the volume of the items.
Example 3. There are 6 cities in a district, and there is a project to commu-
nicate them by the construction of train stations in some of the cities. A decision
has to be made about where to build the train stations. The final solution has to
ensure that citizens of all cities can reach a train station in 30 minutes at most.
The objective is to build the minimum number of train stations. The table below
shows how long it takes to go from one city to another:
1 2 3 4 5 6
1 0 35 20 40 30 60
2 35 0 45 35 20 70
3 20 45 0 15 55 20
4 40 35 15 0 65 35
5 30 20 55 65 0 40
6 60 70 20 35 40 0
min z = x1 + x2 + x3 + x4 + x5 + x6
subject to
x 1 + x3 + x5 ≥ 1
x2 + x5 ≥ 1
x 1 + x3 + x4 + x6 ≥ 1
x3 + x4 ≥ 1
x 1 + x2 + x5 ≥ 1
x3 + x6 ≥ 1
x1 , x2 , x3 , x4 , x5 , x6 = 0 or 1
OpenCourseWare, UPV/EHU
6.2. Solving integer programming problems 209
Each constraint refers to a city, and ensures that at least one train station will
be located no further than a 30 minute drive from each city.
x2
12x1 + 5x2 = 60
x1 + x2 = 7
max
x1
We can see that the feasible region of the IP problem is not a convex set. Note
that there is a finite number of points in the feasible region, and hence, it is possible
to find the optimal solution by computing the objective value z for each of the
solutions in the feasible region, and comparing them among each other. However,
this method is not efficient for problems with a large number of variables, since
the number of feasible points becomes extremely large.
In fact, a higher computational effort is required to solve an IP problem than
to solve the LP problem obtained by ignoring all integer constraints on variables,
even though the number of feasible solutions to the IP problem is smaller. This
is the case because contrary to LP problems, which have a convex set of feasible
solutions, the feasible region of IP problems is not convex. Remind that the theory
developed in Chapter 2 is applicable whenever the set of solutions is convex.
Another approach to solve an IP problem suggests to ignore the integer con-
straints, solve the resulting LP problem by applying the simplex algorithm and
finally round off the noninteger values to integers. The LP problem obtained by
ignoring the integer constraints is usually called its LP relaxation, denoted by
LP R from now on. The following is the graphical solution of the given IP prob-
lem’s LP relaxation.
x2
12x1 + 5x2 = 60
x1 + x2 = 7
25 24
max xLP R = ( , )
7 7
x1
OpenCourseWare, UPV/EHU
6.3. The graphical solution of integer programming problems 211
solution to the IP problem, because it is not feasible; it does not satisfy the integer
constraints. Rounding off each integer variable to the nearest integer value, we
obtain the following four nearest points: (3, 3), (3, 4), (4, 3), (4, 4). By computing
the objective value z for each of them, we conclude that point (4, 4) gives the
maximum value to z. Unfortunately, it is not feasible because it is not contained
in the set of solutions of the IP problem.
x2
12x1 + 5x2 = 60
x1 + x2 = 7
max
x1
From the graphical solution on page 210, we know that the optimal solution
to the LP relaxation is xLP R = (3.571, 3.428), with the optimal objective value
zLP R = 440. This solution does not give integer values to the variables. We will
now see that the optimal solution to the IP problem may be found throught the
solution of a sequence of LP relaxation problems. To do so, we start the branching
process dividing the set of solutions of the LP relaxation into two, and excluding
a subset of noninteger solutions that contains xLP R .
The way to proceed is as follows: we select an integer defined variable that
takes on a fractional value in the optimal solution to the LP relaxation. In this
example, both x1 and x2 may be selected. Selecting x1 arbitrarily, with an optimal
value of 3.571, we may exclude the region 3 < x1 < 4 from the feasible region
of the LP relaxation, because it contains no integer values for x1 . Note that every
point in the feasible region of the IP problem must have either x1 ≤ 3 or x1 ≥ 4.
Therefore, we partition the feasible region of the LP relaxation by branching on
x1 , and create the following two additional LP problems:
OpenCourseWare, UPV/EHU
6.3. The graphical solution of integer programming problems 213
The graphical solution of the two LP problems just created, LP2 and LP3, can
be seen on page 214. The two shaded areas correspond to the feasible regions of
problems LP2 and LP3. Note that the region 3 < x1 < 4 of the LP relaxation
feasible region has been excluded. The optimal solutions are:
The optimal solution to problem LP2 satisfies the integer requirements for x1
and x2 . Thus, LP2 is said to be fathomed or pruned, which means that no further
branching is required for LP2. The optimal solution to LP2, xLP 2 = (3, 4), is
called a candidate solution, which means that it will be an optimal solution for the
IP problem, if a better feasible solution is not found. The optimal objective value
zLP 2 = 420 for the candidate solution is a lower bound on the optimal objective
value of the IP problem: zLB = 420.
x2
12x1 + 5x2 = 60 x1 = 3 x1 = 4
x1 + x2 = 7
max
(3, 4)
Problem LP2 (4, 12
5
)
Problem LP3
x1
We now examine problem LP3. The optimal solution to problem LP3 is not
feasible for the IP problem, because variable x2 = 12
5
= 2.4 takes on a fractional
value. Since zLP 3 = 428 > zLB , problem LP3 is examined further because
branching on LP3 may yield a better feasible integer solution than the candidate
solution; a solution with z > 420.
The fractional value of x2 leads to the two branches x2 ≤ 2 and x2 ≥ 3.
Branching on LP3, the two additional problems LP4 and LP5 are generated. The
integer-free region 2 < x2 < 3 is excluded from the feasible region of problem
LP3.
OpenCourseWare, UPV/EHU
6.3. The graphical solution of integer programming problems 215
From the graphical solution of the two newly created problems, we see that
problem LP5 is infeasible. It cannot yield the optimal solution to the IP problem,
and thus, problem LP5 is pruned; no further branching is required.
x2
12x1 + 5x2 = 60 x1 = 4
x1 + x2 = 7
max
x2 = 3 Problem LP5
x2 = 2 Problem LP4
(4.16, 2)
x1
x2
12x1 + 5x2 = 60 x1 = 4 x1 = 5
x1 + x2 = 7
max
Problem LP6
(4, 2)
x2 = 2
Problem LP7
(5, 0)
x1
The feasible region of problem LP6 is a line segment, and its optimal solution
is xLP 6 = (4, 2) with zLP 6 = 410. Since zLP 6 < zLB = 420, the problem is
pruned.
The feasible region of problem LP7 contains just one point, which conse-
quently is its optimal solution: xLP 7 = (5, 0). The optimal objective value is
zLP 7 = 400, which is lower than the lower bound, zLP 7 < zLB = 420. Hence, the
problem is pruned.
At this point, no further branching is required. Since there are no remaining
unsolved problems, the optimal solution to the IP problem is the candidate solu-
OpenCourseWare, UPV/EHU
6.4. The branch and bound method 217
tion obtained from problem LP2, that is, the one associated with the lower bound:
Problem LPR
xLP R = (3.571, 3.428)
zLP R = 440
x1 ≤ 3 x1 ≥ 4
Problem LP2 Problem LP3
xLP 2 = (3, 4) xLP 3 = (4, 2.4)
zLP 2 = 420 zLP 3 = 428
zLB = 420 x2 ≤ 2 x2 ≥ 3
Candidate solution Problem LP4 Problem LP5
Pruned
xLP 4 = (4.166, 2)
Infeasible
zLP 4 = 423.33
x1 ≤ 4 x1 ≥ 5 Pruned
Problem LP6 Problem LP7
xLP 6 = (4, 2) xLP 7 = (5, 0)
zLP 6 = 410 zLP 7 = 400
Pruned Pruned
The LP relaxation has less constraints than the IP problem, because all integer
constraints on variables are ignored. Therefore, the set of all feasible solutions
to the LP relaxation includes all the feasible solutions to the IP problem. Conse-
quently, the following holds:
R ≥ zIP .
∗ ∗
zLP
OpenCourseWare, UPV/EHU
6.4. The branch and bound method 219
For instance, problems LP2, LP5, LP6 and LP7 are pruned problems (see
Figure 6.1).
As it was previously said, the optimal objective value of an LP problem is an
upper bound on the optimal objective value of the IP problem on that branch. We
use the notation zU B to denote the upper bound that the optimal objective value of
each LP problem establishes throughout the solution process of an IP problem.
* Step 1. Initialization
Solve the LP relaxation associated with the IP problem to be solved.
– If the optimal solution to the LP relaxation satisfies the integer con-
straints, then it is an optimal solution to the IP problem. Stop.
– Otherwise, set zLB = −∞ to initialize the lower bound on the optimal
objective value of the IP problem.
* Step 2. Branching
Select an LP problem among the LP problems that can be branched out.
Choose a variable xj which is integer-restricted in the IP problem but has a
noninteger value in the optimal solution of the selected LP problem. Create
two new LP problems adding the constraints1 xj ≤ [xj ] and xj ≥ [xj ] + 1
to the LP problem.
* Step 3. Bounding
Solve2 the two LP problems created in Step 2, and compute the objective
value zU B for each of them.
* Step 4. Pruning
An LP problem may be pruned and therefore eliminated from further con-
sideration, in the following cases:
(2) Pruned by bound. zU B ≤ zLB , that is, the optimal objective value of
the LP problem is smaller than or equal to the lower bound.
(3) Pruned by optimality. The optimal solution is integer and zU B > zLB .
Change the lower bound to the new value, zLB =zU B ; the solution
associated with the new lower bound is the new candidate solution.
If there are LP problems that can be branched out, then go to Step 2, and
perform another iteration. Otherwise, the candidate solution is the optimal
solution to the IP problem. If no candidate solution has been found, the IP
problem is infeasible.
Even though a high computational effort is required to find the optimal solu-
tion to an IP problem by applying the branch and bound algorithm, it is the most
popular algorithm used to solve both mixed and pure IP problems.
Note that Step 2 is quite flexible, because it does not specify neither how to
select an LP problem to be branched out nor how to choose a branching variable
xj , if there are several choices. Several rules have been designed to avoid arbi-
trary choices and guide the search of an optimal solution to the IP problem. In
fact, experience has shown that the way such decisions are made has an important
effect on the computational efficiency of the branch and bound algorithm. A com-
monly used rule to select an LP problem to be branched out is the best bound rule,
which suggests that the LP problem with the largest upper bound zU B should be
selected. Some rules have also been designed to choose a branching variable, but
unfortunately, they are quite complex. In the following example, we choose the
branching variable arbitrarily.
Example. We apply the branch and bound algorithm to find the optimal solu-
tion to the IP problem shown on page 209.
First iteration
Step 1. Initialization. Solve the LP relaxation associated with the IP problem.
The optimal tableau is:
x1 x2 x3 x4
0 0 20 5 440
12
a2 0 1 7
− 71 24
7
a1 1 0 − 75 1
7
25
7
OpenCourseWare, UPV/EHU
6.4. The branch and bound method 221
x1 x2 x3 x4 x5
0 0 20 5 0 440
12
a2 0 1 7
− 17 0 24
7
a1 1 0 − 75 1
7
0 25
7
a5 1 0 0 0 1 3
We need to use elementary operations to write the third row in terms of the
new basis B = (a2 a1 a5 ). We operate like this: row 3 − row 2.
x1 x2 x3 x4 x5
0 0 20 5 0 440
12
a2 0 1 7
− 17 0 24
7
a1 1 0 − 75 1
7
0 25
7
5
a5 0 0 7
− 17 1 − 47
The tableau is not primal feasible; the dual simplex algorithm will be used
to find the optimal tableau for the problem LP2.
x1 x2 x3 x4 x5
0 0 45 0 35 420
a2 0 1 1 0 −1 4
a1 1 0 0 0 1 3
a4 0 0 −5 1 −7 4
x1 x2 x3 x4 x5
0 0 20 5 0 440
12
a2 0 1 7
− 71 0 24
7
a1 1 0 − 75 1
7
0 25
7
a5 −1 0 0 0 1 −4
x1 x2 x3 x4 x5
0 0 20 5 0 440
12
a2 0 1 7
− 17 0 24
7
a1 1 0 − 75 1
7
0 25
7
a5 0 0 − 75 1
7
1 − 37
The tableau is not primal feasible; the dual simplex algorithm will be used
to find the optimal tableau for the problem LP3.
OpenCourseWare, UPV/EHU
6.4. The branch and bound method 223
x1 x2 x3 x4 x5
0 0 0 9 28 428
1 12 12
a2 0 1 0 5 5 5
a1 1 0 0 0 −1 4
a3 0 0 1 − 15 − 75 3
5
Thereby, Problems LP2 and LP3 have been solved (Figure 6.1 on page 217
shows the optimal solutions).
Step 4. Pruning.
Problem LP2 is pruned by optimality, because zU B = 420 > zLB holds and
the solution is integer: x1 = 3 and x2 = 4. Since it is the first integer solution
found so far, it becomes the candidate solution, and we change the lower bound
to the new value: zLB = zU B = 420.
Problem LP3 is not pruned, because none of the conditions of Step 4 holds.
Since there are LP problems that can be branched out, we proceed with a new
iteration of the algorithm.
Second iteration
Step 2. Branching. We select problem LP3 to be branched out. We choose
variable x2 , and create two new LP problems: problem LP4, by adding the con-
straint x2 ≤ 2 to problem LP3, and problem LP5, by adding the constraint x2 ≥ 3
(see page 214).
Step 3. Bounding. As in the first iteration, we solve the two LP problems just
created using the sensitivity analysis and the dual simplex algorithm. This time,
we use the optimal tableau associated with problem LP3 to solve problems LP4
and LP5 (see the solutions on Figure 6.1, page 217).
Step 4. Pruning. Problem LP5 is pruned by infeasibility. The optimal so-
lution to problem LP4 is not integer, and zU B = 423.33 > 420 = zLB . Thus,
problem LP4 is not pruned; it is examined further, because branching on LP4 may
yield a better feasible integer solution than the candidate solution. We proceed
with a new iteration of the algorithm at Step 2.
Third iteration
Step 2. Branching. We select problem LP4 to be branched out. We choose
variable x1 , and create two new LP problems: problem LP6 and problem LP7 (see
models on page 215).
Step 3. Bounding. We solve the two LP problems just created. This time,
we start from the optimal tableau associated with problem LP4 to solve problems
LP6 and LP7 (see the solutions on Figure 6.1, page 217).
Step 4. Pruning.
Problem LP6 is pruned by bound, because zU B = 410 < 420 = zLB holds.
Problem LP7 is also pruned by bound, since zU B = 400 < 420 = zLB holds.
No problem remains to be branched out. Therefore, the candidate solution is
the optimal solution to the IP problem.
0 ≤ c 1 ≤ c2 ≤ · · · ≤ cn (6.1)
It is always possible to rewrite the 0-1 IP model and obtain a form that satisfies
the condition (6.1). Let us see how to proceed by means of an example.
Example. Consider the following 0-1 IP model:
Cost coefficients in the objective function do not satisfy the condition (6.1). To
obtain the required form, we proceed like this: we consider the absolute value of
OpenCourseWare, UPV/EHU
6.5. 0-1 integer programming 225
the cost coefficients and choose the minimum: min{|c1 |, |c2 |} = min{6, 4} = 4.
We replace the binary variable x2 by 1 − y1 , because c2 is negative. If it was
positive, it should be replaced by y1 . The next smaller is |c1 | = 6; since it is
positive, we replace x1 by y2 . Both y1 and y2 are also binary variables.
All the variables can now be reordered as needed to place the cost coefficients
in ascending order, so that the condition (6.1) holds.
Definition 6.5.1 (0-1 relaxation problem) Given a 0-1 IP problem, the corre-
sponding 0-1 relaxation problem is obtained by ignoring all constraints, except
the ones which state that the variables are binary.
* Step 1. Initialization
Consider the optimal solution to the 0-1 relaxation problem, x = (1, . . . , 1),
and check whether it satisfies the constraints of the original 0-1 IP problem.
OpenCourseWare, UPV/EHU
6.5. 0-1 integer programming 227
If that is the case, (1, . . . , 1) is the optimal solution to the original 0-1 IP
problem. Stop.
Otherwise, check whether the solution x = (0, 1, . . . , 1) satisfies the con-
straints of the original 0-1 IP problem. If that is the case, (0, 1, . . . , 1) is the
optimal solution to the original 0-1 IP problem. Stop.
Otherwise, initialize the lower bound zLB = z(x), where x = (0, . . . , 0).
The upper bound associated with the 0-1 relaxation problem is zU B =
z(xU B ), where xU B = (0, 1, . . . , 1). Assign the index k = 1 to the problem.
* Step 2. Branching
Select a problem among the problems that can be branched out. Create two
new problems by adding the constraints xk = 0 and xk = 1 to the problem
selected.
* Step 3. Bounding
For each of the two newly created problems, consider the completion xU B
which involves assigning the value 0 to the variable xk+1 and the value 1 to
the rest of the unspecified variables. Compute the objective value zU B for
each of the completions. Assign the index k = k + 1 to the new problems.
* Step 4. Pruning
A problem may be pruned and therefore eliminated from further considera-
tion, in the following cases:
Example. We now illustrate the 0-1 branch and bound algorithm by applying
it to the knapsack problem of the example on page 207.
OpenCourseWare, UPV/EHU
6.5. 0-1 integer programming 229
Step 3. Bounding.
The completion yU B = (0, 0, 1, 1) for problem RP2 provides an upper bound
for the 0-1 IP problem at its corresponding resolution branch: zU B = 40.
The completion yU B = (1, 0, 1, 1) for problem RP3 provides an upper bound
for the 0-1 IP problem at its corresponding resolution branch: zU B = 50.
We assign the index k = 2 to these two problems.
Step 4. Pruning.
The completion yU B = (0, 0, 1, 1) for problem RP2 satisfies the constraint of
the original 0-1 IP problem. Moreover, since zU B = 40 > 0 = zLB holds, the
completion becomes the candidate solution. Problem RP2 is pruned by optimality,
and the lower bound changes to the new value, zLB = 40.
The completion yU B = (1, 0, 1, 1) for problem RP3, however, violates the
constraint of the original 0-1 IP problem. Moreover, we can check that problem
RP3 is not infeasible, because there exists at least one feasible completion for it;
one that satisfies the constraint of the original 0-1 IP problem, say y = (1, 0, 0, 0),
for instance. Since zU B = 50 > zLB , none of the conditions for pruning holds.
Therefore, RP3 is not pruned, and we proceed with a new iteration of the algo-
rithm.
Second iteration.
We consider problem RP3. By branching on y2 , we create two additional
problems: adding the constraint y2 = 0 we get problem RP4, and adding the
constraint y2 = 1 we get problem RP5.
We compute the completions and the objective values for problems RP4 and
RP5 as specified in the algorithm.
For problem RP4, we have the completion yU B = (1, 0, 0, 1) with zU B = 35.
Problem RP4 is pruned by bound, because zU B < zLB = 40.
For problem RP5, we have the completion yU B = (1, 1, 0, 1) with zU B = 47.
Problem RP5 is not pruned.
We assign the index k = 3 to these two problems. Since RP5 was not pruned,
we proceed with a new iteration of the algorithm.
Third iteration.
We consider problem RP5. By branching on y3 , we create two additional
problems: adding the constraint y3 = 0 we get problem RP6, and adding the
constraint y3 = 1 we get problem RP7.
OpenCourseWare, UPV/EHU
6.5. 0-1 integer programming 231
0-1 RP
yU B = (0, 1, 1, 1)
zU B = 52
y1 = 0 y1 = 1
Problem RP2 Problem RP3
y = (0, −, −, −) y = (1, −, −, −)
yU B = (0, 0, 1, 1) yU B = (1, 0, 1, 1)
zU B = 40 zU B = 50
zLB = 40 y2 = 0 y2 = 1
Problem RP4 Problem RP5
Candidate sol.
Pruned y = (1, 0, −, −) y = (1, 1, −, −)
yU B = (1, 0, 0, 1) yU B = (1, 1, 0, 1)
zU B = 35 zU B = 47
y3 = 0 y3 = 1
Pruned
Problem RP6 Problem RP7
y = (1, 1, 0, −) y = (1, 1, 1, −)
yU B = (1, 1, 0, 0) yU B = (1, 1, 1, 0)
zU B = 22 zU B = 37
Pruned Pruned
Figure 6.2: Diagram of the entire solution sequence of the knapsack problem of
the example.
OpenCourseWare, UPV/EHU