Transportation Problem Alireza Ghaffari-Hadigheh Azarbaijan Shahid Madani University (ASMU) hadigheha@azaruniv.edu Spring 2017 Alireza Ghaffari-Hadigheh (ASMU) Transportation Problem Spring 2017 1 / 34
Overview 1 Transportation problem A brief definition Properties of the coefficient matrix Nonbasic vector in terms of the basic vectors The simplex method for transportation problem 2 Degeneracy in the transportation problem Necessary Condition 3 The Simplex Tableau Associated with a Transportation Tableau Alireza Ghaffari-Hadigheh (ASMU) Transportation Problem Spring 2017 2 / 34
Assumptions Transportation problem A brief definition m origin points located on a map, where origin i has a supply of a i units of a particular item. n destination points, where destination j requires b j units of the commodity. unit cost c ij for transportation from origin i to destination j. Determine the feasible shipping solution from origins to destinations that minimizes the total transportation cost. Alireza Ghaffari-Hadigheh (ASMU) Transportation Problem Spring 2017 3 / 34
A brief definition Mathematical Formulation x = (x 11, x 12,..., x 1n, x 21,..., x 2n,..., x mn ) T c = (c 11, c 12,..., c 1n, c 21,..., c 2n,..., c mn ) T b = (a 1, a 2,..., a m, b 1, b 2,..., b n ) T A = (a 11, a 12,..., a 1n, a 21,..., a 2n,..., a mn ) a ij = e i + e m+j Linear optimization model min c T x Ax = b x 0 1 is an n row vector of all 1 s I is an n n identity matrix Alireza Ghaffari-Hadigheh (ASMU) Transportation Problem Spring 2017 4 / 34
Example Transportation problem A brief definition 2 Origins, 3 Destinations. c 11 = 4 c 12 = 7 c 13 = 5 c 21 = 2 c 22 = 4 c 23 = 3 1 1 1 0 0 0 0 0 0 1 1 1 A = 1 0 0 1 0 0 0 1 0 0 1 0 0 0 1 0 0 1 Alireza Ghaffari-Hadigheh (ASMU) Transportation Problem Spring 2017 5 / 34
Feasibility of the problem A brief definition d = m a i = i=1 n j=1 b j x ij = a i b j d, i = 1,..., m, j = 1,..., n. 0 x ij min{a i, b j } A bounded feasible linear optimization problem has optimal solution. Alireza Ghaffari-Hadigheh (ASMU) Transportation Problem Spring 2017 6 / 34
Rank of the matrix A Transportation problem Properties of the coefficient matrix If m, n 2 then m + n mn, thus rank A m + n. rank A m + n, since the sum of first m rows equals the sum of last n rows. Fact: Rank A = m + n 1 We need only to find an (m + n 1) (m + n 1) nonsingular submatrix from A. Delate the last row: A = (a 1n, a 2n,..., a mn, a 11, a 21,..., a m,n 1 ) 1 1 1 0 0 0 [ ] Im Q 0 0 0 1 1 1 1 0 1 1 0 1 0 0 A = 0 I n 1 Rank A = m + n 1. A = 1 0 0 1 0 0 0 1 0 0 1 0 A = 0 0 1 0 0 1 0 0 1 0 0 0 0 1 Alireza Ghaffari-Hadigheh (ASMU) Transportation Problem Spring 2017 7 / 34
Properties of the coefficient matrix Totally Unimodularity Definition A matrix is totally unimodular if the determinant of its every square submatrix is 1, 0 or +1. Claim In the transportation problem, the matrix A is totally unimodular. Since all entries of A are 0 or 1, every 1 1 submatrix has determinant of value 0 or 1. Any (m + n) (m + n) submatrix has determinant of value 0 since rank(a) = m + n 1. Suppose the property is true for A k 1, then Each column of A k has either no 1 s, a single 1, or two 1 s. If any column of A k has no 1 s, then det A k = 0. If every column of A k has two 1 s, then one of the i s is in an origin row and the other is in a destination row. In this case the sum of the origin rows of A k equals the sum of the destination rows of A k.det A k = 0. If some column of A k contains a single 1, expanding det A k by the minors of that column we get det A k = ± det A k 1. Alireza Ghaffari-Hadigheh (ASMU) Transportation Problem Spring 2017 8 / 34
Triangularity of the Basis Matrix Properties of the coefficient matrix Claim Any basic submatrix is upper triangular. We had a particular (m + n 1) (m + n 1) submatrix that was nonsingular, therefore was a basis for A (ignoring the last row). This Matrix is upper triangular. Suppose that B is a basis matrix from A. There must be at least one column of B containing a single 1; otherwise, det B = 0. Permuting the rows and columns of B, we obtain [ ] 1 q 0 B m+n 2 B m+n 2 must contain at least one column with a single 1. (why?) 1 q q 0 1 p 0 0 B m+n 3 Alireza Ghaffari-Hadigheh (ASMU) Transportation Problem Spring 2017 9 / 34
Properties of the coefficient matrix Finding basic solution Use backward substitution. The basis consisting of x 13, x 23, x 11, and x 12, we append the last row and artificial column. x 12 = 10 x 11 = 15 x 23 = 20 x 13 = 30 x 11 x 12 = 5 x a = 25 x 13 = x 23 = 0 Alireza Ghaffari-Hadigheh (ASMU) Transportation Problem Spring 2017 10 / 34
Integrality of the basic solution Properties of the coefficient matrix Main result Since each basis consists entirely of integer entries and is triangular with all diagonal elements equal to 1, we conclude that the values of all basic variables will be integral if the supplies and demands are integers. In particular, we may conclude that the optimal basic feasible solution will be all integer. Alireza Ghaffari-Hadigheh (ASMU) Transportation Problem Spring 2017 11 / 34
Simplex Method, Reminder Properties of the coefficient matrix Simplex for minimization problem Alireza Ghaffari-Hadigheh (ASMU) Transportation Problem Spring 2017 12 / 34
Properties of the coefficient matrix On the typical updated simplex column The elements of B 1 are all ±1 or 0 (why?). For the optimality we need to solve By ij = a ij. Utilizing Cramer s rule, the kth unknown element of y ij is y ijk = det B k det B. y ijk = ±1 or 0. Typical updated simplex column y ij consists of ±1 s and 0 s. Any vector a ij can be obtained by the simple addition and subtraction of basic vectors. Alireza Ghaffari-Hadigheh (ASMU) Transportation Problem Spring 2017 13 / 34
Properties of the coefficient matrix Representation of a nonbasic vector in terms of basic vectors a ij = e i + e m+j a ij = a ik a lk + a ls a us + a uj = (e i + e m+k ) (e l + e m+k ) + (e l + e m+s ) (e u + e m+s ) + (e u + e m+j ) = e i + e m+j Alireza Ghaffari-Hadigheh (ASMU) Transportation Problem Spring 2017 14 / 34
Properties of the coefficient matrix Basic vectors cannot form a cycle on the transportation tableau. By contradiction let cells (p, q), (r, q), (r, s), (u, s), (u, v), and (p, v) which form a cycle be basic. Consider the following linear combination a pq a rq + a rs a us + a uv a pv = 0 Thus, they are not independent and so can t be basic. Alireza Ghaffari-Hadigheh (ASMU) Transportation Problem Spring 2017 15 / 34
Properties of the coefficient matrix It has no cycle. (Tree of Forest) Spanning (All columns and rows) A spanning Tree (Chain) Alireza Ghaffari-Hadigheh (ASMU) Transportation Problem Spring 2017 16 / 34
Properties of the coefficient matrix Is this possible? Consider the two basic cells (i, j) and (k, l) If cell (k, j)is basic, then cells (, ij) and (k, l) are connected via the basic chain {(i, j), (k, j), (k, l)}. If the cell (k, j) is not basic, then a kj = a rj a rs + a ts + + a vu a vw + a kw The two basic cells (i, j) and (k, l) are connected by the basic chain {(i, j), (r, j), (r, s), (t, s),..., (v, u), (u, w), (k, w), (k, l)}. The basic cells are connected. Alireza Ghaffari-Hadigheh (ASMU) Transportation Problem Spring 2017 17 / 34
Properties of the coefficient matrix Inverse A spanning tree with m + n 1 points together with an artificial vector is a basis. Proof sketch The matrix of vectors associated with a spanning tree has an (m + n 1) (m + n 1) (upper) triangular submatrix with 1 s on the diagonal. Hints! A tree always has at least one end. An end of the tree, it must either be the only point in the particular row or column. Assumption: The end is the only point in its particular row. Say (i, j). Alireza Ghaffari-Hadigheh (ASMU) Transportation Problem Spring 2017 18 / 34
Properties of the coefficient matrix Proof steps T = [ ] T1 q 0 1 a ij = e i + e m+j is the only tree vector with a nonzero entry in row i. Perform row and column permutation on the (m + n) (m + n 1) matrix T T 1 is the matrix associated with the tree vectors when row i and vector a ij are deleted. The endpoint and line joining it are deleted to obtain a new connected tree. Alireza Ghaffari-Hadigheh (ASMU) Transportation Problem Spring 2017 19 / 34
Continued... Transportation problem Properties of the coefficient matrix T 2 p q 2 T = 0 1 q 1 0 0 1 Consider the end of cell (k, l). The only end point in column l a kl = e k + e m+l is the only vector with a nonzero entry in row m + 1. Continue this procedure. The proof is complete. Alireza Ghaffari-Hadigheh (ASMU) Transportation Problem Spring 2017 20 / 34
Properties of the coefficient matrix Representation of the Basis on the Transportation Graph Each tree on the transportation tableau corresponds uniquely to a tree on the transportation graph Each basic cell (i, j) corresponds to the basic link (i, j). Each line connecting two basic cells in the transportation tableau corresponds to the node The artificial vector e m+n is a link leaving destination n and ending nowhere. Alireza Ghaffari-Hadigheh (ASMU) Transportation Problem Spring 2017 21 / 34
Nonbasic vector in terms of the basic vectors Locate the unique cycle, in the basis graph, containing the arc associated with the particular nonbasic cell. All of the basic cells of the transportation matrix associated with the arcs of the cycle in the graph are required for the representation of the nonbasic cell. Not all basic cells in the unique cycle are used. The unique cycle of the graph is given by (1, 4), (3, 4), (3, 1), (1, 1). The chain of basic cells (3, 4), (3, 1), (1, 1). Assign alternating signs of +1 and 1, a 14 = a 11 a 31 + a 34. e 1 + e 4+4 = (e 1, +e 4+1 ) (e 3 + e 4+1 ) + (e 3 + e 4+4 ) Alireza Ghaffari-Hadigheh (ASMU) Transportation Problem Spring 2017 22 / 34
Simplex steps Transportation problem The simplex method for transportation problem 1 Find a starting basic feasible solution. 2 Compute z j c j for each nonbasic variable. Stop or select the entry column. 3 Determine the exit column. 4 Obtain the new basic feasible solution and repeat Step 2. Alireza Ghaffari-Hadigheh (ASMU) Transportation Problem Spring 2017 23 / 34
The simplex method for transportation problem Finding a Starting Basic Feasible Solution Northwest corner rule As a variable x ij is assigned a value, the corresponding a i, and b j are reduced by that value. Start with, a i = ã i and and b j = b j. x 11 = min{ã 1, b 1 } Replace ã 1 by ã 1 x 11 and b 1 by b 1 x 11 If ã 1 < b 1, move to cell (1, 2); let X 21 = min{ã 2, b 1 }. and replace ã 2 by ã 2 x 21 and b 1 by b 1 x 21 If ã 1 = b 1, Degeneracy!! If ã 1 > b 1, move to cell (2, 1); let X 12 = min{ã 1, b 2 }. and replace ã 1 by ã 1 x 12 and b 2 by b 2 x 12 Continue. Alireza Ghaffari-Hadigheh (ASMU) Transportation Problem Spring 2017 24 / 34
Starting Basic solution, an example The simplex method for transportation problem Alireza Ghaffari-Hadigheh (ASMU) Transportation Problem Spring 2017 25 / 34
The simplex method for transportation problem Alireza Ghaffari-Hadigheh (ASMU) Transportation Problem Spring 2017 26 / 34
The simplex method for transportation problem Computing z ij c ij for Each Nonbasic Cell z ij c ij = c B y ij c ij Since y ij consists of 1 s, 1 s, and 0 s, then c B y ij is calculated by simply adding and subtracting the costs of some basic variables. z ij c ij = (c uj c us + c ls c lk + c ik ) c ij Optimality criterion is z ij c ij 0 for each nonbasic x ij. z 21 c 21 = 4 5 + 3 2 = 0 z 22 c 22 = 7 5 + 3 4 = 1 x 22 is a candidate to enter the basis. Alireza Ghaffari-Hadigheh (ASMU) Transportation Problem Spring 2017 27 / 34
The simplex method for transportation problem Alternative method for optimality controlling z ij c ij = c B B 1 a ij c ij = wa ij c ij. w i = u i, i = 1,... m and w m+j = v j, j = 1,... n. w = (u 1, u 2,..., u m, v 1, v 2,..., v n ) wa ij = u i + v j thus z ij c ij = u i + v j c ij. w = c B B 1 is the dual solution, for basic columns u i + v j = c ij. (u 1, u 2,..., u m, v 1, v 2,..., v n )(a pq,..., a st, e m+n ) = (c pq,..., c st, 0) System of equations: u p + v q = c pq. u s + v t = c st v n = 0 Compute the z ij c ij = u i + v j c ij for each nonbasic cell in order to determine the entering column. Alireza Ghaffari-Hadigheh (ASMU) Transportation Problem Spring 2017 28 / 34
The simplex method for transportation problem Determination of the Exit Column Let (k, l) be selected to enter the basis. If the entry, in column y kl, corresponding to a basic variable is 1, then the basic variable will increase at the same rate as the nonbasic variable x kl increases. Let ˆx ij be the value of x ij in the current solution and let be the amount by which the nonbasic variable, x kl, increases. Each component of y kl is either 1, 1, or 0. = min{ˆx ij : basic cell (i, j) has a + 1 in the representation of the nonbasic cell (k, l)}. Alireza Ghaffari-Hadigheh (ASMU) Transportation Problem Spring 2017 29 / 34
The simplex method for transportation problem Illustrative step = min{x 12, x 23 } = min{10, 20} = 10 New solution: x 12 = ˆx 12 = 10 10 = 0(leaves the basis) x 13 = ˆx 13 + = 5 + 10 = 15 x 23 = ˆx 23 = 20 10 = 10 x 12 = = 10 x 11 = 15(unchanged) Alireza Ghaffari-Hadigheh (ASMU) Transportation Problem Spring 2017 30 / 34
Degeneracy in the transportation problem Finding and Maintaining a Basis in the Presence of Degeneracy The reduced supply is equal to the reduced demand. x kl = min{â k, ˆb l } = a k = b l, Whichever way we go with the northwest corner rule, the next basic variable will be zero and degeneracy occurs. Proceed in either direction, that is, to (k, l + 1) or (k + 1, l), and assign either x k,l+1 or x k+1,l as a basic variable at zero level. Alireza Ghaffari-Hadigheh (ASMU) Transportation Problem Spring 2017 31 / 34
Degeneracy in the transportation problem Continued x 31 = min{ˆx 11, ˆx 22, ˆx 34 } = min{10, 0, 40} = 0 x 11 = 10 0 = 10 x 21 = 10 + 0 = 10 x 22 = 0 0 = 0(leaves the basis) x 24 = 10 + 0 = 10 x 34 = 40 0 = 40 Alireza Ghaffari-Hadigheh (ASMU) Transportation Problem Spring 2017 32 / 34
Degeneracy in the transportation problem Necessary Condition A Necessary Condition for Degeneracy in the Transportation Problem A proper subset of the rows and columns have the total supply equal to the total demand. x ij = a i, C 1 C 1 C 1 x ij = C 1 b j, = C 1 a i = C 1 b j. Alireza Ghaffari-Hadigheh (ASMU) Transportation Problem Spring 2017 33 / 34
The Simplex Tableau Associated with a Transportation Tableau The Simplex Tableau Associated with a Transportation Tableau z x 11 x 12 x 13 x 21 x 22 x 23 x a RHS z 1 0 0-10 2 0 0 0 375 x 11 0 1 0 0 1 0 0 0 15 x 12 0 0 0 1-1 0 0 0 5 x 22 0 0 0-1 1 1 0 0 10 x 23 0 0 0 1 0 0 1 0 10 x a 0 0 0 0 0 0 0 1 0 Alireza Ghaffari-Hadigheh (ASMU) Transportation Problem Spring 2017 34 / 34