A Tutorial On Integer Programming: G Erard Cornu Ejols Michael A. Trick Matthew J. Saltzman 1995

Download as pdf or txt
Download as pdf or txt
You are on page 1of 37

A Tutorial on Integer Programming

Gérard Cornuéjols Michael A. Trick


Matthew J. Saltzman

1995
These notes are meant as an adjunct to Chapter 9 and 10 in Murty. You
are responsible for what appears in these notes as well as Sections 9.1–9.7,
10.1–10.3, 10.5, 10.6, 10.8 in the text.

Contents
1 Introduction 2

2 Modeling with Integer Variables 3


2.1 Capital Budgeting . . . . . . . . . . . . . . . . . . . . . . . . 3
2.1.1 Multiperiod Capital Budgeting . . . . . . . . . . . . . 4
2.2 Knapsack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2.1 Converting a Single-Constraint 0-1 IP to a Knapsack
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2.2 Multidimensional and General Integer Knapsack Prob-
lems . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.3 The Lockbox Problem . . . . . . . . . . . . . . . . . . . . . . 7
2.4 Set Covering . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.4.1 Set Packing and Partitioning . . . . . . . . . . . . . . . 13
2.5 Traveling Salesperson Problem . . . . . . . . . . . . . . . . . . 13

3 Solving Integer Programs 15


3.1 Relationship to Linear Programming . . . . . . . . . . . . . . 15
3.2 Branch and Bound . . . . . . . . . . . . . . . . . . . . . . . . 17
3.3 Cutting Plane Techniques . . . . . . . . . . . . . . . . . . . . 22
3.3.1 General Cutting Planes . . . . . . . . . . . . . . . . . . 24
3.3.2 Cuts for Special Structure . . . . . . . . . . . . . . . . 26

4 Solutions to Some Optional Problems 31

1
1 Introduction
Consider the manufacture of television sets. A linear programming model
might give a production plan of 205.7 sets per week. In such a model, most
people would have no trouble stating that production should be 205 sets per
week (or even “roughly 200 sets per week”). On the other hand, suppose we
were buying warehouses to store finished goods, where a warehouse comes in
a set size. Then a model that suggests we purchase 0.7 warehouse at some
location and 0.6 somewhere else would be of little value. Warehouses come
in integer quantities, and we would like our model to reflect that fact.
This integrality restriction may seem rather innocuous, but in reality it
has far reaching effects. On one hand, modeling with integer variables has
turned out to be useful far beyond restrictions to integral production quanti-
ties. With integer variables, one can model logical requirements, fixed costs,
sequencing and scheduling requirements, and many other problem aspects. In
AMPL, one can easily change a linear programming problem into an integer
program.
The downside of all this power, however, is that problems with as few
as 40 variables can be beyond the abilities of even the most sophisticated
computers. While these small problems are somewhat artificial, most real
problems with more than 100 or so variables are not possible to solve unless
they show specific exploitable structure. Despite the possibility (or even
likelihood) of enormous computing times, there are methods that can be
applied to solving integer programs. The CPLEX solver in AMPL is built on
a combination of methods, but based on a method called branch and bound.
The purpose of this chapter is to show some interesting integer programming
applications and to describe some of these solution techniques as well as
possible pitfalls.
First we introduce some terminology. An integer programming problem
in which all variables are required to be integer is called a pure integer pro-
gramming problem. If some variables are restricted to be integer and some
are not then the problem is a mixed integer programming problem. The case
where the integer variables are restricted to be 0 or 1 comes up surprising
often. Such problems are called pure (mixed) 0-1 programming problems or
pure (mixed) binary integer programming problems.

2
2 Modeling with Integer Variables
The use of integer variables in production when only integral quantities can
be produced is the most obvious use of integer programs. In this section, we
will look at some less obvious ones. The text also goes through a number of
them (some are repeated here).

2.1 Capital Budgeting


Suppose we wish to invest $14,000. We have identified four investment op-
portunities. Investment 1 requires an investment of $5,000 and has a present
value (a time-discounted value) of $8,000; investment 2 requires $7,000 and
has a value of $11,000; investment 3 requires $4,000 and has a value of $6,000;
and investment 4 requires $3,000 and has a value of $4,000. Into which in-
vestments should we place our money so as to maximize our total present
value?
As in linear programming, our first step is to decide on our variables.
This can be much more difficult in integer programming because there are
very clever ways to use integrality restrictions. In this case, we will use a 0-1
variable xj for each investment. If xj is 1 then we will make investment j. If
it is 0, we will not make the investment. This leads to the 0-1 programming
problem:
Maximize 8x1 + 11x2 + 6x3 + 4x4
subject to 5x1 + 7x2 + 4x3 + 3x4 ≤ 14
xj ∈ {0, 1} j = 1, . . . 4.
Now, a straightforward “bang for buck” suggests that investment 1 is the
best choice. In fact, ignoring integrality constraints, the optimal linear pro-
gramming solution is x1 = 1, x2 = 1, x3 = 0.5, x4 = 0 for a value of $22,000.
Unfortunately, this solution is not integral. Rounding x3 down to 0 gives a
feasible solution with a value of $19,000. There is a better integer solution,
however, of x1 = 0, x2 = x3 = x4 = 1 for a value of $21,000. This example
shows that rounding does not necessarily give an optimal value.
There are a number of additional constraints we might want to add. For
instance, consider the following constraints:
1. We can only make two investments.
2. If investment 2 is made, investment 4 must also be made.

3
3. If investment 1 is made, investment 3 cannot be made.

All of these, and many more logical restrictions, can be enforced using
0-1 variables. In these cases, the constraints are:

1. x1 + x2 + x3 + x4 ≤ 2

2. x2 − x4 ≤ 0

3. x1 + x3 ≤ 1.

Exercise 1 (Optional) As the leader of an oil exploration drilling venture,


you must determine the best selection of 5 out of 10 possible sites. La-
bel the sites s1 , s2 , . . . , s10 and the expected profits associated with each as
p1 , p2 , . . . , p10 .

(i) If site s2 is explored, then site s3 must also be explored. Furthermore,


regional development restrictions are such that

(ii) Exploring sites s1 and s7 will prevent you from exploring site s8 .

(iii) Exploring sites s3 or s4 will prevent you from exploring site s5 .

Formulate an integer program to determine the best exploration scheme.

2.1.1 Multiperiod Capital Budgeting


In the preceding, we considered making a single investment in a project for
the duration of some term, and receiving its return at the end of the term.
In practice, we may face a choice among projects that require investments of
different amounts in each of several periods (with possibly different budgets
available in each period), with the return being realized over the life of the
project. In this case, we can still model the problem with variables
(
1 if we invest in project j
xj =
0 otherwise,

the objective is still to maximize the sum of the returns on the projects
selected, and there is now a budget constraint for each period. For example,
suppose we wish to invest $14,000, $12,000, and $15,000 in each month of the
next quarter. We have identified four investment opportunities. Investment 1

4
requires an investment of $5,000, $8,000, and $2,000 in month 1, 2, and 3,
respectivey, and has a present value (a time-discounted value) of $8,000;
investment 2 requires $7,000 in month 1 and $10,000 in period 3, and has
a value of $11,000; investment 3 requires $4,000 in period 2 and $6,000 in
period 3, and has a value of $6,000; and investment 4 requires $3,000, $ 4,000,
and $5,000 and has a value of $4,000. The corresponding integer program is
Maximize 8x1 + 11x2 + 6x3 + 4x4
subject to 5x1 + 7x2 + 3x4 ≤ 14
8x1 + 4x3 + 4x4 ≤ 12
2x1 + 10x2 + 6x3 + 4x4 ≤ 15
xj ∈ {0, 1}.

2.2 Knapsack
The knapsack problem is a particularly simple integer program: it has only
one constraint. Furthermore, the coefficients of this constraint and the objec-
tive are all non-negative. For example, the following is a knapsack problem:
Maximize 8x1 + 11x2 + 6x3 + 4x4
subject to 5x1 + 7x2 + 4x3 + 3x4 ≤ 14
xj ∈ {0, 1}.
The traditional story is that there is a knapsack (here of capacity 14). There
are a number of items (here there are four items), each with a size and a
value (here item 2 has size 7 and value 11). The objective is to maximize the
total value of the items in the knapsack. Knapsack problems are nice because
they are (usually) easy to solve, as we will see in the dynamic programming
section of this course.
To solve the associated linear program, it is simply a matter of determin-
ing which variable gives the most “bang for the buck”. If you take cj /aj (the
objective coefficient/constraint coefficient) for each variable, the one with
the highest ratio is the best item to place in the knapsack. Then the item
with the second highest ratio is put in and so on until we reach an item
that cannot fit. At this point, a fractional amount of that item is placed in
the knapsack to completely fill it. In our example, the variables are already
ordered by the ratio. We would first place item 1 in, then item 2, but item
3 doesn’t fit: there are only 2 units left, but item 3 has size 4. Therefore,
we take half of item 3. The solution x1 = 1, x2 = 1, x3 = 0.5, x4 = 0 is the
optimal solution to the linear program.

5
As already observed in Section 2.1, this solution is quite different from
the optimal solution to the knapsack problem. Nevertheless, it will play an
important role in the solution of the problem by branch and bound as we
will see shortly.

2.2.1 Converting a Single-Constraint 0-1 IP to a Knapsack Prob-


lem
The nonnegativity requirement on the coefficients in the knapsack problem
is not really a restriction. As mathematicians say, we can assume this re-
quirement holds without loss of generality, since any single-constraint 0-1 IP
can be converted to knapsack form. The same cannot be said for general
integer programs with one or more constraints. For 0-1 programs with more
than one constraint, the technique applies to columns where all entries are
negative.
Consider the general 0-1 IP with one constraint:
X
n
Maximize cj xj
j=1
Xn
subject to wj xj ≤ w0
j=1
xj ∈ {0, 1} j = 1, . . . , n
If any xj has cj < 0 and wj ≥ 0 then it is clear that this xj will be 0 in any
optimal solution, so we can fix xj = 0 and remove it from the problem. If
any xj has cj ≥ 0 and wj < 0 then it is clear that xj = 1 in any optimal
solution (including item j actually increases capacity by |wj | and increases
the objective as well), so we can fix xj = 1 and remove it from the problem
as well (adjusting the capacity and objective values accordingly).
If cj < 0 and wj < 0 then including item j incurs a cost but increases
capacity, so there is no obious justification for fixing xj to either 0 or 1.
Instead, we can define a new variable yj = 1 − xj and replace xj with 1 −
yj . After collecting the constants, we have a new, equivalent problem with
nonnegative coefficients on yj .
For example, consider the IP
Maximize 8x1 + 11x2 − 6x3 + 4x4
subject to 5x1 + 7x2 − 4x3 + 3x4 ≤ 14
xj ∈ {0, 1}.

6
Defining y3 = 1 − x3 and substituting x3 = 1 − y3 gives

Maximize 8x1 + 11x2 − 6(1 − y3 ) + 4x4


subject to 5x1 + 7x2 − 4(1 − y3 ) + 3x4 ≤ 14
xj , y3 ∈ {0, 1},

or equivalently,

Maximize 8x1 + 11x2 + 6y3 + 4x4 − 6


subject to 5x1 + 7x2 + 4y3 + 3x4 ≤ 18
xj , y3 ∈ {0, 1}.

2.2.2 Multidimensional and General Integer Knapsack Problems


A problem of the form

Maximize cx
subject to Ax ≤ b
xj ∈ {0, 1},

where cj ≥ 0, Aij ≥ 0, and bi ≥ 0 is called a multidimensional knapsack


problem.
If the xj s are allowed to take on arbitrary integer values (rather than
being restricted to 0 or 1), then the problem is a general knapsack problem.
In the story, this would correspond to being allowed to take multiple items
of each type, with all items of a given type weighing the same and having
value independent of the number of such items included.

2.3 The Lockbox Problem


Consider a national firm that receives checks from all over the United States.
Due to the vagaries of the U.S. Postal Service, as well as the banking system,
there is a variable delay from when the check is postmarked (and hence the
customer has met her obligation) and when the check clears (and when the
firm can use the money). For instance, a check mailed in Pittsburgh sent to
a Pittsburgh address might clear in just two days. A similar check sent to
Los Angeles might take eight days to clear. It is in the firm’s interest to have
the check clear as quickly as possible since then the firm can use the money.
In order to speed up this clearing, firms open offices (called lockboxes) in
different cities to handle the checks.

7
For example, suppose we receive payments from four regions (West, Mid-
west, East, and South). The average daily value from each region is as follows:
$70,000 from the West, $50,000 from the Midwest, $60,000 from the East,
and $40,000 from the South. We are considering opening lockboxes in L.A.,
Chicago, New York, and/or Atlanta. Operating a lockbox costs $50,000 per
year. The average days from mailing to clearing is given in the table. Which
lockboxes should we open?

From L.A. Chicago New York Atlanta


West 2 6 8 8
Midwest 6 2 5 5
East 8 5 2 5
South 8 5 5 2

Table 1: Clearing Times

First we must calculate the losses due to lost interest for each possible
assignment. For example, if the West sends to New York, then on average
there will be $560,000 (= 8×$70, 000) in process on any given day. Assuming
an investment rate of 20%, this corresponds to a yearly loss of $112,000. We
can calculate the losses for the other possibilities in a similar fashion to get
table 2.

From L.A. Chicago New York Atlanta


West 28 84 112 112
Midwest 60 20 50 50
East 96 60 24 60
South 64 40 40 16

Table 2: Lost Interest ($1000)

The formulation takes a bit of thought. Let yj be a 0-1 variable that is


1 if lockbox j is opened and 0 if it is not. Let xij be 1 if region i sends to
lockbox j.
Our objective is to minimize our total yearly costs. This is:

28x11 + 84x12 + 112x13 + 112x14 + 60x21 + . . . + 50y1 + 50y2 + 50y3 + 50y4.

8
One set of constraints is as follows:
X
xij = 1 for all i
j

(each region must be assigned to one lockbox).


A more difficult set of constraints is that a region can only be assigned
to an open lockbox. For lockbox 1 (L.A.), this can be written

x11 + x21 + x31 + x41 ≤ 100y1

(There is nothing special about 100; any number at least 4 would do.) Sup-
pose we do not open L.A. Then y1 is 0, so all of x11 , x21 , x31 , and x41 must
also be. If y1 is 1 then there is no restriction on the x values.
We can create constraints for the other lockboxes to finish off the integer
program. For this problem, we would have twenty variables (four y variables,
sixteen x variables) and eight constraints. This gives the following 0-1 linear
program:

Minimize 28x11 + 84x12 + 112x13 + 112x14 + 60x21 + 20x22 + 50x23 + 50x24


+96x31 + 60x32 + 24x33 + 60x34 + 64x41 + 40x42 + 40x43 + 16x44
+50y1 + 50y2 + 50y3 + 50y4
subject to x11 + x12 + x13 + x14 = 1
x21 + x22 + x23 + x24 = 1
x31 + x32 + x33 + x34 = 1
x41 + x42 + x43 + x44 = 1
x11 + x21 + x31 + x41 ≤ 100y1
x12 + x22 + x32 + x42 ≤ 100y2
x13 + x23 + x33 + x43 ≤ 100y3
x14 + x24 + x34 + x44 ≤ 100y4
xij , yj ∈ {0.1} i = 1, . . . , 4, j = 1, . . . , 4

A possible AMPL model is


set Region;
set Box;

param cost{Box} >= 0;


param loss{Region, Box} >= 0;
param big > 0;

9
var open{Box} binary;
var assign{Region, Box} binary;

minimize Cost: sum{i in Region, j in Box} loss[i,j] * assign[i,j]


+ sum{j in Box} cost[j] * open[j];

subject to Assign{i in Region}: sum{j in Box} assign[i,j] = 1;


subject to Open{j in Box}: sum{i in Region} assign[i,j] <= big * open[j];

---------------------------

set Region := West Midwest East South;


set Box := LA Chi NY Atl;

param cost := LA 50 Chi 50 NY 50 Atl 50;


param loss : LA Chi NY Atl :=
West 28 84 112 112
Midwest 60 20 50 50
East 96 60 24 60
South 64 40 40 16;
param big := 100;
If we ignore integrality, we get the solution x11 = x22 = x33 = x44 = 1,
y1 = y2 = y3 = y4 = 0.01 and the rest equal to 0. Note that we get no useful
information out of this linear programming solution.
The above is a perfectly reasonable 0-1 programming formulation of the
lockbox problem. Note that many variations are possible (New York costs
more to operate in than other cities, South won’t send to L.A., and so on).
There are other formulations, however. For instance, consider the sixteen
constraints of the form

xij ≤ yj

These constraints also force a region to only use open lockboxes (check this!).
It might seem that a larger formulation is less efficient and therefore should
be avoided. This is not the case! If we solve the linear program with the
above constraints, we get the solution x11 = x24 = x34 = x44 = y1 = y4 = 1
with the rest equal to zero. In fact, we have an integer solution, which
must therefore be optimal! Different formulations can have very different

10
properties with respect to their associated linear program. One very active
research area is to take common problems and find good reformulations.
The above is an example of a fixed charge problem. There is a fixed charge
for opening a lockbox, but then it can be used as much as desired. There
are many other types of fixed charge problems, including the plant location
problems described in Murty. Similar techniques also apply (as described in
Murty) for a variety of constraints, such as batch size constraints (where if
an activity is engaged in at all, it must have a minimum level, i.e., xj = 0 or
xj ≥ lj ) and other types of “either-or” or disjunctive constraints.

2.4 Set Covering


To illustrate this model, consider the following location problem: A city is
reviewing the location of its fire stations. The city is made up of a number
of neighborhoods, as illustrated in Figure 1.
11
10

9
8
7

5
4

2
1

Figure 1: Map of the city

A fire station can be placed in any neighborhood. It is able to handle the

11
fires for both its neighborhood and any adjacent neighborhood (any neigh-
borhood with a non-zero border with its home neighborhood). The objective
is to minimize the number of fire stations used.
We can create one variable xj for each neighborhood j. This variable will
be 1 if we place a station in the neighborhood, and will be 0 otherwise. This
leads to the following formulation

Minimize x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10 + x11


subject to x1 + x2 + x3 + x4 ≥1
x1 + x2 + x3 + x5 ≥1
x1 + x2 + x3 + x4 + x5 + x6 ≥1
x1 + x3 + x4 + x6 + x7 ≥1
x2 + x3 + x5 + x6 + x8 + x9 ≥1
x3 + x4 + x5 + x6 + x7 + x8 ≥1
x4 + x6 + x7 + x8 ≥1
x5 + x6 + x7 + x8 + x9 + x10 ≥1
x5 + x8 + x9 + x10 + x11 ≥ 1
x8 + x9 + x10 + x11 ≥ 1
x9 + x10 + x11 ≥ 1
xj ∈ {0, 1} j = 1, . . . , 11

The first constraint states that there must be a station either in neighborhood
1 or in some adjacent neighborhood. The next constraint is for neighborhood
2 and so on. Notice that the constraint coefficient aij is 1 if neighborhood i is
adjacent to neighborhood j or if i = j and 0 otherwise. The jth column of the
constraint matrix represents the set of neighborhoods that can be served by
a fire station in neighborhood j. We are asked to find a set of such subsets j
that covers the set of all neighborhoods in the sense that every neighborhood
appears in the service subset associated with at least one fire station.
One optimal solution to this is x3 = x8 = x9 = 1 and the rest equal to 0.
This is an example of the set covering problem. The set covering problem
is characterized by having binary variables, ≥ constraints each with a right
hand side of 1, and having simply sums of variables as constraints. In gen-
eral, the objective function can have any coefficients, though here it is of a
particularly simple form.

12
2.4.1 Set Packing and Partitioning
Other problems involving relationships between a set and some of its subsets
are related to set covering. The set packing problem arises when each set
element must appear in at most one subset. In this case, the constraints are
of the less-than-or-equal form. The set partitioning problem arises when each
set element must appear in exactly one subset, and the constraints in this
problem are equality constraints.
The airline crew scheduling problem discussed in Murty is usually solved
in practice as a set partitioning problem, with exactly one crew assigned to
each flight leg. After all, there is only one crew actually flying the plane on
each leg. A crew that must ride a plane to another destination is said to
be deadheading. Since the costs associated with deadheading are different
from those associated with active duty, deadhead legs should not appear as
a consequence of the solution, but instead need to be factored into the duty
periods by the software that generates the pairings.

2.5 Traveling Salesperson Problem


Consider a traveling salesperson who must visit each of 20 cities before re-
turning home. She knows the distance between each of the cities and wishes
to minimize the total distance traveled while visiting all of the cities. In what
order should she visit the cities?
Let there be n cities, numbered from 1 up to n. For each pair of cities
(i, j) let cij be the cost of going from city i to city j or from city j to city i.
Let’s let xij be 1 if the person travels between cities i and j (either from city
i to city j or from j to i). This problem is known as the symmetric TSP.
In the assymetric TSP, the cost to travel in one direction may differ from
the cost to travel in the other, and the decision variables must distinguish
between the two directions. Clearly the assymetric problem is the more
general. Murty discusses the assymetric formulation, but we will concentrate
on the symmetric problem. P P
The objective is to minimize ni=1 i−1 j=1 cij xij . The constraints are harder
to find. Consider the following set:
X
xij = 2 for all i.
j6=i

These constraints say that every city must be visited. These constraints are
not enough, however, since it is possible to have multiple cycles (subtours),

13
rather than one big cycle (tour ) through all the points. To handle this
condition, we can use the following set of subtour elimination constraints:
XX
xij ≥ 2 for all S ⊂ N.
i∈S j ∈S
/

This set states that, for any subset of cities S, the tour must enter and exit
that set. These, together with xij ∈ {0, 1} is sufficient to formulate the
traveling salesperson problem (TSP) as an integer program.
Note however, that there are a tremendous number of constraints: for our
20-city problem, that number is roughly 524,288. For a 300-city problem, this
would amount to 101851798816724304313422284420468908052573419683296
8125318070224677190649881668353091698688 constraints. Try putting that
into AMPL!
Despite the apparent complexity of this formulation, it lies at the heart
of the most promising current approach to solving medium (100–1000 city)
TSPs. We will see this again in the cutting plane section. Other forms of
subtour elimination constraints are possible, but they suffer from the same
explosive rate of growth in number. Subtour elimination constraints for the
assymetric problem are equally difficult. In fact, Murty does not explicitly
write them down at all!

Exercise 2 (Optional) Orders from 5 different destinations are delivered


from a central warehouse. Routes are assigned to different carriers. Suppose
that there are 9 feasible routes with each route specifying the destinations to
which orders are delivered.
Route 1: 1,3,4
Route 2: 1,4,5
Route 3: 1,2,5
Route 4: 2,3,5
Route 5: 2,4,5
Route 6: 3,4,5
Route 7: 1
Route 8: 2,3
Route 9: 4,5
The length of the routes are 10, 12, 12, 13, 11, 9, 7, 8 and 8 respectively.
Formulate an integer program that will result in the shortest total distance
routing. Each destination must be on at least one of the chosen routes.

14
Exercise 3 (Optional) Consider a job-shop scheduling problem involving
eight operations on a single machine with a total of two end products. Let
pj be the processing time for the jth operation. Since each operation re-
quires a machine setup, it is assumed that any operation once started must
be completed before a new operation can be undertaken on the machine. The
sequencing of the operations must satisfy the following precedence relation-
ships: Operations 1 and 2 must precede Operation 4 (i.e. both Operations 1
and 2 must be completed before Operation 4 can be started), Operations 4 and
5 precede 7, Operation 3 precedes 6 and, finally, Operations 5 and 6 precede
8. Once Operation 7 is completed, Product 1 is available. Similarly, once
Operation 8 is completed, Product 2 is available. The due date for Product
1 is d1 . The objective is to minimize the delivery date of Product 2 while
meeting the due date on Product 1.

3 Solving Integer Programs


We have gone through a number of examples of integer programs. The text
gives a few others. A natural question is “How can we get solutions to these
models?” There are two common approaches. Historically, the first method
developed was based on cutting planes (adding constraints to force integral-
ity). In the last twenty years or so, however, the most effective technique has
been based on dividing the problem into a number of smaller problems in a
method called branch and bound. Recently (the last ten years or so), cutting
planes have made a resurgence in the form of facets and polyhedral charac-
terizations. All these approaches involve solving a series of linear programs.
So that is where we will begin.

3.1 Relationship to Linear Programming


Given an integer program

Minimize (or maximize) cx


subject to Ax = b (IP)
x ≥ 0 and integer,

15
there is an associated linear program called the linear relaxation formed by
dropping the integrality restrictions:

Minimize (or maximize) cx


subject to Ax = b (LR)
x ≥ 0.

Since (LR) is less constrained than (IP), the following are immediate:
• If (IP) is a minimization, the optimal objective value for (LR) is less
than or equal to the optimal objective for (IP).

• If (IP) is a maximization, the optimal objective value for (LR) is greater


than or equal to that of (IP).

• If (LR) is infeasible, then so is (IP).

• If (LR) is optimized by integer variables, then that solution is feasible


and optimal for (IP).

• If the objective function coefficients are integer, then for minimization,


the optimal objective for (IP) is greater than or equal to the “round
up” of the optimal objective for (LR). For maximization, the optimal
objective for (IP) is less than or equal to the “round down” of the
optimal objective for (LR).
So solving (LR) does give some information: it gives a bound on the
optimal value, and, if we are lucky, may give the optimal solution to IP. We
saw, however, that rounding the solution of LR will not in general give the
optimal solution of (IP). In fact, for some problems it is difficult to round
and even get a feasible solution.

Exercise 4 (Optional) Consider the problem

Maximize 20x1 + 10x2 + 10x3


subject to 2x1 + 20x2 + 4x3 ≤ 15
6x1 + 20x2 + 4x3 = 20
x1 , x2 , x3 ≥ 0 integer.

Solve this problem as a linear program. Then, show that it is impossible to


obtain a feasible integer solution by rounding the values of the variables.

16
3.2 Branch and Bound
We will explain branch and bound by using the capital budgeting example
from the previous section. In that problem, the model is
Maximize 8x1 + 11x2 + 6x3 + 4x4
subject to 5x1 + 7x2 + 4x3 + 3x4 ≤ 14
xj ∈ {0, 1} j = 1, . . . 4.
The linear relaxation solution is x1 = 1, x2 = 1, x3 = 0.5, x4 = 0 with a
value of 22. We know that no integer solution will have value more than 22.
Unfortunately, since x3 is not integer, we do not have an integer solution yet.
We want to force x3 to be integer. To do so, we branch on x3 , creating
two new problems. In one, we will add the constraint x3 = 0. In the other,
we add the constraint x3 = 1. This is illustrated in Figure 2.

Fractional
z = 22

x3 = 0 x3 = 1
Fractional Fractional
z = 21.65 z = 21.85

Figure 2: First Branching

Note that any optimal solution to the overall problem must be feasible to
one of the subproblems. If we solve the linear relaxations of the subproblems,
we get the following solutions:
• x3 = 0: objective 21.65, x1 = 1, x2 = 1, x3 = 0, x4 = 0.667;

17
• x3 = 1: objective 21.85, x1 = 1, x2 = 0.714, x3 = 1, x4 = 0.
At this point we know that the optimal integer solution is no more than
21.85 (we actually know it is less than or equal to 21 (Why?)), but we still
do not have any feasible integer solution. So, we will take a subproblem and
branch on one of its variables. In general, we will choose the subproblem as
follows:
• We will choose an active subproblem, which so far only means one we
have not chosen before, and
• We will choose the subproblem with the highest solution value (for
maximization) (lowest for minimization).
In this case, we will choose the subproblem with x3 = 1, and branch on
x2 . After solving the resulting subproblems, we have the branch and bound
tree in Figure 3.
The solutions are:
• x3 = 1, x2 = 0: objective 18, x1 = 1, x2 = 0, x3 = 1, x4 = 1;
• x3 = 1, x2 = 1: objective 21.8, x1 = 0.6, x2 = 1, x3 = 1, x4 = 0.
We now have a feasible integer solution with value 18. Furthermore, since
the x3 = 1, x2 = 0 problem gave an integer solution, no further branching
on that problem is necessary. It is not active due to integrality of solution.
There are still active subproblems that might give values more than 18. Using
our rules, we will branch on problem x3 = 1, x2 = 1 by branching on x1 to
get Figure 4.
The solutions are:
• x3 = 1, x2 = 1, x1 = 0: objective 21, x1 = 0, x2 = 1, x3 = 1, x4 = 1;
• x3 = 1, x2 = 1, x1 = 1: infeasible.
Our best integer solution now has value 21. The subproblem that gener-
ates that is not active due to integrality of solution. The other subproblem
generated is not active due to infeasibility. There is still a subproblem that
is active. It is the subproblem with solution value 21.65. By our “round-
down” result, there is no better solution for this subproblem than 21. But
we already have a solution with value 21. It is not useful to search for an-
other such solution. We can fathom this subproblem based on the above

18
Fractional
z = 22

x3 = 0 x3 = 1
Fractional Fractional
z = 21.65 z = 21.85

x3 = 1, x2 = 0 x3 = 1, x2 = 1
Integer Fractional
z = 18 z = 21.8
INTEGER

Figure 3: Second Branching

19
Fractional
z = 22

x3 = 0 x3 = 1
Fractional Fractional
z = 21.65 z = 21.85

x3 = 1, x2 = 0 x3 = 1, x2 = 1
Integer Fractional
z = 18 z = 21.8
INTEGER

x3 = 1, x2 = 1, x1 = 0 x3 = 1, x2 = 1, x1 = 1
Integer Infeasible
z = 21
INTEGER INFEASIBLE

Figure 4: Third Branching

20
bounding argument and mark it not active. There are no longer any active
subproblems, so the optimal solution value is 21.
We have seen all parts of the branch and bound algorithm. The essence
of the algorithm is as follows:

1. Solve the linear relaxation of the problem. If the solution is integer,


then we are done. Otherwise create two new subproblems by branching
on a fractional variable.

2. A subproblem is not active when any of the following occurs:

(a) You used the subproblem to branch on,


(b) All variables in the solution are integer,
(c) The subproblem is infeasible,
(d) You can fathom the subproblem by a bounding argument.

3. Choose an active subproblem and branch on a fractional variable. Re-


peat until there are no active subproblems.

That’s all there is to branch and bound! Depending on the type of prob-
lem, the branching rule may change somewhat. For instance, if x is restricted
to be integer (but not necessarily 0 or 1), then if x = 4.27 your would branch
with the constraints x ≤ 4 and x ≥ 5 (not on x = 4 and x = 5).
In the worst case, the number of subproblems can get huge. For many
problems in practice, however, the number of subproblems is quite reason-
able.
For an example of a huge number of subproblems, try the following in
AMPL:

var x0 binary;
var x{1..17} binary;

maximize z: -x0 + sum{j in 1..17} 2 * x[j];


subject to c: x0 + sum{j in 1..17} 2 * x[j] <= 17;

Note that this problem has only 18 variables and only a single constraint.
CPLEX looks at 48,619 subproblems, taking about 90 seconds on a Sun Sparc
10 workstation, before deciding the optimal objective is 16. LINGO (another
math programming package) on a 16MHz 386 PC (with math coprocessor)

21
looks at 48,000+ subproblems and takes about five hours. The 100-variable
version of this problem would take about 1029 subproblems or about 3 × 1018
years (at 1000 subproblems per second). Luckily, most problems take far less
time.

Exercise 5 (Optional) Solve the following problem by the branch and bound
algorithm. For convenience, always select x1 as the branching variable when
both x1 and x2 are fractional.

Maximize x1 + x2
subject to 2x1 + 5x2 ≤ 16
6x1 + 5x2 ≤ 30
x1 , x2 ≥ 0 and integer.

Exercise 6 (Optional) Repeat the preceeding exercise assuming that x1 only


is restricted to integer values.

Exercise 7 (Optional) Consider the following cargo-loading problem, where


five items are to be loaded on a vessel. The weights wi and the volume vi per
unit of the different items as well as their corresponding values ri are tabulated
as follows.
Item i wi vi ri
1 5 1 4
2 8 8 7
3 3 6 6
4 2 5 5
5 7 4 4

The maximum cargo weight and volume are given by W = 112 and V =
109, respectively. It is required to determine the most valuable cargo load in
discrete units of each item. Formulate the problem as an integer program and
solve by AMPL.

3.3 Cutting Plane Techniques


There is an alternative to branch and bound called cutting planes which
can also be used to solve integer programs. The fundamental idea behind
cutting planes is to add constraints to a linear program until the optimal

22
basic feasible solution takes on integer values. Of course, we have to be
careful which constraints we add: we would not want to change the problem
by adding the constraints. We will add a special type of constraint called
a cut. A cut relative to a current fractional solution satisfies the following
criteria:

1. every feasible integer solution is feasible for the cut, and

2. the current fractional solution is not feasible for the cut.

2nd Constraint
This is illustrated in Figure 5.
Fractional solution

A Cut
1st Constraint

Figure 5: A cut

There are two ways to generate cuts. The first, called Gomory cuts,
generates cuts from any linear programming tableau. This has the advantage
of “solving” any problem but has the disadvantage that the method can be
very slow. The second approach is to use the structure of the problem to
generate very good cuts. The approach needs a problem-by-problem analysis,
but can provide very efficient solution techniques.

23
3.3.1 General Cutting Planes
Consider the following integer program:

Maximize 7x1 + 9x2


subject to −x1 + 3x2 ≤ 6
7x1 + x2 ≤ 35
x1 , x2 ≥ 0 integer.

If we ignore integrality, we get the following optimal tableau (with the


updated columns and reduced costs shown for nonbasic variables):

Variable x1 x2 s1 s2 −z RHS
x2 0 1 7/22 1/22 0 7/2
x1 1 0 -1/22 3/22 0 9/2
−z 0 0 28/11 15/11 1 63

Let’s look at the first constraint:

x2 + 7/22s1 + 1/22s2 = 7/2

We can manipulate this to put all of the integer parts on the left side, and
all the fractional parts on the right to get:

x2 − 3 = 1/2 − 7/22s1 − 1/22s2

Now, note that the left hand side consists only of integers, so the right hand
side must add up to an integer. Which integer can it be? Well, it consists of
some positive fraction minus a series of positive values. Therefore, the right
hand side can only be 0, −1, −2, . . . ; it cannot be a positive value. Therefore,
we have derived the following constraint:

1/2 − 7/22s1 − 1/22s2 ≤ 0.

This constraint is satisfied by every feasible integer solution to our original


problem. But, in our current solution, s1 and s2 both equal 0, which is
infeasible to the above constraint. This means the above constraint is a cut,
called the Gomory cut after its discoverer. We can now add this constraint
to the linear program and be guaranteed to find a different solution, one that
might be integer.

24
We can also generate a cut from the other constraint. Here we have to
be careful to get the signs right:
x1 − 1/22s1 + 3/22s2 = 9/2
x1 + (−1 + 21/22)s1 + 3/22s2 = 4 + 1/2
x1 − s1 − 4 = 1/2 − 21/22s1 − 3/22s2
gives the constraint
1/2 − 21/22s1 − 3/22s2 ≤ 0.
In general, let bac be defined as the largest integer less than or equal to
a. For example, b3.9c = 3, b5c = 5, and b−1.3c = −2.
If we have a constraint
X
xk + ai xi = b
with b not an integer, we can write each ai = bai c + a0i , for some 0 ≤ a0i < 1,
and b = bbc + b0 for some 0 < b0 < 1. Using the same steps we get:
X X
xk + bai cxi − bbc = b0 − a0i xi
to get the cut
X
b0 − a0i xi ≤ 0.
This cut can then be added to the linear program and the problem resolved.
The problem is guaranteed not to get the same solution.
This method can be shown to guarantee finding the optimal integer solu-
tion. There are a couple of disadvantages:
1. Round-off error can cause great difficulties: Is that 3.000000001 really
a 3, or should I generate a cut? If I make the wrong decision I could
either cut off a feasible solution (if it is really a 3 but I generate a cut)
or I could end up with an infeasible solution (if it is not a 3 but I treat
it as one).
2. The number of constraints that are generated can be enormous. Just
like branch and bound can generate a huge number of subproblems,
this technique can generate a huge number of constraints.
The combination of these makes this cutting plane technique impractical
by itself. Recently however, more powerful techniques have been discovered
for special problem structure. This is the subject of the next section.

25
3.3.2 Cuts for Special Structure
Gomory cuts have the property that they can be generated for any integer
program. Their weakness is their downfall: they do not seem to cut off
much more than the linear programming solution in practice. An alternative
approach is to generate cuts that are specially designed for the particular
application. We saw that in a simple form in the lockbox problem,
P where we
used the constraints xij ≤ yj because they were stronger than i xij ≤ 100yj .
In this section, we examine the symmetric traveling salesperson problem.
Recall that there is no good, compact formulation for the TSP. Earlier,
we generated a formulation as follows:
X
Minimize cij xij
Xij
subject to xij = 2 for all i
j6=i X
X
xij ≥ 2 for all S ⊂ N
i∈S j ∈S
/
xij ∈ {0, 1} for all i, j.

Recall that in the second set of constraints (called subtour elimination con-
straints) there are many, many constraints. One approach is to initially
ignore these constraints and simply solve the problem over the first set of
constraints. Suppose we have a six node problem as shown in Figure 6.
This problem can be formulated as follows (ignoring subtour constraints):

Minimize 4x12 + 4x13 + 3x14 + 4x23 + 2x25


+ 3x36 + 4x45 + 4x46 + 4x56
subject to x12 + x13 + x14 = 2
x12 + x23 + x25 = 2
x13 + x23 + x36 = 2
x14 + x45 + x46 = 2
x25 + x45 + x56 = 2
x36 + x46 + x56 = 2
xij ∈ {0, 1} for all i, j

Solving the LP relaxation in AMPL gives:


set NODES;
set ARCS within {NODES, NODES};

26
4
4

6
4
4

5
2

3
3

2
4

4
1

3
4

Figure 6: Six node traveling salesperson problem

param cost{ARCS};

var x{ARCS} >= 0, <= 1;

minimize z: sum{(i,j) in ARCS} cost[i,j] * x[i,j];


subject to incidence{i in NODES}:
sum{(i,j) in ARCS} x[i,j] + sum{(j,i) in ARCS} x[j,i] = 2;

--------------------------

set NODES := 1 2 3 4 5 6;
param: ARCS: cost := 1 2 4, 1 3 4, 1 4 3, 2 3 4, 2 5 2, 3 6 3,
4 5 4, 4 6 4, 5 6 4;

--------------------------

ampl: solve;
[...CPLEX messages deleted...]
ampl: display z, x;
z = 20

x :=

27
1 2 0.5
1 3 0.5
1 4 1
2 3 0.5
2 5 1
3 6 1
4 5 0.5
4 6 0.5
5 6 0.5
;
This solution, while obviously not a tour, actually satisfies all of the subtour
elimination constraints. At this point we have three choices:
1. We can do branch and bound on our current linear program, or

2. We can apply Gomory cuts to the resulting tableau, or

3. We can try to find other classes of cuts to use.

In fact, for the traveling salesperson problem, there are a number of other
classes of cuts to use. These cuts look at different sets of arcs and try to say
something about how a tour can use them. For instance, look at the set of
arcs in Figure 7.
It is fairly easy to convince yourself that no tour can use more than 4 of
these arcs. This is an example of a broad class of inequalities called comb
inequalities. This means that the inequality stating that the sum of the x
values on these arcs is less than or equal to 4 is a valid inequality (it does not
remove any feasible solution to the integer program). Our solution, however,
has 4.5 units on those arcs. Therefore, we can add a constraint to get the
following formulation and result:
set NODES;
set ARCS within {NODES, NODES};
param cost{ARCS};

var x{ARCS} >= 0, <= 1;

minimize z: sum{(i,j) in ARCS} cost[i,j] * x[i,j];


subject to incidence{i in NODES}:

28
4

6
5
2
1

3
Figure 7: Arc Set for Comb Inequality

sum{(i,j) in ARCS} x[i,j] + sum{(j,i) in ARCS} x[j,i] = 2;


subject to comb:
x[1,2] + x[1,3] + x[1,4] + x[2,3] + x[2,5] + x[3,6] <= 4;

--------------------

ampl: solve;
[...CPLEX messages deleted...]
ampl: display z, x;
z = 21

x :=
1 2 1
1 3 1
1 4 0
2 3 0
2 5 1
3 6 1
4 5 1
4 6 1
5 6 0
;

29
So, we have the optimal solution.
This method, perhaps combined with branch and bound if the solution
is still fractional after all known inequalities are examined, has proven to be
a very practical and robust method for solving medium-sized TSPs. Futher-
more, many classes of inequalities are known for other combinatorial opti-
mization problems. This approach, seriously studied only for the last ten
years or so, has greatly increased the size and type of instances that can be
effectively solved to optimality.

Exercise 8 (Optional) For the knapsack problem

Maximize 8x1 + 11x2 + 6x3 + 4x4


subject to 5x1 + 7x2 + 4x3 + 3x4 ≤ 14
xj ∈ {0, 1} j = 1, . . . , 4

show that the following inequalities do not remove any feasible solutions:

x1 + x2 + x3 ≤ 2,
x1 + x2 + x4 ≤ 2.

Use these inequalities to solve the LP relaxation of the problem by AMPL


(i.e., with the 0-1 restrictions on xj replaced by 0 ≤ xj ≤ 1).

30
4 Solutions to Some Optional Problems
Exercise 1: The formulation is:
X
10
Maximize pj xj
j=1
X
10
subject to xj = 5
j=1
x2 − x3 ≤ 0
x1 + x7 + x8 ≤ 2
x3 + x5 ≤ 1
x4 + x5 ≤ 1
xj ∈ {0, 1} j = 1, . . . , 10.

Exercise 2: Let xj be a 0, 1 variable which equals 1 if route j is used, 0


otherwise. Then the vehicle routing problem can be formulated as a set
covering problem:

Minimize 10x1 + 12x2 + 12x3 + 13x4 + 11x5


+ 9x6 + 7x7 + 8x8 + 8x9
subject to x1 + x2 + x3 + x7 ≥ 1
x3 + x4 + x5 + x8 ≥ 1
x1 + x4 + x6 + x8 ≥ 1
x1 + x2 + x5 + x6 + x9 ≥ 1
x2 + x3 + x4 + x5 + x6 + x9 ≥ 1
xj = 0 or 1 for all j.

Exercise 3: Let xj = starting time of operation j.



0 if operation j is performed before i
yij =
1 if operation i is performed before j.

31
Then the formulation is:
Minimize x8
subject to xi + pi ≤ xj for (i, j) = (1, 4), (2, 4), (3, 6),
(4, 7), (5, 7), (5, 8), (6, 8)
x7 + p7 ≤ d1 
Myij + xi − xj ≥ pj
for (i, j) = (1, 2), (1, 3), (1, 5),
M(1 − yij ) + xj − xi ≥ pi
(1, 6), (1, 8), (2, 3), (2, 5), (2, 6),
(2, 8), (3, 4), (3, 5), (3, 7), (4, 5),
(4, 6), (4, 8), (5, 6), (6, 7), (7, 8)
xj = 0 or 1 for j = 1, . . . , 8.

The first set of constraints are the precedence constraints and the last two
sets are the noninterference constraints.

Exercise 4: First we solve the problem as a linear program with CPLEX.


The solution is x1 = 3.33333, x2 = x3 = 0. Rounding it yields x1 = 3,
x2 = x3 = 0 which fails to satisfy the constraint 6x1 + 20x2 + 4x3 = 20.
In fact, the only feasible integer solution is

x1 = 2, x2 = 0, x3 = 2,

and it cannot be obtained by simple rounding.

32
Exercise 5: The enumeration tree is given in Figure 8.
Three optimum integer solutions were found, namely
  
x1 = 3 x1 = 4 x1 = 5
x2 = 2 x2 = 1 x2 = 0

each with value z = 5.

Exercise 6
From the enumeration tree of Exercise 5, we see that only one branch-
ing is necessary since both subproblems z2 and z3 are inactive by reason of
integrality. The better solution is x1 = 4, x2 = 1.2 with value z3 = 5.2.

Exercise 7

CPLEX> display problem


Maximize
obj: 4 X1 + 7 X2 + 6 X3 + 5 X4 + 4 X5
Subject To
c1: 5 X1 + 8 X2 + 3 X3 + 2 X4 + 7 X5 <= 112
c2: X1 + 8 X2 + 6 X3 + 5 X4 + 4 X5 <= 109
Bounds
X1 >= 0
X2 >= 0
X3 >= 0
X4 >= 0
X5 >= 0
Integers
X1 X2 X3 X4 X5
CPLEX> opt
No MIP presolve or aggregator reductions.
Presolve time = 0.00 sec.

Nodes Cuts/
Node Left Objective IInf Best Integer Best Node ItCnt

0 0 153.6087 2 153.6087 4
* 1 1 151.0000 0 151.0000 153.3333 5

33
Fractional
z1 = 5.3, x1 = 3.5, x2 = 1.8

x1 ≤ 3 x1 ≥ 4
Integer Fractional
z2 = 5, x1 = 3, x2 = 2 z3 = 5.2 x1 = 4, x2 = 1.2

x1 ≥ 4, x2 ≤ 1 x1 ≥ 4, x2 ≥ 2
Fractional Infeasible
z4 = 5.16 x1 = 4.16, x2 = 1

x1 ≥ 4, x2 ≤ 1, x1 ≤ 4 x1 ≥ 4, x2 ≤ 1, x1 ≥ 5
Integer Integer
z5 = 5 x1 = 4, x2 = 1
INTEGER INTEGER

Figure 8: Enumeration tree

34
Integer optimal solution: Objective = 1.5100000000e+02
Solution time = 0.00 sec. Iterations = 10 Nodes = 6

CPLEX> display solution -


Variable Name Solution Value
X1 14.000000
X4 19.000000
All other variables in the range 1-5 are zero.

35
Exercise 8
Since x1 = x2 = x3 = 1 does not satisfy the knapsack constraint 5x1 +
7x2 +4x3 +x4 ≤ 14, it follows that x1 +x2 +x3 ≤ 2 must hold for all solutions
of the knapsack problem.
Similarly for x1 + x2 + x4 ≤ 2.

CPLEX> display problem -


Maximize
obj: 8 X1 + 11 X2 + 6 X3 + 4 X4
Subject To
c1: 5 X1 + 7 X2 + 4 X3 + 3 X4 <= 14
c2: X1 + X2 + X3 <= 2
c3: X1 + X2 + X4 <= 2
Bounds
0 <= X1 <= 1
0 <= X2 <= 1
0 <= X3 <= 1
0 <= X4 <= 1
CPLEX> opt
No LP presolve or aggregator reductions.
Presolve time = 0.00 sec.

Iteration Log . . .
Iteration: 1 Objective = 11.000000

Primal - Optimal: Objective = 2.1000000000e+01


Solution time = 0.00 sec. Iterations = 5 (0)

CPLEX> display solution -


Variable Name Solution Value
X2 1.000000
X3 1.000000
X4 1.000000
All other variables in the range 1-4 are zero.

36

You might also like