Week 1 Integer Progrmming
Week 1 Integer Progrmming
Integer Programming
by Dr. Peitsang Wu
Department of Industrial
Engineering and Management
I-Shou University
Integer Programming
The mathematical model for integer
programming is the linear programming problem
with the one additional restriction that the
variables must have integer values.
If only some of the variables are required to have
integer values, this model is referred to as mixed
integer programming (MIP).
IP problem that contain only binary variables
sometimes are called binary integer
programming (BIP).
Example
Max Z 9 x1 5 x 2 6 x3 4 x 4
s.t. 6 x1 3 x 2 5 x3 2 x 4 10
x3 x4 1
x1 x3 0
x2 x4 0
x j 1, x j 0
j 1,2,3,4
or x j Ingeter
x j 0,1 j 1,2,3,4 (binary)
Some Perspectives
1. IP problem with a bound feasible region
are guaranteed to have just a finite
number of feasible solution.
Some Perspectives
2. Some misunderstanding of solving IP :
(i) Having a finite number of feasible solutions
ensures that the problem is readily solvable.
→ wrong n=10, 210 solutions
n=20, 106 solutions
n=30, 230 ≈ 109 solutions
(ii) Removing some feasible solutions (non-integer
ones) from a LP problem will make it easier to
solve. → wrong The B.F.S. are there to
guarantee the C.P.F. solution that is optimal for
the overall problem. This is the key to the
remarkable efficiency of the simplex method.
Some Perspectives
3. Most successful algorithms for IP
incorporate simplex method as much as
they can by relating portions of the IP
problem under consideration to the
corresponding LP problem. It is referred
to as its LP relaxation.
Some Perspectives
4. Some special cases guarantee integer
optimal solution.
i. minimum cost flow problem
ii. transportation problem
iii. assignment problem
iv. transshipment problem
v. shortest-path problem
vi. maximum flow problem
Some Perspectives
5. Two primary determinants of
computational difficulty for an IP
problem.
i. the number of integer variables
ii. any special structure in the problem.
Some Perspectives
6. IP is much more difficult to solve than LP
problems, sometimes it is tempting to use the
approximate procedure of simply applying the
simplex method to the LP relaxation and then
rounding the non-integers values to integer in
the resulting solution.
Two pitfalls about the rounded solutions:
(i) What about the optimal solution in LP is not
feasible any more after rounded?
(ii) No guarantee that the rounded solution will
be the optimal integer solution.
Some Perspectives
7. A better approach for dealing with IP
problems that are too large to be solved
exactly is to use one of the available
heuristic algorithms. These algorithm are
extremely efficient for large problems, but
they are not guarantee to find an optimal
solution.
Some Perspectives
8. For IP problems that are small enough to
be solved to optimality, a considerable
number of algorithms now are available.
But there are not comparable to the
simplex method in terms of efficiency.
The most popular one is the branch-and-
bound technique and implicitly
enumerate the feasible integer solution.
The Branch-and-Bound Method
We can solve the pure IP problem by some kind
of enumeration procedure for finding optimal
solution. But when the number is large, it won’t
work.
The basic concept underlying the Branch-and-
Bound (B and B) technique is to divide and
conquer.
We can divide the original “large problem” into
serial smaller subproblems until the
subproblems can be conquer.
The Branch-and-Bound Method
The dividing (branching) is done by partitioning
the entire set of feasible solutions into smaller
and smaller subsets.
The conquering (fathoming) is done partially by
bounding how good the best solution in the
subset can be and then discarding the subset if its
bound indicates that it cannot possibly contain an
optimal solution for the original problem.
B and B in BIP Example
Max Z 9 x1 5 x 2 6 x3 4 x 4
s.t. 6 x1 3 x 2 5 x3 2 x 4 10
x3 x 4 1
x1 x3 0
x2 x4 0
x j 0,1 j 1,2,3,4
B and B in BIP Example
Branching
Letting x1= 0 the resulting subproblem 1 is
Max Z
s.t.
x j 0,1 j 2,3,4
B and B in BIP Example
Letting x1= 1 the resulting subproblem 2 is
Max Z
s.t.
1
B and B in BIP Example
Bounding
Solve the LP relaxation of subproblem 1 :
(x1, x2, x3, x4) = ( , , , ) Z= , therefore we get Z
bound for the subproblem 1.
Solve the LP relaxation of subproblem 2 :
(x1, x2, x3, x4) = ( , , , ) Z= , therefore
Z , rounded, we get Z bound for the
subproblem 2. 0
all Z
(0 , , , )
16
(5/6, 1, 0, 1) 1
Z
(1, , , )
B and B in BIP Example
Fathoming
Since subproblem 1 Z=9 , we already get the optimal solution
for subproblem 1. It is stored as the first incumbent (the best
feasible solution found so far) for the whole problem.
We continue to fathom subproblem 2.
Z16, but may be fathomed by its descendants (by creating
new smaller subproblems on this subproblem). Furthermore, as
new incumbents with larger values of Z* are found, it will
become easier to fathom in this way.
Or the third way of fathoming is : If the simplex method finds
that a subproblem’s LP relaxation has no feasible solution then
the subproblem itself must have no feasible
solutions. So it can be dismissed (fathoming).
B and B in BIP Example
Fathoming
Summary of fathoming tests
Test1 : Its bound Z*
Test2 : Its LP relaxation has no feasible solutions
Test3 : The optimal solution for it LP relaxation is
integer. (If this solution is better then the
incumbent, it becomes the new incumbent, and
test 1 is applied to all unfathomed xsubproblems
with the new larger Z*.) 0
1
Z*= 9
all
(0, 1, 0, 1) = incumbent
16
1
16
Summary of the BIP B and B
Initialization: Set Z* = -∞
Apply the bounding step, fathoming step,
and optimality test described below to the
whole problem.
If not fathomed, classify this problem as
the one remaining "subproblem" for
performing the first full iteration below.
Summary of the BIP B and B
Iteration
Step1 :Branching
Among the remaining (unfathomed) subproblems, select
the one that was created most recently. (Break ties
according to which has the larger bound) Branch from
the node for this subproblem to create two new
subproblems by fixing the next variable (the branching
variable) at either 0 or 1.
Step2 :Bounding
For each new subproblem, obtain its bound by applying
the simplex method to its LP relaxation and rounding
down the value of Z for the resulting optimal solution.
Summary of the BIP B and B
Step3 :Fathoming
For each new subproblem, apply the three
fathoming tests summarized above, and discard
those subproblems that are fathomed by any of
the tests.
Optimality test
STOP, when there are no remaining
subproblems: the current incumbent is optimal.
Otherwise, return to perform another iteration.
Ex. (continue) Iteration 2
Subproblem 3 : Fix x1=1, x2=0 ; the resulting
subproblem is :
Max Z
s.t
x3 , x 4 0,1
is (x1, x2, x3, x4) = ( , , , ) Z=
Bound of subproblem 3 is
Ex. (continue) Iteration 2
Subproblem 4
Fix x1=1, x2=1 ; the resulting subproblem is :
Max Z
s.t.
LP relaxation x , x4
of3subproblem 40,1
is (x1, x2, x3, x4) = ( , , , ) Z =
Bound of subproblem 4 is
Ex. (continue) Iteration 2
Both bound Z* = 9 test 1 failed
feasible test 2 failed
noninteger solution test 3 failed
x1 x2
0
Z*= 9
all
(0, 1, 0, 1) 0
16 13
1
(1, 0, 4/5, 0 )
16
1
16
(1, 1, 0, 1/2 )
Ex. (continue) Iteration 3
Subproblem 5 : fix x1=1, x2=1, x3=0
Max Z
s.t.
x 4 0,1
LP relaxation of subproblem 5
is (x1, x2, x3, x4) = ( , , , ) Z =
Bound Z
Ex. (continue) Iteration 3
Subproblem 6 : fix x1=1, x2=1, x3=1
Max Z
s.t
no feasible solution
x4 0,1
0 F (3 )
Z*= 9
all
(0 , 1 , 0 , 1 ) 0
16
1 13
0
16 16
1
(1 , 1 , 0 , 1 /2 )
16
1 F (2 )
n o feasib le so lu tio n
Ex. (continue) Iteration 4
Subproblem 7 : x1=1, x2=1, x3=0, x4=0
Z= , (x1, x2, x3, x4) = ( , , , )
Subproblem 8 : x1=1, x2=1, x3=0, x4=1
Z= infeasible
fathomed by test 3, Z* = 9 Z* = ,
(x1, x2, x3, x4) = ( , , , )
Ex. (continue) Iteration 4
x1 x2 x3 x4
0 F (3)
9
all
0 F (1) 0
16
1 13
0 Z *= 14
(1, 1, 0, 0 )
16
1 16
1 F (2)
16 no feasible solution
1 F (2)
no feasible solution
B and B Solve Pure IP Problem
Max Z 8 x1 5 x 2
s.t x1 x 2 6
9 x1 5 x 2 45
x1 , x 2 0 , x1 , x 2 I
B and B Solve Pure IP Problem
The relaxation of this IP problem is
(x1,x2)=( , ) Z=
9 x1+ 5 x2= 4 2
x1+ x2= 6
6
5
4 (3 .7 5 ,2 .2 5 )
3
2
1
1 2 3 4 5 6
Ex. (continue) Iteration 1
subproblem1
fix x1 4
Max Z 8x1 5x2
s.t. x1 x2 6
9x1 5x2 45
x1 4
x1 ,x2 I
Ex. (continue) Iteration 1
optimal solution of relaxation LP of sub1:
Z= , x1= , x2=
x2
x1
3 4 5 6
Ex. (continue) Iteration 1
subproblem2
fix x1 3
Max Z 8x1 5x2
s.t. x1 x2 6
9x1 5x2 45
x1 3
x1 ,x2 I
Ex. (continue) Iteration 1
optimal solution of relaxation LP of sub2:
Z= , x1= , x2=
x2
x1
3 4 5 6
Ex. (continue) Iteration 1
x1
x1 3
all Z * = 3 9 F (3 )
41
x1 4
41
subproblem2: fathomed
Z=39,(x1,x2)=(3,3)
subproblem1: failed
Z*=39
Ex. (continue) Iteration 2
subproblem3:
fix x1 4 , x2 2
Max Z 8x1 5x2
s.t. x1 x2 6
9x1 5x2 45
x1 4 , x2 2
x1 ,x2 I
Ex. (continue) Iteration 2
optimal solution of relaxation LP of
sub3:infeasible
fathomed: F(2)
4 5
Ex. (continue) Iteration 2
subproblem4:
fix x1 4 , x2 1
Max Z 8x1 5x2
s.t. x1 x2 6
9x1 5x2 45 1
x1 4 , x2 1
4 5
x1 ,x2 I
Ex. (continue) Iteration 2
optimal solution of relaxation LP of sub4:
Z= , x1= , x2=
x1
x1 3
all Z * = 3 9 F (3 ) x2 2 F (2 )
41
x1 4
41 x2 1
Z 40, ( x1 , x2 ) (4 94 ,1)
Ex. (continue) Iteration 3
subproblem5: fix x1 5 , x2 1
Max Z 8x1 5x2
s.t. x1 x2 6
9x1 5x2 45
x1 5 , x2 1
x1 ,x2 I
optimal solution of relaxation LP of sub5:
Z= , x1= , x2=
fathomed: F(3) , Z*=
Ex. (continue) Iteration 3
subproblem6: fix x1 4 , x2 1
Max Z 8x1 5x2
s.t. x1 x2 6
9x1 5x2 45
x1 4 , x2 1
x1 ,x2 I
optimal solution of relaxation LP of sub6:
Z= , x1= , x2=
fathomed: F(1) Z Z*=40
Ex. (continue) Iteration 3
x1
x1 3
all Z * = 3 9 F (3 ) x2 2 F (2 )
41
x1 4 x1 5 F (3 )
41 x2 1 Z * = 4 0 (x1 ,x2 )= (5 ,0 )
40 x1 4 F (1 )
37
Knapsack Problem
(BIP with single constraint)
Max Z c1 x1 c 2 x2 ........ cn xn
s.t. a1 x1 a2 x2 ...........an xn b
xi 0,1
Greedy Algorithm
ci
1. Compute ai
ci
2. select those with greatest a value, assign
i
resource to that variable
3. if xi the last variable go to 2,
else stop.
Example
ci 8
Since the largest ai
value is 5 and assign x2=1
Z
s.t.
xi 0,1
Ex. (continue)
ci
Since the largest ai remaining is 1 and assign
arbitrary x4=1
ci Z
ai
s.t.
xi 0,1
Ex. (continue)
ci
Since the largest remaining is 1 and assign
1 ai
x1= (since only 10 unit left ) Z=160
4
1
x1 , x2 x4 x7 1, x3 x5 x6 0
4
is the optimal solution of the relaxation of our
example problem.
H.W
Use Branch and Bound to solve the Knapsack
problems.
Combinatorial Optimization Problems
completion delay
J1
J2
J3
J4
Total delay=16
All
10 11 12 5 6 7
X12=1 D 12 X33=1 D 16
8 9
x2
x1
Cutting Plane Algorithm
Choose any constraint in the LP relaxation’s optimal
tableau in which a basic variable is fractional. (arbitrarily)
x1- s1+ s2= …….
define [x]:the largest integer less than or equal to x thus
any number x can be written x=[x]+f, where 0 f 1.
become x1- s1+ s1+ s2+ s2=
x1- s1+ s2- = - s1 - s2….
now add : - s1- s2 0
This constraint called a cut.
Properties
1. Any feasible point for the I.P. will satisfy the cut .
2. The current optimal solution to the L.P relaxation
will not satisfy the cut.
cut ”cut off” the current optimal solution to the L.P.
relaxation but does not cut any feasible solution to
the I.P.
If the new problem(old +”cut” constraint), has
integer solution, we get the optimal solution.
Otherwise, we add a new “cut” to current problem.
And continue the process, until we get an optimal
solution.
Theorem
The process of cutting plane algorithm will
guarantee an optimal solution to the I.P.
after a finite number of cuts.
Ex. (continue )
We now add : 0.75-0.75s1-0.25s20 to
out problem the L.P relaxation’s tableau is
Z x1 x2 s1 s2 s3 r.h.s
s3
Ex. (continue )
optimal tableau
Z x1 x2 s1 s2 s3 r.h.s
x2
x1
s1
(x1,x2)=( , ) is an optimal solution to our I.P
problem. Optimal value is Z=
Summary of the
cutting plane algorithm
Step 1: Find the optimal tableau for the I.P’s L.P
relaxation. If all the variables in the optimal
solution assume integer values, we have found an
optimal solution to the I.P. Otherwise, processed
step2.
Step 2: Pick a constraint in the L.P relaxation
tableau whose right-hand-side has the fractional
part close to 1/2. This constraint will be used to
generate a cut.
Summary of the
cutting plane algorithm
Step 2a: For the constraint identified in step2,
write the constraints r.h.s. and each variable’s
coefficient in the form [x]+f , where 0 f 1.