Operations Research: Integer Programming
Operations Research: Integer Programming
Integer Programming
Introduction to integer programming
An Integer programming (IP) in which all
variables are required to be integers is call a pure
integer programming problem.
An IP in which only some of the variables are
required to be integers is called a mixed integer
programming problem.
An integer programming problem in which all the
variables must be 0 or 1 is called a 0-1 IP.
The LP obtained by omitting all integer or 0-1
constraints on variables is called LP relaxation of
the IP.
2
Introduction to integer programming
ILPs occur frequently
Scheduling workers
Manufacturing airplanes
3
Integrality conditions
5
ILP Models
Models names Applications
Assignment Airline Scheduling
Shortest Path
Traveling Salesman
6
Example: California manufacture company
7
Example: Capital budgeting - CRT Technologies
8
Defining the decision variables
1, if project i is selected
x i 1, 2,...,6
i 0, otherwise
9
Defining the constraints
Capital constraints
75x1 + 90x2 + 60x3 + 30x4 + 100x5 + 50x6 ≤ 250 } year 1
25x1 + 35x2 + 15x3 + 20x4 + 25x5 + 20x6 ≤ 75 } year 2
20x1 + 0x2 + 15x3 + 10x4 + 20x5 + 10x6 ≤ 50 } year 3
15x1 + 0x2 + 15x3 + 5x4 + 20x5 + 30x6 ≤ 50 } year 4
10x1 + 30x2 + 15x3 + 5x4 + 20x5 + 40x6 ≤ 50 } year 5
Binary constraints
All xi must be binary
10
Example: An employee scheduling problem
11
Defining the decision variables
x1 = the number of workers assigned to shift 1
x2 = the number of workers assigned to shift 2
x3 = the number of workers assigned to shift 3
x4 = the number of workers assigned to shift 4
x5 = the number of workers assigned to shift 5
x6 = the number of workers assigned to shift 6
x7 = the number of workers assigned to shift 7
12
Defining the objective function
Minimize the total wage expense.
Min: 680x1 +705x2 +705x3 +705x4 +705x5 +680x6 +655x7
0
0 1 2 3 4 x1
1515
Bounds
The optimal solution to an LP relaxation of an ILP
problem gives us a bound on the optimal
objective function value.
For maximization problems, the optimal relaxed
objective function values is an upper bound on
the optimal integer value.
For minimization problems, the optimal relaxed
objective function values is a lower bound on the
optimal integer value.
16
Rounding
It is tempting to simply round a fractional
solution to the closest integer solution.
In general, this does not work reliably:
The rounded solution may be infeasible.
The rounded solution may be suboptimal.
17
How rounding down can result in an
infeasible solution
x2
2
optimal relaxed solution
0
0 1 2 3 4 x1
18
Solving IP: Branch-and-bound algorithm
Branching: among the remaining sub-
problems, select the one that was created
most recently.
Bounding: for each new sub-problem, obtain
its bound by solving its LP relaxation problem.
Testing/fathoming: apply the three tests
(Bound worse, Infeasible, Integral), and
terminate branching that are fathomed by any
of the tests.
Stopping: when there are no remaining sub-
problems
19
The branch-and-bound example
Max: 2x1 + 3x2
S.T. x1 + 3x2 ≤ 8.25
2.5x1 + x2 ≤ 8.75
x1, x2 ≥ 0 and integer
20
Solution to LP relaxation
x2 3 Feasible Integer Solutions
0
0 1 2 3 4 x1
21
Solution to LP relaxation
Solution to LP relaxation
22
The branch-and-bound algorithm
Solution to LP relaxation
Infeasible 23
Branch-and-bound summary
Max: 2x1 + 3x2
S.T. x1 + 3x2 ≤ 8.25
2.5x1 + x2 ≤ 8.75 Original Problem
x1=2.769
x1, x2 ≥ 0 and integer x2=1.826
Obj = 11.019 x1 ≥ 3
x1 ≤ 2
Problem II
Problem I
x1=2 x1=3
x2=2.083 x2=1.25
Obj = 10.25 Obj = 9.75
x2 ≤ 2 x2 ≥ 3
25
Stopping rules
Because B&B take so long, most ILP packages allow you
to specify a sub optimality tolerance factor.
This allows you to stop once an integer solution is found
that is within some % of the global optimal solution.
Bounds obtained from LP relaxations are helpful here.
Example
o LP relaxation has an optimal obj. value of $64,306.
o 95% of $64,306 is $61,090.
o Thus, an integer solution with obj. value of $61,090 or better
must be within 5% of the optimal solution.
26
ILP with solver
In large ILP problems, there may be thousands of branches for exploration.
Solver has to solve thousands of LP problems and this can be very time
consuming. We can curtail this by selecting appropriate options.
27
ILP with solver
Selecting appropriate values, we can
terminate the program earlier and
accept the best result obtained up to
the termination time. This may or
may not be optimal.
28
Set partitioning algorithm
29
Set partitioning algorithm
Model:
30
Set covering algorithm
31
Set packing algorithm
32
Implementation – set partitioning algorithm
Route generation
Route Port served by ship Route Time Fixed Cost Fuel Cost Port Cost CO2 Cost Route Cost
Route
Index 2 3 4 5 6 7 (hr) (USD) (USD) (USD) (USD) (USD)
1 1-2-1 1 0 0 0 0 0 69.60 10,434.93 15,139.68 4,600.00 477.35 30,651.96
1 1-3-1 0 1 0 0 0 0 81.49 10,434.93 21,505.67 4,600.00 695.87 37,236.46
1 1-4-1 0 0 1 0 0 0 67.20 10,434.93 13,854.24 4,600.00 433.22 29,322.39
1 1-5-1 0 0 0 1 0 0 103.43 10,434.93 33,258.26 4,600.00 1,099.29 49,392.48
1 1-6-1 0 0 0 0 1 0 118.06 10,434.93 41,093.32 4,600.00 1,368.24 57,496.49
1 1-7-1 0 0 0 0 0 1 100.34 10,434.93 31,605.56 4,600.00 1,042.56 47,683.04
1 1-2-3-1 1 1 0 0 0 0 118.17 10,434.93 29,252.22 6,900.00 969.21 47,556.36
1 1-2-4-1 1 0 1 0 0 0 112.17 10,434.93 26,038.62 6,900.00 1,260.03 44,633.58
1 1-2-5-1 1 0 0 1 0 0 143.83 10,434.93 42,994.20 6,900.00 1,842.05 62,171.18
1 1-2-6-1 1 0 0 0 1 0 151.60 10,434.93 47,156.56 6,900.00 1,984.93 66,476.42
Single 1 1-2-7-1 1 0 0 0 0 1 150.46 10,434.93 46,544.42 6,900.00 1,963.92 65,843.27
1 1-3-4-1 0 1 1 0 0 0 109.49 10,434.93 24,600.15 6,900.00 1,210.65 43,145.73
routes 1 1-3-5-1 0 1 0 1 0 0 141.60 10,434.93 41,800.56 6,900.00 1,801.08 60,936.57
1 1-3-6-1 0 1 0 0 1 0 151.49 10,434.93 47,095.34 6,900.00 1,581.70 66,011.97
1 1-3-7-1 0 1 0 0 0 1 149.14 10,434.93 45,840.54 6,900.00 1,939.75 65,115.22
1 1-4-5-1 0 0 1 1 0 0 128.34 10,434.93 34,700.06 6,900.00 1,557.34 53,592.33
1 1-4-6-1 0 0 1 0 1 0 138.23 10,434.93 39,994.84 6,900.00 1,739.09 59,068.86
1 1-4-7-1 0 0 1 0 0 1 138.91 10,434.93 40,362.10 6,900.00 1,751.70 59,448.73
1 1-5-6-1 0 0 0 1 1 0 152.00 10,434.93 47,370.80 6,900.00 1,992.28 66,698.01
1 1-5-7-1 0 0 0 1 0 1 136.63 10,434.93 39,137.88 6,900.00 1,709.68 58,182.49
1 1-6-7-1 0 0 0 0 1 1 151.83 10,434.93 47,279.00 6,900.00 1,989.13 66,603.06
1 1-2-3-4-1 1 1 1 0 0 0 146.17 10,434.93 32,346.68 9,200.00 1,885.12 53,866.73
1 1-4-5-7-1 0 0 1 1 0 1 161.54 10,434.93 40,579.66 9,200.00 1,365.47 61,580.06
Multiple 2 1-2-1-3-1 1 1 0 0 0 0 151.09 10,434.93 34,978.79 9,200.00 1,975.47 56,589.19
2 1-2-1-4-1 1 0 1 0 0 0 136.80 10,434.93 27,327.36 9,200.00 1,712.83 48,675.12
routes 2 1-3-1-4-1 0 1 1 0 0 0 148.69 10,434.93 33,693.35 9,200.00 1,931.35 55,259.63
2 1-4-1-7-1 0 0 1 0 0 1 167.54 10,434.93 43,793.24 9,200.00 2,278.04 65,706.21
33
Implementation – set partitioning algorithm
Route selection
Route Port served by ship Route Time Fixed Cost Fuel Cost Port Cost CO2 Cost Route Cost Routes
Route Xij
Index 2 3 4 5 6 7 (hr) (USD) (USD) (USD) (USD) (USD) selection
1 1-2-1 1 0 0 0 0 0 69.60 10,434.93 15,139.68 4,600.00 477.35 30,651.96 1 30,651.96
1 1-3-1 0 1 0 0 0 0 81.49 10,434.93 21,505.67 4,600.00 695.87 37,236.46 0 -
1 1-4-1 0 0 1 0 0 0 67.20 10,434.93 13,854.24 4,600.00 433.22 29,322.39 0 -
1 1-5-1 0 0 0 1 0 0 103.43 10,434.93 33,258.26 4,600.00 1,099.29 49,392.48 0 -
1 1-6-1 0 0 0 0 1 0 118.06 10,434.93 41,093.32 4,600.00 1,368.24 57,496.49 0 -
1 1-7-1 0 0 0 0 0 1 100.34 10,434.93 31,605.56 4,600.00 1,042.56 47,683.04 0 -
1 1-2-3-1 1 1 0 0 0 0 118.17 10,434.93 29,252.22 6,900.00 969.21 47,556.36 0 -
1 1-2-4-1 1 0 1 0 0 0 112.17 10,434.93 26,038.62 6,900.00 1,260.03 44,633.58 0 -
1 1-2-5-1 1 0 0 1 0 0 143.83 10,434.93 42,994.20 6,900.00 1,842.05 62,171.18 0 -
1 1-2-6-1 1 0 0 0 1 0 151.60 10,434.93 47,156.56 6,900.00 1,984.93 66,476.42 0 -
1 1-2-7-1 1 0 0 0 0 1 150.46 10,434.93 46,544.42 6,900.00 1,963.92 65,843.27 0 -
1 1-3-4-1 0 1 1 0 0 0 109.49 10,434.93 24,600.15 6,900.00 1,210.65 43,145.73 0 -
1 1-3-5-1 0 1 0 1 0 0 141.60 10,434.93 41,800.56 6,900.00 1,801.08 60,936.57 0 -
1 1-3-6-1 0 1 0 0 1 0 151.49 10,434.93 47,095.34 6,900.00 1,581.70 66,011.97 1 66,011.97
1 1-3-7-1 0 1 0 0 0 1 149.14 10,434.93 45,840.54 6,900.00 1,939.75 65,115.22 0 -
1 1-4-5-1 0 0 1 1 0 0 128.34 10,434.93 34,700.06 6,900.00 1,557.34 53,592.33 0 -
1 1-4-6-1 0 0 1 0 1 0 138.23 10,434.93 39,994.84 6,900.00 1,739.09 59,068.86 0 -
1 1-4-7-1 0 0 1 0 0 1 138.91 10,434.93 40,362.10 6,900.00 1,751.70 59,448.73 0 -
1 1-5-6-1 0 0 0 1 1 0 152.00 10,434.93 47,370.80 6,900.00 1,992.28 66,698.01 0 -
1 1-5-7-1 0 0 0 1 0 1 136.63 10,434.93 39,137.88 6,900.00 1,709.68 58,182.49 0 -
1 1-6-7-1 0 0 0 0 1 1 151.83 10,434.93 47,279.00 6,900.00 1,989.13 66,603.06 0 -
1 1-2-3-4-1 1 1 1 0 0 0 146.17 10,434.93 32,346.68 9,200.00 1,885.12 53,866.73 0 -
1 1-4-5-7-1 0 0 1 1 0 1 161.54 10,434.93 40,579.66 9,200.00 1,365.47 61,580.06 1 61,580.06
2 1-2-1-3-1 1 1 0 0 0 0 151.09 10,434.93 34,978.79 9,200.00 1,975.47 56,589.19 0 -
2 1-2-1-4-1 1 0 1 0 0 0 136.80 10,434.93 27,327.36 9,200.00 1,712.83 48,675.12 0 -
2 1-3-1-4-1 0 1 1 0 0 0 148.69 10,434.93 33,693.35 9,200.00 1,931.35 55,259.63 0 -
2 1-4-1-7-1 0 0 1 0 0 1 167.54 10,434.93 43,793.24 9,200.00 2,278.04 65,706.21 0 -
TOTAL 3 158,243.98
34
Set covering problem
Given m sets and n items:
1, if set j includes item i
Aij Columns = sets
0, otherwise
ci cost of set j Rows = items
1, if set j is included
xj
0, otherwise
n
Minimize c
j 1
j xj
s.t.
n
a
j 1
i, j x j 1, i 1..n
x j 0,1 , j 1..n 35
Example of Set covering problem
Nine districts (D1, D2,.., D9 D1
D9) are to be covered * *
within acceptable time
limits by emergency D2
vehicles. *
S1 S2 S3 S4 S5 S6 S7
D1 0 1 0 1 0 0 1
D2 1 0 0 0 0 1 1
D3 0 1 0 0 0 1 1 What do 0 and 1
D4 0 1 1 0 1 1 0 in the table
indicate?
D5 1 0 1 0 1 0 0
D6 1 0 0 1 0 1 0
D7 1 0 0 0 0 0 1
D8 0 0 1 1 1 0 0
D9 1 0 0 0 1 0 0
37
Set covering formulation
Set Covering
Decisions Site S1 S2 S3 S4 S5 S6 S7
Objectives Sites 1 1 1 1 1 1 1 0
Set Covering
Decisions Site S1 S2 S3 S4 S5 S6 S7
0 0 0 1 1 0 1
Objectives Sites 1 1 1 1 1 1 1 3
The new owner has identified nine potential locations where a motel
might be located. However, some of these locations are within 30 miles of
each other, and the owner prefers to separate motels in the chain by at
least 30 miles to avoid cannibalizing demand. The following information
about location conflicts has been obtained from a map
42