12 Integer Programming
12 Integer Programming
1
Why study integer programming?
2
Applications
3
Project Selection Problem (Knapsack Problem)
Max 4000 x1+ 4500 x2+ 3000 x3+ 9500 x4+ 6400 x5
s.t. 5000 x1+ 6000 x2+ 3500 x3+ 8000 x4+ 7500 x5≤ 18000
Max (12x1 + 8x2 + 5x3) − (6x1 + 4x2 + 8x3) − (200y1 + 150y2 + 100y3)
s.t. 3x1 + 2x2 + 6x3 ≤ 150 (Labor)
4x1 + 3x2 + 4x3 ≤ 160 (Cloth)
xj ≤ Mjyj , j = 1, 2, 3 where Mj = a large positive integer
x1, x2, x3 ≥ 0 and Integer
yj {0,1}, j = 1, 2, 3
7
Cutting Stock Problem (1-Dimentional)
P.C. Gilmore & R.E. Gomory, (1960). A Linear Programming Approach to the
Cutting Stock Problem. Operations Research 9, 849-859.
9
Example of Patterns for 17 Feet Wide board
Ways to cut board
Pattern Number of Waste Decision
(i) 3-ft sheet 5-ft sheet 9-ft sheet (feet) Variable
1 5 0 0 2 x1
2 4 1 0 0 x2
3 2 2 0 1 x3
4 2 0 1 2 x4
5 1 1 1 0 x5
6 0 3 0 2 x6
Demand 25 20 15
Decision variable
xi = number of 17-ft boards cut according to pattern i 10
Cutting Stock Problem: Formulation
• Objective: Minimize waste
Waste = Total width of boards cut − Total demand
17(x1+x2+x3+x4+x5+x6) −(25x3+20x5+15x9)
Min 17(x1+x2+x3+x4+x5+x6) −310
Min 17(x1+x2+x3+x4+x5+x6)
Min x1+x2+x3+x4+x5+x6
• Constraints
- Meet demand of at least 25 for 3-ft sheets
5 x1 + 4 x2 + 2 x3 + 2 x4 + x5 25
- Meet demand of at least 20 for 5-ft sheets
x2 + 2 x3 + x5 + 3 x6 20
- Meet demand of at least 15 for 9-ft sheets
x4 + x5 15
- Non-negativity constraint
xi 0 for all i = 1, 2, …, 6 and integer
11
Set Covering Problem
Overlapping services are offered by a number
of facilities to a number of customers
To find a set of facilities from among a finite
set of candidate facilities so that every
demand node is covered by at least one
facility
Notations:
cj = cost of locating facility at site j
aij =
1 if customer i can be covered by facility located at site j
xj =
{ 0 Otherwise
0 Otherwise
Formulation:
n
Minimize c j x j (Cost of covering each customer)
j 1
n
Subject to a x
j 1
ij j 1 i 1,2,..., m (Each customer is covered by at least one facility)
x j 0 or 1 j 1, 2,..., n
Set Covering Problem: Example
Delhi govt. wants to locate several medical emergency response
units so that it can respond to calls within Delhi within 8 minutes
of the call. Delhi is divided into seven population zones. The
travel time between the centers of each pair of zones is known and
is given in the matrix below.
Not Symmetric, tij ≠ tji
Data: travel time between seven zones
Zone 1 2 3 4 5 6 7
1 0 4 12 6 15 10 8
2 8 0 15 60 7 2 3
3 50 13 0 8 6 5 9
[tij] =
4 9 11 8 0 9 10 3
5 50 8 4 10 0 2 27
6 30 5 7 9 3 0 27
7 8 5 9 7 25 27 0 14
Other information
The response units can be located in the center of
population zones 1 through 7 at a cost (in hundreds of
thousands of dollars) of 100, 80, 120 110, 90, 90, and
110, respectively. Formulate an appropriate set
covering model to determine where the units are to
be located and how the population zones are to be
covered.
Decision Variable:
xj = 1, if medical emergency response unit is located at zone j
= 0, Otherwise
15
Set Covering Problem: Formulation
Minimize 100x1+80x2+120x3+110x4+90x5+90x6+110x7
Subject to (each zone must be covered by at least one medical
emergency response units )
x1 + x2 + x4 + x7 > 1 (To cover zone 1)
x1 + x2 + x5 + x6 + x7 > 1 (To cover zone 2)
x3 + x4 + x5 + x6 > 1 (To cover zone 3)
x3 + x4 + x7 > 1 (To cover zone 4)
x2 + x3 + x5 + x6 > 1 (To cover zone 5)
x2 + x3 + x5 + x6 > 1 (To cover zone 6)
x1 + x2 + x4 + x7 > 1 (To cover zone 7)
19
Pure Integer Model
Required
Machine Floor Space (ft.2) Purchase Price
Press 15 $8,000
Lathe 30 4,000
20
Pure Integer Model: Formulation
21
0 - 1 Integer Model
22
0 - 1 Integer Model Formulation
24
A Mixed Integer Model: Formulation
27
Where can you use the LP solution for
“discrete” problems?
Where the numbers involved are large enough for
a rounding off to be meaningful:
x2
Increasing
objective
function value
x1 29
You can go wrong here
■ Rounding non-integer solution values up to the nearest integer
value can result in an infeasible solution.
LP
optimum
IP
optimum
x2
Increasing
objective
function value
x1 30
You could go wrong
If you have a particularly pointed feasible
region
If you use LP to predict the solution for an IP
where variables can have only 0-1 values
(Typically in take/leave situations).
31
Linear Program Solution Space
Example
Min 3 x1 2 x2
S.t. 3 x1 x2 6
4 x1 3 x2 12
x1 x2 6
x1 , x2 0
LP Optimal Solution
x2
x1
32
Integer Program Solution Space
Min 3x1 2 x2
S.t. 3x1 x2 6
4 x1 3x2 12
x1 x2 6
x1 , x2 0, Integer
IP Optimal Solution (1, 3)
x2
Feasible solution
x1 33
Solving Integer Linear Programming Problem
Enumeration Techniques
- Exhaustive Enumeration
- Branch and Bound
Cutting Plane Approach
Exhaustive Enumeration
Systematically generate and evaluate all
possible solutions and choose the (feasible)
solution with the optimal (best) value
34
Exhaustive Enumeration (contd…)
P0: Max 3x1 + 2x2 Branching
on x1 x1=?
s.t. x1 + x2 ≤ 3 P0
x2=?
x1, x2 {0,1}
Branching x1= 1 x1 = 0
on x2
P1: Max 3x1 + 2x2
s.t. x1 + x2 ≤ 3 P1 x1= 1 P2 x1= 0
x2=? x2=?
x1 = 1
x2=1 x2=0
x2 {0,1} x2=1 x2=0
P4: Max 3x1 + 2x2
s.t. x1 + x2 ≤ 3 P3 P4 P5 P6
x1 = 1
x1=1 x1=1 x1=0 x1=0
x2 = 0 x2=1 x2=0 x2=1 x2=0
OBJ Value: 5 3 2 0
35
Exhaustive Enumeration (contd…)
Consider an ILP with n binary variables:
Exhaustive enumeration will generate and evaluate
2n solutions.
Branching:
Choose one of the variables whose value will be fixed to create two
new subproblems.
38
Branch and Bound (contd…)
Bounding: A bound is an optimistic estimate of the
solution of a problem. Solving the LP relaxation (IP
without integer requirement) of a subproblem will yield an
optimistic estimate of solution.
FATHOMING CRITERIA
There are three situations that will arise that lets us know when
we no longer need to break down a subproblem.
A subproblem is fathomed if
• Its LP relaxation's optimal solution is integral
• Its bound is worse than the best solution found so far
• Its LP relaxation has no feasible solution
40
Branch and Bound (contd…)
Pure Integer Programming Problem
Max Z 8 x1 5 x2
S.t. x1 x2 6
9 x1 5 x2 45
x1 , x2 0; x1 , x2 integer
Max Z 8 x1 5 x2
IP Feasible solution
S.t. x1 x2 6
9 x1 5 x2 45
x1 , x2 0
x2
Optimal Solution for LP Bound for
P0
P0
(3.75, 2.25)
x1 42
Branch and Bound (contd…)
P0
Max Z 8 x1 5 x2
S.t. x1 x2 6
9 x1 5 x2 45
x1 , x2 0
LP Bound Solution of P0:
P0: ZLP=41.25
(x1=3.75, x2=2.25)
43
Branch and Bound (contd…)
IP Feasible solution
P2
P1
x1 44
Branch and Bound (contd…)
P0: ZLP=41.25
(x1=3.75, x2=2.25)
x1 ≥ 4 x1 ≤ 3
P1: ZLP=41 P2: ZLP=39
(x1=4, x2=1.8) (x1=3, x2=3)
Fathomed
45
Branch and Bound (contd…)
IP Feasible solution
x2
Optimal Solution for LP Bound for P4
P4
x1 46
Branch and Bound (contd…)
P0: ZLP=41.25
(x1=3.75, x2=2.25)
x1 ≥ 4 x1 ≤ 3
P1: ZLP=41 P2: ZLP=39
(x1=4, x2=1.8) (x1=3, x2=3)
x2 ≥ 2 x2 ≤ 1 Fathomed
47
Branch and Bound (contd…)
x2
Optimal Solution for LP Bound for P5
x1 48
Branch and Bound (contd…)
P0: ZLP=41.25
(x1=3.75, x2=2.25)
x1 ≥ 4 x1 ≤ 3
P1: ZLP=41 P2: ZLP=39
(x1=4, x2=1.8) (x1=3, x2=3)
x2 ≥ 2 x2 ≤ 1 Fathomed
49
Branch and Bound Algorithm for Pure IPP (Maximization Case)
50
Branch and Bound (contd…)
Another Example: (LP relaxation of the original problem)
Bound: LP Relaxation
Problem Selection: Newest Problem (LIFO rule) 51
Branch and Bound (contd…)
P0: ZLP=1127.4
(x1=3.37, x2=11.22)
x1 ≥ 4 x1 ≤ 3
Z* = Bound = −M
52
Branch and Bound (contd…)
P0: ZLP=1127.4
(x1=3.37, x2=11.22)
x1 ≥ 4 x1 ≤ 3
P1: ZLP=1043.5
(x1=4, x2=9.5)
x2 ≥ 10 x2 ≤ 9
Z* = Bound = −M
53
Branch and Bound (contd…)
P0: ZLP=1127.4
(x1=3.37, x2=11.22)
x1 ≥ 4 x1 ≤ 3
P1: ZLP=1043.5
(x1=4, x2=9.5)
x2 ≥ 10 x2 ≤ 9
P2: Infeasible
FATHOMED
Z* = Bound = −M
54
Branch and Bound (contd…)
P0: ZLP=1127.4
(x1=3.37, x2=11.22)
x1 ≥ 4 x1 ≤ 3
P1: ZLP=1043.5
(x1=4, x2=9.5)
x2 ≥ 10 x2 ≤ 9
P2: Infeasible P3: ZLP=1019.2
FATHOMED (x1=4.2, x2=9)
x1 ≥ 5 x1 ≤ 4
Z* = Bound = −M
55
Branch and Bound (contd…)
P0: ZLP=1127.4
(x1=3.37, x2=11.22)
x1 ≥ 4 x1 ≤ 3
P1: ZLP=1043.5
(x1=4, x2=9.5)
x2 ≥ 10 x2 ≤ 9
P2: Infeasible P3: ZLP=1019.2
FATHOMED (x1=4.2, x2=9)
x1 ≥ 5 x1 ≤ 4
P4: ZLP=909.8
(x1=5, x2=6.75)
x2 ≥ 7 x2 ≤ 6
Z* = Bound = −M
56
Branch and Bound (contd…)
P0: ZLP=1127.4
(x1=3.37, x2=11.22)
x1 ≥ 4 x1 ≤ 3
P1: ZLP=1043.5
(x1=4, x2=9.5)
x2 ≥ 10 x2 ≤ 9
P2: Infeasible P3: ZLP=1019.2
FATHOMED (x1=4.2, x2=9)
x1 ≥ 5 x1 ≤ 4
P4: ZLP=909.8
(x1=5, x2=6.75)
x2 ≥ 7 x2 ≤ 6
P5: Infeasible
FATHOMED
Z* = Bound = −M
57
Branch and Bound (contd…)
P0: ZLP=1127.4
(x1=3.37, x2=11.22)
x1 ≥ 4 x1 ≤ 3
P1: ZLP=1043.5
(x1=4, x2=9.5)
x2 ≥ 10 x2 ≤ 9
P2: Infeasible P3: ZLP=1019.2
FATHOMED (x1=4.2, x2=9)
x1 ≥ 5 x1 ≤ 4
P4: ZLP=909.8
(x1=5, x2=6.75)
x2 ≥ 7 x2 ≤ 6
P5: Infeasible P6: ZLP=873.3
FATHOMED (x1=5.3, x2=6)
x1 ≥ 6 x1 ≤ 5 Z* = Bound = −M
58
Branch and Bound (contd…)
P0: ZLP=1127.4
(x1=3.37, x2=11.22)
x1 ≥ 4 x1 ≤ 3
P1: ZLP=1043.5
(x1=4, x2=9.5)
x2 ≥ 10 x2 ≤ 9
P2: Infeasible P3: ZLP=1019.2
FATHOMED (x1=4.2, x2=9)
x1 ≥ 5 x1 ≤ 4
P4: ZLP=909.8
(x1=5, x2=6.75)
x2 ≥ 7 x2 ≤ 6
P5: Infeasible P6: ZLP=873.3
FATHOMED (x1=5.3, x2=6)
x1 ≥ 6 x1 ≤ 5 Z* = Bound = 776
P7: ZLP=776
(x1=6, x2=4)
59
FATHOMED
Branch and Bound (contd…)
P0: ZLP=1127.4
(x1=3.37, x2=11.22)
x1 ≥ 4 x1 ≤ 3
P1: ZLP=1043.5
(x1=4, x2=9.5)
x2 ≥ 10 x2 ≤ 9
P2: Infeasible P3: ZLP=1019.2
FATHOMED (x1=4.2, x2=9)
x1 ≥ 5 x1 ≤ 4
P4: ZLP=909.8
(x1=5, x2=6.75)
x2 ≥ 7 x2 ≤ 6
P5: Infeasible P6: ZLP=873.3
FATHOMED (x1=5.3, x2=6)
x1 ≥ 6 x1 ≤ 5 Z* = Bound = 852
Example Max Z 8 x1 5 x2
S.t. x1 x2 6
9 x1 5 x2 45
x1 , x2 0; x2 integer
P0: ZLP=41.25
(x1=3.75, x2=2.25)
x2 ≥ 3 x2 ≤ 2
Z* = Bound = −M
66
Branch-and-bound: mixed integer programs
(contd…)
P0: ZLP=41.25
(x1=3.75, x2=2.25)
x2 ≥ 3 x2 ≤ 2
P1: ZLP=39
(x1=3, x2=3)
Fathomed
Z* = Bound = 39
67
Branch-and-bound: mixed integer programs
(contd…)
P0: ZLP=41.25
(x1=3.75, x2=2.25)
x2 ≥ 3 x2 ≤ 2
P1: ZLP=39 P2: ZLP=41.11
(x1=3, x2=3) (x1=3.89, x2=2)
Z* = Bound = 41.11
Fathomed Fathomed
68
Branch-and-bound: binary integer programs
Modification: When branching on a binary variable xi, which has a fractional value xi*
in the current LP solution, the two new subproblems are created by setting
xi = 0 and xi = 1.
Example Max Z 9 x1 5 x2 6 x3 4 x4
S.t. 6 x1 3x2 5 x3 2 x4 10
x3 x4 1
x1 x3 0
x2 x4 0
x1 , x2 , x3 , x4 {0,1}
LP relaxation of the original problem
Subproblem P0: Max Z 9 x1 5 x2 6 x3 4 x4
S.t. 6 x1 3x2 5 x3 2 x4 10
x3 x4 1
x1 x3 0
x2 x4 0
0 x j 1, for j 1,2,3,4 69
Branch-and-bound: binary integer programs(Contd…)
P0: ZLP=16.5
(x1=0.83, x2=1, x3=0, x4=1)
x1 = 1 x1 = 0
Z* = Bound = - M
70
Branch-and-bound: binary integer programs(Contd…)
P0: ZLP=16.5
(x1=0.83, x2=1, x3=0, x4=1)
x1 = 1 x1 = 0
P1: ZLP=16.2
(x1=1, x2=0.8, x3=0, x4=0.8)
x2 = 1 x2 = 0
Subproblem P1 = ?
Z* = Bound = - M
71
Branch-and-bound: binary integer programs(Contd…)
P0: ZLP=16.5
(x1=0.83, x2=1, x3=0, x4=1)
x1 = 1 x1 = 0
P1: ZLP=16.2
(x1=1, x2=0.8, x3=0, x4=0.8)
x2 = 1 x2 = 0
P2: ZLP=16
(x1=1, x2=1, x3=0, x4=0.5)
x4 = 1 x4 = 0
Subproblem P2 = ?
Z* = Bound = - M
72
Branch-and-bound: binary integer programs(Contd…)
P0: ZLP=16.5
(x1=0.83, x2=1, x3=0, x4=1)
x1 = 1 x1 = 0
P1: ZLP=16.2
(x1=1, x2=0.8, x3=0, x4=0.8)
x2 = 1 x2 = 0
P2: ZLP=16
(x1=1, x2=1, x3=0, x4=0.5)
x4 = 1 x4 = 0
P3: Infeasible
FATHOMED
Subproblem P3 = ?
Z* = Bound = - M
73
Branch-and-bound: binary integer programs(Contd…)
P0: ZLP=16.5
(x1=0.83, x2=1, x3=0, x4=1)
x1 = 1 x1 = 0
P1: ZLP=16.2
(x1=1, x2=0.8, x3=0, x4=0.8)
x2 = 1 x2 = 0
P2: ZLP=16
(x1=1, x2=1, x3=0, x4=0.5)
x4 = 1 x4 = 0
Z* = Bound = - M
Subproblem P4 = ?
74
Branch-and-bound: binary integer programs
P0: ZLP=16.5
(x1=0.83, x2=1, x3=0, x4=1)
x1 = 1 x1 = 0
P1: ZLP=16.2
(x1=1, x2=0.8, x3=0, x4=0.8)
x2 = 1 x2 = 0
P2: ZLP=16
(x1=1, x2=1, x3=0, x4=0.5)
x4 = 1 x4 = 0
P5: Infeasible
FATHOMED
Z* = Bound = - M
Subproblem P5 = ?
75
Branch-and-bound: binary integer programs(Contd…)
P0: ZLP=16.5
(x1=0.83, x2=1, x3=0, x4=1)
x1 = 1 x1 = 0
P1: ZLP=16.2
(x1=1, x2=0.8, x3=0, x4=0.8)
x2 = 1 x2 = 0
P2: ZLP=16
(x1=1, x2=1, x3=0, x4=0.5)
x4 = 1 x4 = 0
Subproblem P6 = ?
76
Branch-and-bound: binary integer programs(Contd…)
P0: ZLP=16.5
(x1=0.83, x2=1, x3=0, x4=1)
x1 = 1 x1 = 0
P1: ZLP=16.2
(x1=1, x2=0.8, x3=0, x4=0.8)
x2 = 1 x2 = 0
P2: ZLP=16 P7: ZLP=13.8
(x1=1, x2=1, x3=0, x4=0.5) (x1=1, x2=0, x3=0.8, x4=0) P7 Fathomed. why?
x4 = 1 x4 = 0 FATHOMED
Subproblem P7 = ?
77
Branch-and-bound: binary integer programs(Contd…)
P0: ZLP=16.5
(x1=0.83, x2=1, x3=0, x4=1)
x1 = 1 x1 = 0
P1: ZLP=16.2 P8: ZLP=9
(x1=1, x2=0.8, x3=0, x4=0.8) (x1=0, x2=1, x3=0, x4=1)
x2 = 0 FATHOMED
x2 = 1
P2: ZLP=16 P7: ZLP=13.8
(x1=1, x2=1, x3=0, x4=0.5) (x1=1, x2=0, x3=0.8, x4=0)
x4 = 1 x4 = 0 FATHOMED
Subproblem P8 = ? 78
Knapsack Problem
Knapsack Problem –Given a set of n items (j=1, 2, …, n)
with a weight (wj) and value (cj), select the items so that the
total weight is at most a given limit (W) and the total value
is as large as possible.
Decision variable:
xj =1 if item is included in knapsack;
0 Otherwise
• Formulation
Max c1x1+ c2x2+… +cnxn Single constraint
s.t. w1x1+ w2x2+… +wnxn ≤ W
xj {0,1}, for all j= 1, 2, …, n 79
Knapsack Problem by Exhaustive Search
80
Solving Knapsack problem by B&B approach
• LP relaxation: Solution of LP relaxed problem can
be obtained by inspection (Heuristic)
i. Find cj/wj, for all j = 1, 2, …, n.
ii. Rank the item in non-increasing order of cj/wj
ratio.
iii. Select the best item (with highest cj/wj ratio).
iv. Continue in this fashion until the best remaining
item fills the knapsack.
81
Solving Knapsack problem by B&B approach
• Another Example: 4 items
Max Z=16x1+ 22x2+ 12x3+ 8x4
s.t. 5x1+ 7x2+ 4x3+ 3x4 ≤ 14
xj {0,1}, for all j = 1, 2, …, 4
82
Solving Knapsack problem by B&B approach
P0: ZLP = 44
Bound: Z = − ∞
5x1+ 7x2+ 4x3+ 3x4 ≤ 14 (x1= x2 = 1
x3 =1/2, x4 = 0)
83
Solving Knapsack problem by B&B approach
P0: ZLP = 44
Bound: Z = − ∞
5x1+ 7x2+ 4x3+ 3x4 ≤ 14 (x1= x2 = 1
x3 =1/2, x4 = 0)
x3 = 1 x3 = 0
P1: ZLP = 43 5
7
(x1= x3 = 1
x2 =5/7, x4 = 0)
84
Solving Knapsack problem by B&B approach
P0: ZLP = 44
Bound: Z = − ∞
5x1+ 7x2+ 4x3+ 3x4 ≤ 14 (x1= x2 = 1
x3 =1/2, x4 = 0)
x3 = 1 x3 = 0
P1: ZLP = 43 5
7
(x1= x3 = 1
x2 =5/7, x4 = 0)
x2 = 1 x2 = 0
P2: ZLP = 43 3
5
(x1= 3/5
x2 = x3 =1, x4 = 0)
85
Solving Knapsack problem by B&B approach
P0: ZLP = 44 Update
5x1+ 7x2+ 4x3+ 3x4 ≤ 14 Bound: Z = 42
(x1= x2 = 1
x3 =1/2, x4 = 0)
x3 = 1 x3 = 0
P1: ZLP = 43 5
7
(x1= x3 = 1
x2 =5/7, x4 = 0)
x2 = 1 x2 = 0
P2: ZLP = 43 3
5
(x1= 3/5
x2 = x3 =1, x4 = 0)
x1 = 0
x1 = 1
86
Solving Knapsack problem by B&B approach
P0: ZLP = 44 Bound: Z = 42
5x1+ 7x2+ 4x3+ 3x4 ≤ 14 (x1= x2 = 1
x3 =1/2, x4 = 0)
x3 = 1 x3 = 0
P1: ZLP = 43 5
7
(x1= x3 = 1
x2 =5/7, x4 = 0)
x2 = 1 x2 = 0
87
Solving Knapsack problem by B&B approach
P0: ZLP = 44 Bound: Z = 42
5x1+ 7x2+ 4x3+ 3x4 ≤ 14 (x1= x2 = 1
x3 =1/2, x4 = 0)
x3 = 1 x3 = 0
P1: ZLP = 43 5 P6: ZLP = 43 13
7
(x1= x3 = 1 (x1= x2 = 1
x2 =5/7, x4 = 0) x3 =0, x4 = 2/3)
x2 = 1 x2 = 0
x4 = 0
P2: ZLP = 43 3 P5: ZLP = 36 x4 = 1
5 (x1= x3 = 1
(x1= 3/5
x2 = x3 =1, x4 = 0) x2 =0, x4 = 1)
x1 = 0 Fathomed
x1 = 1
88
Solving Knapsack problem by B&B approach
P0: ZLP = 44 Bound: Z = 42
5x1+ 7x2+ 4x3+ 3x4 ≤ 14 (x1= x2 = 1
x3 =1/2, x4 = 0)
x3 = 1 x3 = 0
P1: ZLP = 43 5 P6: ZLP = 43 13
7
(x1= x3 = 1 (x1= x2 = 1
x2 =5/7, x4 = 0) x3 =0, x4 = 2/3)
x2 = 1 x2 = 0
x4 = 0
P2: ZLP = 43 3 P5: ZLP = 36 x4 = 1
5 (x1= x3 = 1
(x1= 3/5
x2 = x3 =1, x4 = 0) x2 =0, x4 = 1)
x1 = 0 Fathomed
x1 = 1
P7: ZLP = 42 6
P4: ZLP = 42 7
P3: Infeasible (x1= x4 = 1
Fathomed (x1= 0 x3 =0, x2 = 6/7)
x2 = x3 = x4 = 1) Fathomed
Fathomed Branching on P7 will not
give a value better than 42.
Why? 89
Solving Knapsack problem by B&B approach
P0: ZLP = 44
(x1= x2 = 1
x3 =1/2, x4 = 0)
x3 = 1 x3 = 0
P1: ZLP = 43 5 P6: ZLP = 43 13
7
(x1= x3 = 1 (x1= x2 = 1
x2 =5/7, x4 = 0) x3 =0, x4 = 2/3)
x2 = 1 x2 = 0
x4 = 0
P2: ZLP = 43 3 P5: ZLP = 36 x4 = 1
5 (x1= x3 = 1
(x1= 3/5
x2 = x3 =1, x4 = 0) x2 =0, x4 = 1)
x1 = 0 Fathomed
x1 = 1
P7: ZLP = 42 6 P8: ZLP = 38
P4: ZLP = 42 7
P3: Infeasible (x1= x4 = 1 (x1= x2 = 1
Fathomed (x1= 0 x3 =0, x2 = 6/7) x2 = x4 = 0)
x2 = x3 = x4 = 1) Fathomed Fathomed
Fathomed Branching on P7 will not
Optimal Solution give a value better than 42.
Why? 90
Traveling Salesman Problem (TSP)
Traveling Salesman Problem (TSP) deals with finding a minimum cost (distance
or time) tour for a salesman visiting n cities where
each city is visited exactly once
and the salesman returns to the starting city
Tour: A tour is a complete route through the n cities where no city is visited more
than once
Subtour: A subtour is a round trip that does not pass through all cities
Network representation
of the TSP
91
Traveling Salesman Problem (TSP) (Contd…)
Integer programming formulation of TSP
Suppose TSP consists of n cities i = j = 1,2,…, n.
cij = distance (time or cost) from city i to city j, for i j
cij = M (a large positive number), for i j
1 if the salesman goes from city i to city j
xij
n n 0 otherwise
Min Z cij xij
i 1 j 1
n
s.t. x
i 1
ij 1 for j 1,2,, n (the salesman must arrive at each city once)
x
j 1
ij 1 for i 1,2,, n (the salesman must leave each city once)
uj 0 for j 1, 2, ,n 92
Traveling Salesman Problem (TSP) (Contd…)
Cycle Total Distance (in miles)
1. 1-2-3-4-5-1 79
3
2. 1-2-3-5-4-1 108
29
3. 1-2-4-3-5-1 80 11
4. 1-2-4-5-3-1 105 30
20
2
5. 1-2-5-3-4-1 78
6. 1-2-5-4-3-1 74 8 4
7. 1-3-4-2-5-1 67 => Shortest Tour
13
8. 1-3-2-4-5-1 97 22
9. 1-3-5-2-4-1 96 20
10. 1-3-2-5-4-1 95 16
12. 1-4-3-2-5-1 70 6 5
• Of course, This trial approach can only be used for small problems.
94
Branch and Bound approach for TSP
95
Branch and Bound approach for TSP
Solution Procedure
Step 0: Ignore the subtour elimination constraint from TSP. The resulting problem is an
assignment problem.
Step 1: Solve the associated assignment problem using Hungarian Algorithm.
Step 2: If the optimal solution to the assignment problem provides a tour (i.e., no subtour), then it
is the optimal solution to the TSP and STOP. OTHERWISE (the optimal solution to the
assignment problem yields subtours), go to Step 3 (restrictions are imposed to remove the
subtours).
Step 3: Select a subtour with the smallest number of cities (because it creates the smallest number
of subproblems). Let k be the number of cities in the selected subtour (i1 - i2 -…- ik - i1).
Step 4: Branch into k subproblems (branches). Then for the subproblems P1, P2,…,Pk , set
c i1i2 M
c i2i3 M
c ik i1 M, respectively
Step 5: Solve one of the subproblem. If the solution of the resulting assignment problem provides
a tour it provides an upper bound (minimum tour length). Otherwise, Go to Step 3.
Step 6: Continue the process until all the unexplored subproblems have been fathomed (better
upper bound or subproblem cannot produce a better solution).
Step 7: The optimum tour is the one associated with the best upper bound.
96
Branch and Bound approach for TSP
City 1 0 10 3 6 9
City 2 5 0 5 4 2
City 3 4 9 0 7 8
City 4 7 1 3 0 4
City 5 3 2 6 5 0
97
Ignoring the subtour elimination constraint from TSP: Solve the
resulting Assignment Problem using Hungarian Algorithm
Subproblem P0
Z* = Bound= M
98
Row Reduction
City 1 City 2 City 3 City 4 City 5
City 1 M 7 0 3 6
City 2 3 M 3 2 0
City 3 0 5 M 3 4
City 4 6 0 2 M 3
City 5 1 0 4 3 M
Column Reduction
City 1 City 2 City 3 City 4 City 5
City 1 M 7 0 1 6
City 2 3 M 3 0 0
City 3 0 5 M 1 4
City 4 6 0 2 M 3
City 5 1 0 4 1 M
99
Optimal Solution: x13 x25 x31 x42 x54 1 , all other xij = 0, ZA = 15.
This solution has two subtours: 1 – 3 – 1 and 2 – 5 – 4–2. So, this is not optimal
solution to the TSP. 100
Z* = Bound = M P0: ZA = 15
(1-3-1) (2-5-4-2)
x13 = 0 x31 = 0
P1:
P1: ZA = 17
(2-5-2)(1-4-3-1)
x25 = 0 x52= 0
P2:
Branch on Subproblem P1:
Subproblem P2: Subproblem P1 with constraint x25 =0, i.e. Set c25 = M)
Subproblem P2 City 1 City 2 City 3 City 4 City 5
City 1 M 10 M 6 9
City 2 5 M 5 4 M
City 3 4 9 M 7 8
City 4 7 1 3 M 4
City 5 3 2 6 5 M
103
Optimal Solution: x14 x23 x31 x45 x52 1, all other xij = 0, ZA = 21
This solution gives a tour: 1 – 4 – 5 – 2 – 3 – 1. So, this is a feasible solution to the
TSP. Fathomed (feasible solution and update the bound)
Z* = Bound= 21
104
Z* = Bound= 21 P0: ZA = 15
(1-3-1) (2-5-4-2)
x13 = 0 x31 = 0
P1: ZA = 17
(2-5-2)(1-4-3-1)
x25 = 0 x52= 0
P2: ZA = 21 P3:
(1-4-5-2-3-1)
Fathomed
Subproblem P3: Subproblem P1 with constraint x52 =0, i.e. Set c52 = M)
City 1 City 2 City 3 City 4 City 5
City 1 M 10 M 6 9
Subproblem P3
City 2 5 M 5 4 2
City 3 4 9 M 7 8
City 4 7 1 3 M 4
City 5 3 M 6 5 M
105
Optimal Solution: x14 x25 x31 x42 x53 1, all other xij = 0, ZA = 19
This solution gives a tour: 1 – 4 – 2 – 5 –3 – 1. So, this is a feasible solution to the TSP.
Fathomed (Update bound since this is better solution) Z* = Bound= 19 106
P0: ZA = 15
Z* = Bound= 19
(1-3-1) (2-5-4-2)
x13 = 0 x31 = 0
P1: ZA = 17 P4:
(2-5-2)(1-4-3-1)
x25 = 0 x52= 0
P2: ZA = 21 P3: ZA = 19
(1-4-5-2-3-1) (1-4-2-5-3-1)
Fathomed Fathomed
Subproblem P4:
107
Optimal Solution: x13 x25 x34 x42 x51 1, all other xij = 0, Z = 16.
This solution gives a tour: 1 – 3 – 4 – 2 –5 – 1. So, this is a feasible solution to the TSP.
Fathomed (Update bound since this is better solution)
Z* = Bound= 16
108
Optimal
Z* = 16 solution to
P0: ZA = 15
(1-3-1) (2-5-4-2) the TSP
x13 = 0 x31 = 0
P1: ZA = 17 P4: ZA = 16
(2-5-2)(1-4-3-1) (1-3-4-2-5-1)
Fathomed
x25 = 0 x52= 0
P2: ZA = 21 P3: ZA = 19
(1-4-5-2-3-1) (1-4-2-5-3-1)
Fathomed Fathomed