Integer Programming
Integer Programming
Li Xiaolei
Introduction to Integer Programming
max z 3x1 2 x2
s.t. x1 x2 6 (1)
x1 , x2 0, x1 , x2 integer
0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4
x1
Introduction to Integer Programming
If the feasible region for a pure IP’s LP
relaxation is bounded, the feasible region for
the IP will consist of a finite number of points.
In theory, such an IP could be solved by
enumerating the z-values for each feasible
point and determining the feasible point
having the largest z-value.
A naive approach for solving an IP: First solve
the LP relaxation; then round off each
variable that required to be an integer to the
nearest integer.
Formulating Integer Programming
Problems
Example
Stockco is considering four investments. Investment
1 will yield a net present value (NPV) of $16,000;inve
stment 2, an NPV of $22,000;investment 3, an NPV o
f $12,000; and investment 4, an NPV of $8000. Each
investment requires a certain cash outflow at the pres
ent time: investment 1, $5000; investment 2, $7000; i
nvestment 3, $4000; and investment 4, $3000.At pres
ent, $14,000 is available for investment. Formulate a
nd tell Stockco how to maximize the NPV obtained fr
om investments 1-4.
Formulating Integer Programming
Problems
Solution
We begin by defining a variable for each decision that Sto
ckco must make. This leads us to define a 0-1 variable:
1 if investment j is made
x j ( j 1,2,3,4)
0 otherwise
The NPV obtained by Stockco (in thousands of dollars) is
Total NPV obtained by Stockco=16x1+22x2+12x3+8x4
The Stockco’s objective function is
max z=16x1+22x2+12x3+8x4
Formulating Integer Programming
Problems
Stockco faces the constraint that at most $14,000 can b
e invested.
Total amount invested (in thousands of dollars)=5x1+7x2
+4x3+3x4
Then, x1,x2,x3,and x4 must satisfy
5x1+7x2+4x3+3x4≤14
Combining the constraints yields the following 0-1 IP:
max z=16x1+22x2+12x3+8x4
s.t. 5x1+7x2+4x3+3x4≤14
xj=0 or 1 (j=1,2,3,4)
The Branch-and-Bound method for
solving pure IP problems
Branch-and-Bound methods find the optimal s
olution to an IP by efficiently emumerating the
points in a subproblem’s feasible region.
Elementary but important observation:
If you solve the LP relaxation of a pure IP and
obtain a solution in which all variables are int
egers, then the optimal solution to the LP rela
xation is also the optimal solution to the IP.
The Branch-and-Bound method for
solving pure IP problems
Example 9
The Telfa corporation manufactures tables an
d chairs. A table requires 1 hour of labor and
9 square board feet of wood, and a chair requ
ires 1 hour of labor and 5 square board feet o
f wood. Currently, 6 hours of labor and 45 squ
are board feet of wood are available. Each ta
ble contributes $8 to profit, and each chair co
ntributes $5 to profit. Formulate and solve an
IP to maximize Telfa’s profit.
The Branch-and-Bound method for
solving pure IP problems
Solution
Let
x1=number of tables manufactured
x2=number of chairs manufactured
Since x1 and x2 must be integers, Telfa wants to
solve the following IP:
max z=8x1+5x2
s.t. x1+x2≤6 (labor constraint)
9x1+5x2≤45 (wood constraint)
x1,x2≥0;x1,x2 integer
The Branch-and-Bound method for
solving pure IP problems
The branch-and-bound method begins by sol
ving the LP relaxation of the IP. If all the decis
ion variables assume integer values in the opt
imal solution to the LP relaxation, then the opt
imal solution to the LP relaxation will be the o
ptimal solution to the IP. We call the LP relax
ation subproblem 1.
The Branch-and-Bound method for
solving pure IP problems
Unfortunately, the optimal solution to the LP
relaxation is z=165/4,x1=15/4,x2=9/4
10
8
9x1+5x2=45
7
6 x1+x2=6
2 z=20
0
0 1 2 3 4 5 6 7
The Branch-and-Bound method for
solving pure IP problems
We know that
Optimal z-value for LP relaxation
≥optimal z-value for IP
This implies that the optimal z-value for the IP
cannot exceed 165/4. Thus, the optimal z-val
ue for the LP relaxation is an upper bound fo
r Telfa’s profit.
The Branch-and-Bound method for
solving pure IP problems
Partition the feasible region for the LP relaxati
on in an attempt to find out more about the lo
cation of the IP’s optimal solution.
We arbitrarily choose a variable that is fractio
nal in the optimal solution to the LP relaxatio
n-say, x1. Observe that every point in the feasi
ble region for the IP must have either x1≤3 or
x1≥4. Then, we ‘branch’ on the variable x1 an
d create the following two additional subprobl
em.
The Branch-and-Bound method for
solving pure IP problems
Subproblem 2 subproblem 1+ constraint x1≥4
Subproblem
10
3 subproblem 1+ constraint x 1 ≤3
9 Feasible region for
subproblem 2
8
9x1+5x2=45 Feasible region for
7
subproblem 3
6 x1+x2=6
5 z=39
4 x1=3
z=41
3 F x2=3
x1=4
z=20
2 C x2=9/5
1
0
0 1 2 3 4 5 6 7
The Branch-and-Bound method for
solving pure IP problems
We say that subproblem 2 and 3 were create
d by branching on x1.
Observe that neither subproblem 2 nor subpr
oblem 3 include3 any points with x1=15/4. Thi
s means that the optimal solution to the LP rel
axation cannot recur when we solve subprobl
em 2 or subproblem 3.
Also, the feasible regions for subproblem2 an
d subproblem 3 have no points in common.
The Branch-and-Bound method for
solving pure IP problems
We choose any subproblem that has not yet b
een solved as an LP. We arbitrarily choose to
solve subproblem 2., then we get the optimal
solution to subproblem 2 is z=41, x1=4, x2=9/5
(point C).
Our accomplishment to date are summarized
in Figure.
A display of all subproblems th Subproblem 1
at have been created is called t=1
z 165 / 4
a tree. Each subproblem is refe x1 15 / 4
rred to as a node of the tree, a x 2 9 / 4
nd each line connecting two no x1 4 x1 3
des of the tree is called an arc.
The label t indicates the chron Subproblem 2
ological order in which the su z 41
t=2
bproblems are solved. x1 4 Subproblem 3
x 2 9 / 5
Since the optimal solution to subproblem 2 di
d not yield an all-integer solution, we choose t
o use subproblem 2 to create two new subpro
blems.
We choose a fractional-valued variable in the
optimal solution to subproblem 2 and then bra
nch on that variable.
Since x is the only fractional variable in the o
2
ptimal solution to subproblem 2, we branch o
n x2.
We partition the feasible region for subproble
m 2 into those points having x2≥2 and x2≤1. T
his creates the following two subproblems:
Subproblem 4
subproblem 1+constraints x1≥ 4 and x2≥2
=subproblem 2+constraint x2≥2.
Subproblem 5
subproblem 1+constraints x1≥ 4 and x2≤1
=subproblem 2+constraint x2 ≤1.
The feasible regions for subproblems 4 and 5.
10
2 z=20 x1=40/9,
1
I x2=1
0
0 1 2 3 4 5 6 7
Our accomplishment to date are summarized
in Figure. Subproblem 1
t=1
z 165 / 4
x1 15 / 4
x 2 9 / 4
x1 4 x1 3
Subproblem 2
When further branching t=2
z 41
on a subproblem cannot x1 4 Subproblem 3
yield any useful informati x 2 9 / 5
on, we say that the subp x 2 2 x 2 1
roblem (or node) is fath
omed. Subproblem 4 subproblem 5
t=3 infeasible
LIFO (last-in-first-out) rule: we choose to solv
e the most recently created subproblem.
The LIFO rule implies that the subproblem 5 s
hould be solved next.
From figure, we see that the optimal solutiont
o subproblem 5 is point I: z=365/9, x1=40/9, x2
=1. This solution does not yield any immediat
ely useful information, so we choose to partiti
on subproblem 5’s feasible region by branchi
ng on the fractional-valued variable x1.
This yields two new subproblems:
Subproblem 6 subproblem 5+constraint x1≥5.
Subproblem 7 subproblem 5+constraint x1≤4.
10
2 z=20
H I
1
0 B A
0 1 2 3 4 5 6 7
Together, subproblems 6 and 7 include all int
eger points that were included in the feasible
region for subproblem 5. Also, no point havin
g x1=40/9 can be in the feasible region for sub
problem 6 or subproblem 7. Thus, the optimal
solution to subproblem 5 will not recur when
we solve subproblem 6 and 7.
Subproblems 3,6,and 7 are now unsolved.
Subproblem 1
t=1
z 165 / 4
x1 15 / 4
x 2 9 / 4
x1 4 x1 3
Subproblem 2
t=2
z 41
x1 4 Subproblem 3
x 2 9 / 5
x 2 2 x 2 1
Subproblem 4 subproblem 5
t=3 Infeasible z=365/9
x1 =40/9
x2 =1
x1 5 x1 4
Subproblem 6 Subproblem 7
The LIFO rule implies that we next solve subp
roblem 6 or 7. We arbitrarily choose to solve s
ubproblem 7.
From figure, we see that the optimal solution t
o subproblem 7 is point H: z=37,x1=4,x2=1.
Since both x1 and x2 assume integer values,
this solution with z=37 is feasible for the origi
nal IP.
Since the subproblem 7 cannot yield a solutio
n with z>37, the subproblem has been fathom
ed.
A solution obtained by solving a subproblem i
n which all variables have inter values is a ca
ndidate solution. Since the candidate solutio
n may be optimal, we must keep a candidate
solution until a better solution to the IP is foun
d. We have a feasible solution to the original I
P with z=37, so we may conclude that the opti
mal z-value for the IP≥37. thus, th z-value for
the candidate solution is a lower bound on th
e optimal z-value for the original IP. We note
LB=37.
The remaining unsolved subproblem are
6 and 3.
Subproblem 1
z 165 / 4
t=1
x1 15 / 4
x 2 9 / 4
x1 4 x1 3
Subproblem 2
z 41
t=2
x1 4 Subproblem 3
x 2 9 / 5
x 2 2 x 2 1
Subproblem 4 subproblem 5
t=3 Infeasible z=365/9
x1 =40/9
x2 =1
x1 5 x1 4
Subproblem 6 Subproblem 7
z=40 z=37
t=6 x1 =5 t=5 x1 =4
x2 =0 x2 =1
LB=37 Candidate solution
Candidate solution
From figure, we find that the optimal solution t
o subproblem 3 is point F:z=39,x1=x2=3.
Since subproblem 3 yield a z-value exceeding
the current lower boundof 40, subproblem 3 c
annot yield the optimal solution to the original
IP.
Only subproblem 6 can yield the optimal solut
ion to IP.
Subproblem 1
z 165 / 4
t=1
x1 15 / 4
x 2 9 / 4
x1 4 x1 3
Subproblem 2 Subproblem 3
z 41 z=39
t=2 t=7 x1 =3
x1 4
x2 =3
x 2 9 / 5 LB=40
x 2 2 x 2 1
Subproblem 4 subproblem 5
t=3 Infeasible z=365/9
x1 =40/9
x2 =1
x1 5 x1 4
Subproblem 6 Subproblem 7
z=40 z=37
t=6 x1 =5 t=5 x1 =4
x2 =0 x2 =1
Candidate solution Candidate solution
Key aspects of the branch-and-bound
method for solving pure IPs
Step1 If it is unnecessary to branch on a sub
problem, it is fathomed. The following three si
tuations result in a subproblem being fathome
d:
The subproblem is infeasible;
The subproblem yields an optimal solution in
which all variables have integer values;
The optimal z-value for the subproblem does n
ot exceed (in a max problem) the current LB.
Key aspects of the branch-and-bound
method for solving pure IPs
Step 2 A subproblem may be eliminated from
consideration in the following situations:
The subproblem is infeasible;
The LB (representing the z-value of the best c
andidate to date) is at least as large as the z-v
alue for the subproblem.
Choosing approaches
The most widely used is the LIFO rule, which choose
s to solve the most recently created subproblem. LIF
O leads us down one side of the branch-and-bound tr
ee and quickly finds a candidate solution. Then we ba
cktrack our way up to the top of the other side of the
tree.
The second commonly used method is jumptracking.
The jumptracking approach solves all the problems b
y the branching. Then it branches again on the node
with the best z-value. It usually creates more subprob
lems and requires more computer storage than backt
racking. It leads us more quickly to the best z-value.
The Branch-and-Bound Method for solving
Mixed Integer Programming Problems
In a mixed IP, some variables are required to
be integers and others are allowed to be eithe
r integers or nonintegers.
To solve a mixed IP by branch-and-bound, w
e branch only on variables that are required t
o be integers. Also, for a solution to a subpro
blem to be a candidate solution, it need only
assign integer values to those variables that a
re required to be integers.
Solving Combinatorial Optimization
Problems by the Branch-and-Bound Method
A combinatorial optimization problem is any
optimization problem that has a finite number
of feasible solutions. A branch-and-bound
approach is often the most efficient way to
solve them.
Examples of combinatorial optimization
problems:
Job scheduling problems
Traveling salesperson problem
Eight queens problem
Branch-and-Bound Approach for Machine
Scheduling Problem
Example 10
Four jobs must be processed on a single machine.
The time required to process each job and the date
the job is due are shown in table. The delay of a job is
the number of days after the due date that a job is
completed. In what order should the jobs be
processed to minimize the total delay of the four jobs?
Time required to complete job Due Date
Job1 6 End of day 8
Job2 4 End of day 4
Job3 5 End of day 12
Job4 8 End of day 16
Branch-and-Bound Approach for Machine
Scheduling Problem
Solution suppose the jobs are processed in
the following order: job1,job2,job3 and job4.
Then the delays shown in table would occur:
Completion time of job Delay of Job
Job1 6 0
Job2 6+4=10 10-4=6
Job3 6+4+5=15 15-12=3
Job4 6+4+5+8=23 23-16=7
x12 =1 x22 =1
Node8 Node9
D≥ 12 D≥ 16
×
Branch-and-Bound Approach for
Traveling Salesperson Problem
Example 11 Joe State lives in Gary, Indiana. He
owns insurance agencies in Gary, Fort Wayne,
Evansville, Terre Haute, and South Bend. Each
December, he visits each of his insurance agencies.
The distance between each of his agencies (in miles)
is shown in table. What order of visiting his agencies
will minimize the total distance traveled?
Gary Fort Evansville Terre South
Wayne Haute Bend
City 1 Gary 0 132 217 164 58
City 2 Fort Wayne 132 0 290 201 79
City 3 Evansville 217 290 0 113 303
City 4 Terre Haute 164 201 113 0 196
City 5 South Bend 58 79 303 196 0
Branch-and-Bound Approach for
Traveling Salesperson Problem
Solution Joe must determine the order of visiting the
five cities that minimizes the total distance traveled.
For example, Joe could choose to visit the cities in the
order 1-3-4-5-2-1. then he would travel a total of
217+113+196+79+132=737 miles.
To tackle the traveling salesperson problem, define
1 if Joe leaves city i and travels next to city j
xij
0 otherwise
also, for i j
cij distance between cities i and j
cii M , where M is a large positive number
Branch-and-Bound Approach for Trav
eling Salesperson Problem
Subproblem 1
t=1 z=495
x15 =x21=x34 =x43 =x52 =1
x34 =0 x43 =0
Subproblem 2 Subproblem 3
t=2 z=652 X t=5
z=652
X
x14 =x25=x31 =x43 =x52 =1 x13 =x25=x34 =x41 =x52 =1
UB=668
x25 =0 x52 =0
Subproblem 4 Subproblem 5
z=668 z=704
t=3 x15 =x24=x31 =x43 =x52 =1 t=4 x14 =x43=x32 =x25 =x51 =1 X
Candidate solution UB=668
x25 =0 x52 =0
Subproblem 6 Subproblem 1
z=704
X z=910 X
t=6 x15 =x34=x23 =x41 =x52 =1 t=7 x13 =x25=x31 =x42 =x54 =1
UB=668 UB=668