1 Network Optimization Chapter 2 Transshipment Problem.
-
Upload
lesley-parrish -
Category
Documents
-
view
231 -
download
3
Transcript of 1 Network Optimization Chapter 2 Transshipment Problem.
1
Network Optimization
Chapter 2Transshipment Problem
2
G = (V, E) is a digraph. |V|=n, |E|=m. A type of commodity is shipped on the network. For each arc , is the cost of sending
one unit of commodity from vertex i to vertex j
. Vector c = has m components, and is
called the cost vector. There are three kinds of vertices:
2.1 The Network Simplex Method
ijc
0ijc
ji,
ijc
3
2.1 The Network Simplex Method
(1) Source If the supply at source i is ( >0 ),
then let bi =- . (2) Sink If the demand at sink j is ( >0 ),
then let bj = . (3) Intermediate vertex Neither a source, nor a sink. If k is an
intermediate vertex, then let bk = 0.
ii
jj
4
2.1 The Network Simplex Method
S denotes supply and D denotes demand
5
2.1 The Network Simplex Method
Balanced transshipment problem
Total supply = total demand: , i.e.
ji
01
n
iib
6
2.1 The Network Simplex Method
inflow at vertex i ~ the total commodity sent to i;
outflow at vertex i ~ the total commodity sent out from i;
netflow at vertex i ~ inflow at i - outflow at i; flow vector x ~ , where is the
amount of commodity from i to j ; feasible flow x ~ a flow x that makes the
netflow at each vertex i equal bi .
ijx mij Rxx
0ijx
7
2.1 The Network Simplex Method
A Feasible Flow
8
2.1 The Network Simplex Method
Single commodity uncapacitated transshipment problem
Find a feasible flow such that its cost is as low as possible.
Let A be the incidence matrix of the network.
The supply-demand can be expressed by
Ax=b
0x
9netflow at i
2.1 The Network Simplex Method
For example, if at vertex i:
then
n
i
b
b
b
x
x
x
i
1
3
2
1
0...0111
e1 e2 e3
A x b
ibxxx 321
10
2.1 The Network Simplex Method
The transshipment problem is now formulated as
min cx s.t. Ax=b
c ~ row vector, x & b ~ column vector c, , uncapacitated ~ all xij have no upper
bound
0x
mRx nb R
11
2.1 The Network Simplex Method
Example 2.1 Consider the network shown below with 7
vertices and 10 arcs in which any flow vector x is of the form
xT = [x13 x21 x32 x51 x52 x61 x64 x67 x74 x75]. The cost vector is given by c = [1 1 1 1 5 11 20 5 5 6] and the supply-demand vector by bT = [0 2 3 5 -2 -3 -5].
12
2.1 The Network Simplex Method
13
2.1 The Network Simplex Method
111
111
111
11
11
111
1111
A
7
6
5
4
3
2
1
1 2 3 4 5 6 7 8 9 10e e e e e e e e e e
14
2.1 The Network Simplex Method
Note that the rows of A are linearly dependent because the sum of all rows of A is a zero vector.
So, rank (A) < n. On the other hand, we will see later that A
contains an nonsingular submatrix. Therefore, rank (A) = n-1. We may delete one equation from Ax = b
without changing the solution set.
111
111
111
11
11
111
1111
A
11 nn
15
Do you still remember?
What is a basic? What is a basic solution? What is a basic feasible solution? What is the main idea of Simplex
method? From a vertex (feasible basic sol) to another vertex, obj. value keep decreasing.
16
2.1 The Network Simplex Method
Feasible tree solution (FTS) A feasible flow x is called an FTS if
there is a spanning tree T such that if . As each spanning tree has n-1
edges, an FTS x has at most n-1 nonzero components xij.
0ijx Tji ,
17
2.1 The Network Simplex Method
If an FTS x has n-1 nonzero components, then the associated spanning tree is unique. It must be the tree consisting of the n-1 edges eij that correspond to the n-1 nonzero xij.
We call such an FTS a nondegenerate FTS. An FTS x is called a degenerate FTS if the
number of nonzero components is less than n-1.
A degenerate FTS may associate with more than one spanning tree.
18
2.1 The Network Simplex Method
Example
b = (-3, 3, 0, 0)T
11
11
11
11
A
It is easy to see that x = ( 3, 0, 0, 0 )T is a feasible solution of the equation Ax = b.
19
2.1 The Network Simplex Method
In fact x is a degenerate FTS, and the associated spanning trees are not unique. They can be one of the following trees:
Conversely, every spanning tree T is associated with at most one feasible tree solution.
20
The above few pages told you
FS can be classified into FTS/not FTS. FTS can be further classified into DE/non-DE. Given non-DE FTS, we can defined a unique
ST. Given DE FTS, there will be many ST.
The following few pages tell: Given a ST, we can solve for a unique solution. The solution may be a FS or not FS.
21
2.1 The Network Simplex Method
By relabeling vertices and arcs, we may let the part of A corresponding to the arcs in T contain a nonsingular matrix B.
For example, if we consider the following spanning tree T (formed by solid lines) in Example 2.1:
11 nn
22
2.1 The Network Simplex Method
It is not clear if in A, the columns corresponding to the arcs in T contain an nonsingular B.
111
111
111
11
11
111
1111
A
11 nn
23
2.1 The Network Simplex Method
Relabel vertices and arcs as follows:
24
2.1 The Network Simplex Method
How to relabel?First pick up an arbitrary vertex and label it as th
e first one. In general suppose i vertices and i-1 arcs in the tr
ee are already relabeled ( ). Then from all unlabeled vertices, choose one (say w) which is adjacent to a relabeled vertex (say u), and label w as the i+1th vertex, and also label the arc between w and u in the tree (either (u,w), or (w,u)) as the ith arc.
Repeat the procedure until we have labeled all n vertices and n-1 arcs in the tree.
1 1 ni
25
2.1 The Network Simplex Method
a7, a8, a9, a10 are the four arcs not in T, now the incidence matrix
7
6
5
4
3
2
1
....1
....11
....1
....11
....11
....111
1
v
v
v
v
v
v
v
A
1 2 3 4 5 6 7 8 9 10a a a a a a a a a a
26
2.1 The Network Simplex Method
Let x = (x1, … , x10)T , where xi corresponds to arc ai. Rows 2-7 and columns 1-6 form a matrix B, which is upper triangular, and the diagonal elements are 1 or -1. So, B is a nonsingular matrix.
11 nn
7
6
5
4
3
2
1
....1
....11
....1
....11
....11
....111
1
v
v
v
v
v
v
v
A
27
2.1 The Network Simplex Method
The feasible tree solution corresponding to T must have
x7 = x8 = x9 = x10 = 0. For xB= ( x1, x2, x3, x4, x5, x6 )T, it can be
decided by
bi ~ the supply or demand, or zero corresponding to vi.
7
3
2
b
b
b
BxB def
b
28
2.1 The Network Simplex Method
Therefore, xB is uniquely determined:
(1) If , then is an FTS, i.e., T is associated with a unique FTS.
(2) If some components of xB are negative, then is not a feasible solution, i.e., T is not associated with any FTS.
bBxB1
0Bx 0,0,0,0,TB
T xx
0,0,0,0,TB
T xx
29
2.1 The Network Simplex Method
Summary of the relationship between FTS and ST
30
2.1 The Network Simplex Method
From the above analysis, we know that a Tree Solution is actually a Basic Solution of the system Ax = b, and the base B can be determined by an associated spanning tree. An FTS is a feasible basic solution (FBS).
In simplex method we move from one FBS to another FBS. Now in network simplex method, we move from one FTS to another FTS, and geometrically, from one spanning tree to another spanning tree.
31
2.1 The Network Simplex Method
The dual solution defined by a spanning tree
We know that the dual problem of min cx s.t. Ax=b
is max yb s.t. where y is a row vector: . Also, the complementarity slackness condition
holds.
0x
cyA
nn yyyy ,,...,, 121
32
2.1 The Network Simplex Method
Now for a nondegenerate FTS x, the associated spanning tree T is unique, and for any arc in T, . Let the column in A which corresponds to arc be , then by the complementarity slackness condition,
ijijij cyAx 0
i.e.
ijn cj
iyy
1
1,,1
(*)
ji,0ijx
ji, ijA
Tjicyy ijji ),( ,
33
2.1 The Network Simplex Method
The above set (*) has n-1 equations for n variables. So, the solutions are not unique. If we fix yn = 0, then y1, … , yn-1 can be uniquely determined. (If we fix yn to another value t, then in the solution, each shall increase its value by t.)
We call the row vector , determined by the equations (*), the dual solution defined by the spanning tree T.
ijji cyy Tji , (*)
0,,, 11 nyyy
iy
34
2.1 The Network Simplex Method
Profitable arcs Suppose x is an FTS that defines a spanning
tree T(x) and a dual solution y. An arc (i, j) which is not in T(x) is said to be profitable with respect to the FTS x if .
Note that if we change the value of yn in deciding y, as all shall change by the same value, the value of every shall remain unchanged. So, the determination of profitable arcs is independent of the value of yn chosen.
ijij cyy
iyij yy
35
2.1 The Network Simplex Method
Theorem 2.2 An FTS u with no profitable arcs is an optimal solution.
Proof Suppose u is associated with tree T(u) and dual solution y. Define
. We know that . In fact (1) If arc , then by the definition of y, (2) If arc , then . So, for any arc , .
yAcc 0uc
uTji ,
0 jiijjiijij yycyycc
uTji , 0iju
ji, 00 ucuc ijij
36
2.1 The Network Simplex Method
Now for any feasible solution v: Av= b, ,
. (1) In particular, when v = u, . (2) (1) - (2): .
0v
ybvcvyAccv
ybybuccu vccucv
37
2.1 The Network Simplex Method
Since there is no profitable arc, for any arc ,
. But , and hence
u is an optimal solution.
ji,
0 jiijijijij yycccyy
0vcucvvc 0
38
2.1 The network simplex method
The above theorem provides an optimality criterion.
Now we consider what happens if there is a profitable arc . Of course e is not in T, and . If we can increase the flow on
from to , meanwhile keep for other arcs not in T, then as , we may have
(will explain in detail later), i.e. we obtain a better solution v.
qpe ,0pqc qp,
0pqu 0tv pq 0 ijij uv ji, 0 pqpqvc
0 tcvccucv pq
39
2.1 The Network Simplex Method
When arc e is added to the spanning tree T, a unique cycle C(e) will be obtained.
40
2.1 The Network Simplex Method
In the cycle, we call each arc with the same direction as e a forward arc (arcs e1 & e2 in the above graph) and each arc with the opposite direction a backward arc (arcs e3 & e4 in the above graph).
If the flow along arc e is increased from 0 to t, then the flow along each forward arc ei is from ui to ui+t, and the flow along each backward arc ej is from uj to uj-t.
41
2.1 The Network Simplex Method
There must be some backward arcs in the cycle. Why? Because if not, we may increase t infinitely (Can this problem be unbounded?).
But when , the new feasible flow v shall let , which is impossible as and .
t tccucv pq cv
0c 0v
42
2.1 The Network Simplex Method
Now since cycle C(e) has backward arcs, when t is increased to certain amount, the flow along a backward arc becomes zero, and we cannot further increase t (for otherwise some flow shall become negative, violating the feasibility).
43
2.1 The Network Simplex Method
In the above example, the largest value of t to maintain a non-negative flow is .
Suppose t = u3. In this case, call e3 the leaving arc. Generally, if an arc f in C(e) is the leaving arc, we
obtain a new tree by deleting and adjoining .
The updated flow vector v is associated with , i.e., v is a new FTS, and the associated spanning tree is .
43 ,min uut
T uTf uTe
T
TvT
44
2.1 The Network Simplex Method
Theorem 2.3 If u is an FTS with a profitable arc e and if v is the updated flow using this arc e, then v is an FTS and .
Proof We first show that v is still an FTS, because
(1) When we change from flow u to v, the net-flow at each vertex remains unaffected, and hence all supply / demand requirements are still satisfied, i.e. Av = b.
(2) Obviously, .
cucv
0v
45
2.1 The Network Simplex Method
We next show that . Let , where y is the dual solution of u. By Theorem 2.2, . Consider two types of arcs: (a) If arc is in the tree T(u)
(b) If arc is not in the T(u) and other than the profitable arc .
cucv yAcc
vccucv
ji,
0ijc 0 ijij vc
ji, qp,
0ijv 0 ijij vc
46
2.1 The Network Simplex Method
Therefore, . In particular, if u is a nondegenerate FTS , arc t = min { uij | is a backward arc of
T(u) } >0 . If all calculated FTS are non-degenerate,
the computation must be terminated after a finite number of iterations (i.e. no cycling).
0pqpqijij vcvcvc cucv
0 iju uTji ,
ji,0 tv pq cucv uv
47
2.1 The Network Simplex Method
We now summarize the steps. Initial Step: find an initial FTS and an
associated spanning tree . Let k = 1. Iterative Steps: for k = 1, 2, … Step 1 Calculate dual solution on the
tree . Step 2 If , i.e., the
network has no profitable arc, terminate, is the optimal FTS. Otherwise obtain a profitable arc with .
)1(x)1(T
)(ky)(kT
ijk
ik
j cyy )()( )(, kTji )(kx
)(, kTqpe pqk
pk
q cyy )()(
48
2.1 The Network Simplex Method
Step 3 Form the cycle and determine t = min { | is a backward arc in C(e) } Suppose the minimum is attained at arc f. Let If (i, j) is a forward arc of C(e) If (i, j) is a backward arc of C(e) If (i, j) = (p, q) For other arcs and . and return to Step 1.
)()( kTeeC )(k
ijx ji,
,
,
,
,
1
kij
kij
kij
kij
x
t
tx
tx
x
feTT kk )()1(
1 kk
49
2.1 The Network Simplex Method
Let us now use Example 2.1 to explain the algorithm.
S = 3
S = 5 S = 2
D = 5
D = 2
D = 3
50
Tradition about arc labeling
In the above example, there are totally 10 arcs: (1,3), (2,1), (3,2) (5,1), (5,2), (6,1), (6,4) (6,7) (7,4) (7,5).
We normally, label them according to the first number and then the second.
e1 = (1,3), e2 = (2,1), …
51
2.1 The Network Simplex Method
Iteration 1 We have given an initial feasible tree solution
with which we start our first iteration. Step 1. The initial FTS is xT = [ 3 0 0 0 2 3 0 0 5 0 ] and its cost is z = cx = 71. The arcs of a
spanning tree T (not unique since x is degenerate) with which x can be associated are (1, 3), (2, 1), (5, 2), (6, 1), (6, 7) and (7, 4).
52
2.1 The Network Simplex Method
For each arc in T ji,
ijij cyy or ijji cyy Start with
07 y
5507474 cyy
5506776 cyy
61156161 cyy
7161313 cyy
5162112 cyy
0555225 cyy
.
So, y = [ 6, 5, 7, 5, 0, -5, 0 ] .
53
2.1 The Network Simplex Method
Step 2. We test whether there is a profitable arc e with respect to x. In the present case we see that e = (5, 1) is the only profitable arc which comes into T(x) as an entering arc.
In the degenerate case, cycling might occur, but we can use the methods learned in Linear Programming to avoid cycling.
ji, jiijij yycc
05601155151 yycc
For each arc not in T, calculate
.
~ entering arc.
54
2.1 The Network Simplex Method
Step 3. The cycle C(e) is
in which (5, 2) and (2, 1) are both backward arcs with existing flow 2 and 0, respectively. We revise the flow in this cycle as t units along (5, 1), 2 - t units along (5, 2) and 0 - t units along (2, 1). Therefore t = 0. Since (5, 1) has just entered it does not make sense to take it as a leaving arc. Thus (2, 1) becomes the leaving arc. Since t = 0, the cost remains unchanged.
55
2.1 The Network Simplex Method
Iteration 2 Step 1. The current FTS is
xT = [ 3 0 0 0 2 3 0 0 5 0 ] with cost z = 71. The arcs of the
spanning tree are (1, 3), (5, 1), (5, 2), (6, 1), (6, 7) and (7, 4). From the defining equations,
y = [ 6 10 7 5 5 -5 0 ] Step 2. We see that e = (3, 2) is the
only profitable arc which enters T(x).
56
2.1 The Network Simplex Method
Step 3. The cycle C(e) is
We get t = 2 and (5, 2) leaves the tree.
57
2.1 The Network Simplex Method
Iteration 3 Step 1. Our FTS is now
xT = [ 5 0 2 2 0 3 0 0 5 0 ] and z = 67. The spanning tree has arcs (1, 3),
(3, 2), (5, 1), (6, 1), (6, 7) and (7, 4). Also y = [6 8 7 5 5 -5 0 ] Step 2. There are no profitable arcs for the
current FTS. At this stage the algorithm halts after reporting that the current FTS is an optimal solution.
58
Again to avoid having many different answer
If there are two profitable arc, add the arc having prior (smallest) label.
For example, if there are 3 profitable arc (2,3), (3,4) and (4,1), Then please add (2,3). Otherwise, I may mark your answer wrong.
59
2.2 Initialization As we have seen, the network simplex
method need to have a feasible tree solution (FTS) to start with.
How to obtain the initial FTS and the associated spanning tree?
Use artificial arcs.
60
2.2 Initialization
The way to obtain an initial spanning tree T
1. choose an arbitrary vertex v in the graph.(Always pick vertex 1 in exam)
2. for each source i, if there is an arc from i to v, then this arc (i, v) is an arc of T;
if there is no arc from i to v, construct an artificial arc (i, v) and take it as an arc of T;
61
2.2 Initialization 3. for each sink j, if there is an arc from v to j,
then this arc (v, j) is an arc of T; if there is no arc from v to j, construct an
artificial arc (v, j) and take it as an arc of T; 4. for each intermediate vertex k, if there is an
arc from v to k or from k to v, we take that arc as an arc of T;
if there is no such an arc, construct an artificial arc in either direction and take it as an arc of T.
This T must be a spanning tree.
62
2.2 Initialization Suppose there are r artificial arcs, we
denote the enlarged network by which has m + r arcs, but still n vertices.
Define a new cost vector by taking
G
1
0ijc
If (i, j) is an arc of the original network G
If (i, j) is an artificial arc
m rc R
63
2.2 Initialization
If the incidence matrix of is , we solve the problem:
min s.t.
Note that the vector .
G A
P xcbxA
0xrmRx
64
2.2 Initialization
Obviously, , for all sources i; , for all sinks j; , for other arcs in form a feasible tree solution (FTS)
corresponding to the tree T. Starting with this (initial) FTS, we use the
network simplex method to solve problem .
iiv bx
jvj bx 0ijx G
P
65
2.2 Initialization Suppose x* is an optimal FTS with an
associated spanning tree T*. There are three possibilities: Case 1 T* contains no artificial arc. In this case T* is a spanning tree of the
original network G and the components of x* that correspond to the artificial arcs must be zero. Thus the original transshipment problem is feasible. We delete all artificial arcs, replace cost vector by c and use T* as the initial tree to solve the original network problem.
c
66
2.2 Initialization
Case 2 T* has at least one artificial arc along which the flow is positive.
In this case, the optimal value of problem is positive which means that the original problem has no feasible solution.
P
67
2.2 Initialization Case 3 T* has at least one artificial arc, but
the flow in every artificial arc is zero. The original problem has a feasible solution
x obtained by the restriction of x* to the set of original arcs. After deleting the artificial arcs in T*, the remaining part of T* has less than n-1 arcs, which cannot form a spanning tree. So, it must consist of several disconnected components, which implies that the original problem can be decomposed into several smaller sub-problems which may be solved separately.
68
2.2 Initialization
Example 2.3
T675746453525231412 ,,,,,,,, xxxxxxxxxx
T7,11,0,0,8,4,6 b
69
2.2 Initialization Iteration 1. Introduce arcs a10 =(1,5) and a11 =(5,6). Initial spanning tree T(1):
S = 4
S = 6
S = 8
D = 7
D = 11
70
2.2 Initialization Let = [ 0 0 0 0 0 0 0 0 0 | 1 1 ] . Initial FTS x(1) = [ 0 0 0 4 8 0 0 7 0 | 6 11 ]T . , , , , , , . .
c
07 y
05775 cyy 15656 cyy
04554 cyy 03553 cyy
02552 cyy 11551 cyy
0,1,0,0,0,0,1)1( y
71
2.2 Initialization
For the arc (1, 2) not in T(1), . arc is profitable.
01010211212 yycc
2,11 a
1)1( aT )1(C contains cycle
.
72
2.2 Initialization
The only backward arc is which is the leaving arc. t = 6.
5,110 a
x(2) = [6 0 0 10 8 0 0 7 0 0 11 ]T
73
2.2 Initialization Iteration 2. y2 y7 don’t change, . So, y(2) = [ 0 0 0 0 0 1 0 ]. For arc , . is a profitable arc.
0001221 cyy
6,47 a01100644646 yycc
6,47 a
)2(C
5,46 a
Backward arcs in : (4, 5) and (5, 6)
is the leaving arc.
Since min {x45, x56} = min {0, 11} = 0,
74
2.2 Initialization
, but T(3) is different from T(2).)2()3( xx
75
2.2 Initialization
Iteration 3. don’t change, . So, y(3) = [ 0 0 0 1 0 1 0 ]. For arc , is a profitable arc.
123567 ,,,,, yyyyyy
1014664 cyy
4,12 a 01100411414 yycc
4,12 a
76
2.2 Initialization
Since min {x12, x25, x56} = min {6, 10, 11} = 6,
is the leaving arc. x(4) = [ 0 6 0 4 8 0 6 7 0 0 5 ]T.
2,11 a
77
2.2 Initialization
Iteration 4.y2 y7 don’t change, 1011441 cyy
.
So, y(4) = [ 1 0 0 1 0 1 0 ].
10 2112 yyc
00 3223 yyc
20 5115 yyc
10 7667 yyc
10 5445 yyc
For the 5 arcs not in T(4),So, there are no profitable arcs, and x(4) is the optimal solution of problem . PBut the flow on the artificial arc (5, 6) is positive, which means the original problem is infeasible.
78
2.2 Initialization
Integer Solutions If all supplies / demands are integer
values, i.e. b is an integer vector, then the optimal solution x* of the transshipment problem, obtained by the network simplex method, must be an integer vector.
Why? because the incidence matrix A is unimodular.
79
2.2 Initialization Let be the matrix obtained by deleting the first
row of A; and be the vector obtained by deleting the first component of b.
Then the equation is equivalent to (since rank(A) = n-1). Any feasible tree solution x corresponds to a non-singular submatrix B of such that , where and .
So, each component of has the form , where p is an integer. Since A is unimodular, as a
nonsingular square submatrix of A, B must satisfy . So, must be an integer.
A mn 1
11 n
bAx bxA
b
)1(1 nn A TN
TB
T xxx ,0Nx bBxB
ix BxB
pxi det
1det B
ix
80
2.2 Initialization Unbalanced Transshipment Problem So far we consider balanced transshipment
problem, i.e. total supply = total demand. Now if total supply > total demand we let r = total supply - total demand and introduce one dummy sink v with the
demand r and an arc from each source vertex to v with zero cost.
Hence the unbalanced problem becomes a balanced problem in the enlarged network.
is
81
2.2 Initialization
Note that if in the optimal solution, the supply of the source i is and the flow from i to the dummy vertex v is , then the source i sends out only units of the commodity and remains units at its place.
ib
0ivx
ivi xb
ivx
82
2.4 Transportation Problems
Motivating Example: A number of warehouses must ship a
single commodity to a number of manufacturing plants.
Shipping costs are proportional to distance and the amount shipped.
What shipping pattern will minimize total shipment costs?
83
2.4 Transportation Problems
84
2.4 Transportation Problems A transportation problem is a special
transshipment problem in which (1) there is no intermediate vertices (i.e.
every vertex is either a source, or a sink).
(2) every arc is from a source to a sink. The underlying graph of a transportation
problem is a bipartite graph.
85
2.4 Transportation Problems G = (S, D, E). S ~ the set of sources, denoted by (i
= 1, … , m); D ~ the set of sinks, denoted by (j =
1, …, n); E ~ the set of arcs from a source
to a sink . Flow matrix: matrix ~ is the
flow on the arc ;
iS
jD
ji, iSjD
nm ijx ijx ji,
86
2.4 Transportation Problems
Cost matrix: matrix ~ is the cost to send one unit of the commodity from
to . Note that if actually there is no arc from
to , in order to express the problem easily, we assume that there is an arc , but the cost is very expensive, i.e. let , where M is a very large number.
nm ijc ijc
iS jD
iSjD
ji,
Mcij
87
2.4 Transportation Problems Now the transportation problem can be
expressed mathematically as min
s.t. , for i = 1, … , m (1)
, for j = 1, … , n (2)
for i = 1, … , m; j = 1, … , n (3)
m
i
n
jijij xc
1 1
n
jiij bx
1
m
ijij bx
1
0ijx
88
2.4 Transportation Problems
The constraint equations (1) and (2) can be jointly expressed as:
A x = b,where A is an (m+n) x mn matrix, which is in fact the
incidence matrix of the associated bipartite graph (hence is a unimodular one according to Corollary 1.3b);
b is an m+n vector by combining the right-hand-side of the equations (1) and (2); and
x is an m∙n vector consists of all . ijx
89
2.4 Transportation Problems Transportation problem can be solved
on a particularly designed tableau, called the transportation tableau.
90
2.4 Transportation Problems Finding an initial FTS ~ the
northwest corner method.
91
2.4 Transportation Problems
Note that the m+n-1 = 6 filled entries, together with other , form an initial FTS.
The arcs corresponding to the filled entries form a spanning tree T.
ijx
0ijx
ijx
92
2.4 Transportation Problems Calculating dual solution y
associated with the tree T We use the equation for any arc
to determine y. In the above example, let .
We fill in y1 ~ y3 to the right-most column and y4 ~ y7 to the bottom row.
jiji ycy Tji ,
07 y
88037373 yycy
19866363 yycy
67126262 yycy
...5 y
...1 y
...4 y
93
2.4 Transportation Problems Checking if there is a profitable arc For each arc , calculate and
check if all such . If yes, an optimal solution is obtained. But is profitable.
Tji , jiijij yycd 0ijd
6,106183611616 yycd
94
2.4 Transportation Problems Deciding the leaving arc Starting from the cell (1, 6) in the
tableau, move horizontally or vertically until return to the cell (1, 6) to form a cycle. 6,15,15,26,26,1
It is seen that in the cycle
15261
the arcs are forward and backward alternatively.
95
2.4 Transportation Problems
Put a + in the tableau for every forward arc;
Put a - in the tableau for every backward arc;
Decide t = min { | is a backward arc}.
ijx ji,
96
2.4 Transportation Problems Moving from a non-optimal
tableau to the next tableau
Let If (i, j) is a forward arc; If (i, j) is a backward arc;
Other arcs
ij
ij
ij
ij
x
tx
tx
xnew
97
2.4 Transportation Problems Introduce the entering (profitable) arc into the
new tree; remove the leaving arc from the tree. Note that in the example the two backward arcs (1, 5) and (2, 6) both have .
In this case, we can choose either one as a leaving arc (in the example (2,6) is chosen to leave the tree), but not both, because to maintain a spanning tree need to have m+n-1 = 6 arcs.
So far we completed one iteration and switch to a new tableau.
102615 txx
98
2.4 Transportation Problems Example 2.7 If an FTS is given by the
circled numbers in the tableau below, and suppose the entering cell is (3, 7), how to form a cycle in the tableau?
99
2.4 Transportation Problems Note that when we are at (1, 8) and move
horizontally, we have to skip the cell (1, 6) and reach (1, 4). Then we move vertically. If we change the moving direction at (1, 6), no cycle can be formed.
100
2.5 Some Applications to
Combinatorics Definition A matching in a graph is a
set M of edges of the graph such that no two edges in M have a vertex in common.
graph G a matching of G
101
2.5 Some Applications to Combinatorics
In a bipartite graph G = (X, Y, E) where X and Y both have n vertices (it is possible that between some pair of vertices and , there exists no edges, i.e., G may not be a complete bipartite graph), a matching M is called a perfect matching if there are n edges in M.
Xx Yy
102
2.5 Some Applications to Combinatorics
This bipartite graph has no perfect matching
This graph has a perfect matching
132231 ,,,,, vuvuvuM
103
2.5 Some Applications to Combinatorics
Theorem 2.5 (Konig’s marriage theorem) A regular bipartite graph G(U, V, E) of
degree k (where k is a positive integer) with has a perfect matching.
A graph is called a regular graph of degree k if the degree of each vertex is k.
2-regular graph
nVU
104
2.5 Some Applications to Combinatorics
Proof We formulate a transportation problem as follows:
Let the vertices in U be sources; the vertices in V be sinks; For each edge , give an arc from to . Let the supply at each source be 1; the demand at each sink be 1; the unit cost on each arc (u, v) be 1.
Uu Vv
uvc
Evu },{
105
2.5 Some Applications to Combinatorics
This problem is feasible because if we let the flow along each arc be , it is a feasible flow.
Also, the supply-demand vector is an integer vector as the incident matrix of a bipartite graph is unimodular. Therefore, the transportation problem must have an integer optimal solution x*.
In fact as all supplies / demands are 1, x* must be a 0-1 vector.
Let M = { (u, v) | , u, v = 1, … , n }. It is easy to see that |M|=n, i.e., M must be a
perfect matching.
k1
1* uvx
106
2.5 Some Applications to Combinatorics
Example Does the following bipartite graph have a perfect matching? If yes, give a perfect matching. As this is a regular
graph of degree 2, it has a perfect matching.
Find a perfect matching by yourself.
107
2.5 Some Applications to Combinatorics
Definition A covering in a graph is a set W of vertices such that every edge of the graph is incident to at least one of the vertices in W.
v6, v1, v3, v4 (or v5) is a covering of the left graph
108
2.5 Some Applications to Combinatorics
For any matching M and any covering C of a graph, suppose
the graph has k edges , ,… , , such that all and are
different to cover these k edges, we need to
use at least k vertices from a covering C must have at least k vertices
kM
111 ,vue 222 ,vue
kkk vue , iu iv
,...,,,..., 11 kk vvuu
kC
109
Therefore, for any matching M and any covering C
This result can be strengthened to become an equality if bipartite graphs are concerned. (Just like Primal and Dual)
2.5 Some Applications to Combinatorics
CM
} allfor : |min{|
} allfor : |max{|
CC
MM
110
2.5 Some Applications to Combinatorics
Theorem 2.8 (Konig’s Theorem) In any bipartite graph, the size of a
maximum matching equals to the size of a minimum covering.
111
2.5 Some Applications to Combinatorics
Konig’s Theorem can be translated equivalently to the context of matrices. We use the term a line to denote either a row, or a column.
Suppose P is a property that an element of a matrix may or may not have. We call an element of a matrix a P-element if it has the property.
A set of P-elements is said to be P-independent if no two of them lie on the same line.
The size of the largest P-independent set is called the P-rank of the matrix.
112
2.5 Some Applications to Combinatorics
Example 2.10 Let matrix
An element of A is said to have property P if it is positive, i.e., if its value is 1.
Obviously, the P-rank of A is 3 as a largest P-independent set contains 3 elements, for example, the (1, 1)th, (2, 3)th and (5, 4)th element of A.
1100
0100
0100
0100
0111
A
113
2.5 Some Applications to Combinatorics
Theorem 2.9 (Konig-Egervary Theorem)
The P-rank of a matrix A is equal to the minimum number of lines that contain all P-elements of the matrix.
114
2.5 Some Applications to Combinatorics
Proof We construct a bipartite graph. Let each row i of A correspond to a left vertex i; each column j of A correspond to a right vertex j. Introduce edge if and only if the element of A is a P-element.
ji, th, ji
1100
0100
0100
0100
0111
A
115
2.5 Some Applications to Combinatorics
By Theorem 2.8, Size of a max. matching = Size of a min.
covering. Now, a matching is a set of edges, all with
different (left and right) endpoints. (correspond to) a set of P-elements in different
rows/columns, i.e. a P-independent set. So, Size of a max. matching = Size of the largest P-
independent set = P-rank of A.
116
2.5 Some Applications to Combinatorics
A covering is a set of vertices such that every edge of the graph is incident to at least one of these vertices.
(correspond to) a set of rows and columns such that each P-element is contained in one of these lines.
So, Size of a min. covering = minimum number
lines of A that contain all P-elements of the matrix.
Thus, the theorem is proved.
117
2.6 Assignment Problem The assignment problem is a
special kind of transportation problem in which
(1) the supply at each source and the demand at each sink are equal to 1.
(2) the number of sources = the number of sinks.
118
2.6 Assignment Problem Let be the cost to send one unit of
product (or sevice) from source i to sink j.
The mathematical formulation of the assignment problem is
min s.t. , , ,
ijc
n
jiijij xc
1,
n
jijx
1
1 ni ,...,1
n
iijx
1
1 nj ,...,1
0ijx nji ,...,1,
119
2.6 Assignment Problem
Note that actually we are interested in integer solutions, i.e. should be 0 or 1, but this request does not need to be imposed explicitly, because the unimodular property for bipartite graph guarantees an integer optimal solution.
ijx
120
2.6 Assignment Problem Example A mill has
4 machines and 4 jobs to be completed. Each machine must be assigned to complete one job. The times required to complete each job on different machines are shown in the table:
Time (hours) Job 1 Job 2 Job 3 Job 4
Machine 1 14 5 8 7
Machine 2 2 12 6 5
Machine 3 7 8 3 9
Machine 4 2 4 6 10
Decide an assignment scheme to minimize the total time needed to complete the 4 jobs.
121
2.6 Assignment Problem
Method 1 use the method for transportation problems.
Method 2 the Hungarian method.
Theorem 2.17 Suppose C is the cost matrix and is the
matrix obtained by adding a number t to each element in a row or to each element in a column. Then a solution is optimal with respect to if and only if it is optimal with respect to C.
C'
C'
122
2.6 Assignment Problem Proof Suppose the row is added by
t, i.e. , and , for and
Then for any feasible solution , = =
= = Therefore, under C and C’ , the
optimal solutions are the same.
thktcc kjkj nj ,...,1 ijij cc ki
nj ,...,1
[ ]ijx
n
i
n
jijij xc
1 1
ki
n
j
n
jkjkjijij xcxc
1 1
ki
n
j
n
jkjkjijij xtcxc
1 1
n
i
n
j
n
jkjijij xtxc
1 1 1
n
i
n
jijij txc
1 1
123
2.6 Assignment Problem
Based on this theorem, we can change C to C’ such that each row and each column of C’ has at least one zero entry by the following operations:
Step 1 Subtract each row by its smallest entry; Subtract each column by its smallest
entry.
124
2.6 Assignment Problem2 examples
00234
03214
00320
32004
31203
)3(
)1(
)1(
)2(
)1(
33567
14325
11431
54226
42314
AA
32022
20005
24003
46035
07040
43043
31026
35024
57056
18061
)7(
)3(
)3(
)3(
)3(
111071110
64359
68357
810389
411394
BB
(-1) (-2) (-1) (-1)
125
If in such modified matrix C’ , there are n zero entries and not two of them in the same row or same column, for example
then obviously , other is an optimal solution, because for
any feasible solution x,
0
0
0
0
y y y
y y yc
y y y
y y y
2.6 Assignment Problem
(all y are non-negative numbers)
1*44
*32
*21
*13 xxxx 0* ijx
4,3,2,1, ji
0* xc
126
2.6 Assignment Problem
Question: How to check if C’ has zero entries at all different rows and columns?
This is in the method of step 2. Step 2 Check whether C’ has n zero entries
at different rows and columns. If the answer is yes, then an optimal assignment is obtained by taking the assignment corresponding to the n zero entries and we stop.
Otherwise we go to Step 3.
0, ' 0 , ' ijijijij xcxc but 0. ' * ijij xc
127
2.6 Assignment Problem This step can be fulfilled by the following
sub-steps. Step 2a Locate a row or a column in C’
with exactly one 0, and the 0 is selected. If every line (row or column) has more
than one zero, a line with the minimum number of 0s is located, and we select anyone of the 0s in this line. This line should not be located again (we can put a check mark beside it)
128
2.6 Assignment Problem
Put a circle around the selected 0, and draw a line through (covering) the 0. This line should be
a vertical line if the line located is a row, and
a horizontal line if the line located is a column.
129
2.6 Assignment Problem
Step 2b Repeat the previous step (but do not consider any 0 which has been covered by a line) till every 0 has at least one line through it.
Step 2c If the number of lines drawn is n, the n selected (circled) 0s will point out an optimal solution. If the number of lines is less than n, we go to Step 3.
130
2.6 Assignment Problem Examples
A
00234
03213
00320
32004
31203
00234
03213
00320
32004
31203
00234
03213
00320
32004
31203
00234
03213
00320
32004
31203
00234
03213
00320
32004
31203
00234
03213
00320
32004
31203
1*31
*54
*45
*23
*12 xxxxx 0* ijx 5,...1, ji
n = 5 (lines), we obtain an optimal solution which is
and other
131
2.6 Assignment Problem
B
32022
20005
24003
46035
07040
32022
20005
24003
46035
07040
32022
20005
24003
46035
07040
32022
20005
24003
46035
07040
32022
20005
24003
46035
07040
n = 4 < 5, so, we are unable to obtain an optimal assignment by using the modified matrix .
B
132
2.6 Assignment Problem
Generally, if the number of lines needed to cover the zeros is k and k<n, we call the 0 element in the matrix as P-element and by Th. 2.9, we know that the P-rank of the matrix is k, i.e., the maximal number of 0 elements in different rows and columns is k.
In this case, we need to modify the matrix further to create more 0s in the right place.
Let m be the smallest value of the uncovered elements.
We subtract m from all uncovered rows ~ so that more 0s appear in the previously uncovered part.
c
133
2.6 Assignment Problem Example m = 2
10200
20005
02221
24213
07040
)2(
)2(
)2(
32022
20005
24003
46035
07040
B
However, now in the covered column, some 0 become –m which are negative.We now add m to the covered columns.
B
10020
20225
02001
24033
07260 (+2) (+2)
134
2.6 Assignment Problem
The above operations can be further simplified. We divide all elements in the matrix obtained at Step 2 into 3 groups.
(1) Uncovered elements. (2) Singly covered elements ~ covered
by only one line (a row or a column) (3) Doubly covered elements ~ covered
by two lines: a row and a column.
135
2.6 Assignment Problem
Step 3a Find the value of the smallest uncovered element. Suppose it is m. We
(a) subtract m from all uncovered elements;
(b) add m to all doubly covered elements. (and keep the singly covered elements
unchanged)
136
2.6 Assignment Problem
For example, if we apply the operations (a) and (b) to :B
10020
20225
02001
24033
07260
32022
20005
24003
46035
07040
B
which is just B
.
137
2.6 Assignment Problem
Note that the 0s to be selected to draw the lines (i.e. the 0s with ) are singly covered, hence they are still 0.
But some elements in the uncovered part become 0 ~ new 0, and thus need to use more lines to cover all 0.
138
2.6 Assignment Problem
Step 3b Delete all covering lines and go back to Step 2.
10020
20225
02001
24033
07260
10020
20225
02001
24033
07260
B
139
2.6 Assignment Problem
Now the number of lines to cover all 0s = 5 = n.
So, we obtain an optimal assignment:
and other , i.e. source 1 sink 5, source 2 sink 3, source 3 sink 2, source 4 sink 4, source 5 sink 1.
1*51
*44
*32
*23
*15 xxxxx 0* ijx