|
|
How to Solve Linear Problems? (specially with Matrix) Solve an example problem. Consider the following linear programming problem:
This problem is solved on the graphical solution web page. The primal optimal program is x = (x1, x2) = (63.333, 21.667) yielding a value for the objective function P = 1166.67. The dual optimal program is y = (y1, y2, y3) = (0, 6.67, 6.67), with an optimal value for the objective function D = 1166.67. The Simplex L.P. Standard Form. The above example can be stated as a particular set of data of the general canonical form.
The standard forms for the primal and dual problems can be stated with the slack variables s and t:
This example l.p. problem has the nice feature that all constraints are <= constraints, and the vector of RHS coefficients b >= 0. The Basic Simplex Algorithm. The first version of the simplex algorithm exploits the special structure of the example l.p. problem. The standard form for the initial simplex tableau in the basic simplex algorithm is:
Label rows & columns. Use the data from the example to fill in the initial tableau. Add two new columns: the column of row sums used to check arithmetic, and the column labelled b0 / x01 whose values are determined in step A. 2. below. (If you perform the simplex row operations on the column of row sums, and then check that each entry equals the sum of that row, you have a check on your arithmetic as you proceed with hand calculations.)
Tableau0 solution: Variables s1, s2, s3 are the basic variables, since their columns are e1T = (1, 0, 0, 0), e2T = (0, 1, 0, 0), and e3T = (0, 0, 1, 0). The primal program is sT = (65, 90, 85), with xT = (0.00, 0.00). The primal objective function has the value P = cTx = c1x1 + c2x2 = 0.00. The infeasible dual program (found in the bottom row) is tT = (-15, -10), and yT = (0.00, 0.00, 0.00). Proceed to the next tableau as follows:
A. In Tableau0: Notes:
Tableau1 solution: Variables x1, s1, s3 are basic variables. The primal program is sT = (47, 0, 13), with xT = (72., 0.00). The primal objective function has the value P = cTx c1x1 + c2x2 = 15*72 + 4*0 = 1080.00. The infeasible dual program (found in the bottom row) is tT = (0, -4), and yT = (0.00, 12.00, 0.00). Proceed to the next tableau as follows:
A. In Tableau1:
Tableau2 solution: Variables x1, x2, s1 are basic variables. The feasible primal program is sT = (27.5, 0, 0), with xT = (63.333, 21.667). The primal objective function has the value P = cTx cTx = c1x1 + c2x2 = 15*63.333 + 4*21.667 = 1111.67. The feasible dual program (found in the bottom row) is tT = (0, 0), and yT = (0.00, 6.667, 6.667). Since these feasible programs satisfy the complementary slackness conditions:
tTx = t1x1 + t2x2= 0 they are optimal programs. Notes: 1.0 In the Final Tableau, all the coefficients in the last row corresponding to the primal variables, x1 and x2, and the slack variables are nonnegative. Therefore, the simplex algorithm terminates displaying the optimal primal and dual programs along with the optimal value of the objective function. 2.0 Each Tableau contains the unit vectors e1, e2, e3, and e4 among its columns. 3.0 A given Tableauk has the form:
4.0 The row operations performed on the matrix of each tableau are equivalent to premultiplying the tableau's matrix by some nonsingular matrix. Therefore, a nonsingular matrix B exists such that: Tableau2 = B Tableau0 Validity of the Simplex Algorithm. In block matrix form, the last equation is:
where B is a 4 by 4 (in the example above) nonsingular matrix, i.e. B has an inverse. The last 2 by 2 block of matrices in this equation implies:
Substituting for B in the first matrix equation, the first 2 by 2 block of matrices implies that:
Equating matrices yields:
Furthermore, since Tableau2 is the final tableau, y >= 0, so (y, t) is a feasible program for the dual problem. By construction of the tableau0, and since row operations preserve equations in subsequent tableaus: Ux + Bs = ß --> BAx + Bs = Bb using 1. and 2. above. But B nonsingular implies the matrix B is nonsingular. Premultiplying by B's inverse yields: Ax + s = b Therefore, (x, s) is a feasible program for the primal problem. Finally, the steps of the simplex algorithm rule that when a slack variable, sk, is in the basis, the corresponding dual variable yk = 0. If sk is not in the basis, then sk = 0. Therefore, complementary slackness obtains: yTs = 0. Similarly, if a primal variable, xk enters the basis (is not 0), then tk = 0. Therefore, complementary slackness obtains: tTx = 0. The pairs (x, s) and (y, t) are feasible and obey complementary slackness. Consequently, (x, s) is an optimal program for the primal problem, and (y, s) is an optimal program for the dual problem. Example Block Matrices. Look at Tableau2, and note that the basic variables, s1, x1, x2, plus the last column are the unit vectors e1, e2, e3, e4. Listing the columns corresponding to these variables in Tableau0 yields a matrix, call it AB:
Computing the inverse of AB yields a matrix found in Tableau2, namely B:
Premultiplying Tableau0 by B yields Tableau2. The Primal Simplex Algorithm. The basic simplex algorithm described above can be extended to handle a variety of complications, including = constraints with artificial variables, (Hadley, 108-148). However, an algorithm developed by Dantzig et al. for implementation on computers handles these complications in a straightforward manner that is amenable to hand calculation. The standard form for the primal simplex method assumes all constraints are <=, or = constraints, but places no restrictions on the signs of the RHS bi variables. In the primal simplex algorithm, a sequence of tableaux are calculated. A given Tableauk has the form:
after consolidating the center 2 by 2 block of matrices. This primal simplex algorithm uses a "three-phase method":
The following example will be solved using the primal simplex algorithm (Restrepo, Linear Programming, 58-66), to illustrate this technique.
Click to pop a new window with the primal and dual l.p. problem displayed with the = constraint replaced with <= and >= constraints, and the solution obtained with the online l.p. solver. The following diagram illustrates the constraints and the objective function at its maximum value.
If necessary, multiply any = constraints by -1 to get the RHS negative, and introduce the slack variables into the statement of the problem. The variable s3 is an artificial variable, since the third constraint is an equation.
The standard form for the initial primal simplex tableau is:
Label rows & columns. Use the data from the example to fill in the initial tableau. Label column s3 with a * to indicate that it is an artificial variable. Add two new columns: the column of row sums used to check arithmetic, and the column labelled b / xk, that will be used in Phases I and II.
Tableau0 solution: Variables s1, s2, s3 are the basic variables, since their columns are e1T = (1, 0, 0, 0), e2T = (0, 1, 0, 0), and e3T = (0, 0, 1, 0). The primal program is sT = (85, 90, -51.5), with xT = (0.00, 0.00, 0.00). The primal objective function has the value P = cTx = c1x1 + c2x2 + c3x3 = 0.00. Proceed to the next tableau as follows: Phase 0. Drive the artificial variables from the basis. A. In Tableau0:
Tableau1 solution: Basis: x1, s1, s2. The primal unfeasible program: xT = (85.8333, 0.00, 0.00); sT = (-0.8333, -17.292, 0). The primal objective function has the value P = 1287.5. Proceed to the next tableau as follows: Since the artificial variable s*3 associated with the = constraint is not in the basis, Phase 0 is complete. Phase I. Since b11 and b12 are negative, the algorithm is in Phase I. Goal: Generate a feasible program so that b >= 0.
A. In Tableau1:
Tableau2 solution: Basis: x1, x2, s2. The primal unfeasible program: xT = (83.75, 1.25, 0.00); sT = (0, -15.313, 0). The primal objective function has the value P = 1268.75. Proceed to the next tableau as follows: Phase I. Since b22 is negative, the algorithm is in Phase I. Goal: Generate a feasible program so that b >= 0.
A. In Tableau2:
Tableau3 solution: Basis: x1, x2, x3. The primal feasible program: xT = (40, 10, 35); sT = (0, 0, 0). The primal objective function has the value P = 1225. For this tableau, b >= 0, the artificial variable, s*3, is not in the basis, and all entries in the last row corresponding to the variables x1, x2, x3, s1, and s2 are nonnegative. The primal simplex algorithm terminates without proceeding to Phase II, since all conditions of Phase I and II are satisfied. The optimal programs are: x = (40, 10, 35), s = (0, 0, 0); y = (15.71, 2.86, 7.14), t = (0, 0, 0); P = 1225. To demonstrate Phase II of the primal simplex algorithm, begin with Tableau0 above, but use x3,2 = -1 as the pivot.
Proceed to the next tableau as follows: Phase 0. Drive the artificial variables from the basis. A. In Tableau0:
Tableau1 solution: Basis: x2, s1, s2. The primal feasible program: xT = (0.00, 51.5, 0.00); sT = (33.5, 64.25, 0). The primal objective function has the value P = 515. Proceed to the next tableau as follows: Phase 0 is complete: The artificial variable s*3 = 0. Phase I is complete: b = ß >= 0. Phase II. Similar to the Basic Simplex Algorithm: try to increase the value of P = µ by obtaining nonnegative entries in Ø (the last row) for the sign-restricted primal and slack variables. A. In Tableau1:1. Since the coefficient of x3 in the last row, -10, is the most negative, x3 will enter the basis. 2. Compute the ratios bi / xi,3 as per the last column: select the row with the smallest positive ratio, L1 = 67. Thus x1,3 = 0.5 is the pivot , and slack variable s1 will leave the basis. B. To create Tableau2: 3. Compute row L21 by dividing row L11 by the pivot = 0.5. 4. Subtract multiples of row L21 from all other rows of Tableau1 so that x23 = e1 in Tableau2.
Tableau2 solution: Basis: x2, x3, s2. The primal program: xT = (0.00, 18, 67); sT = (0, 14.0, 0). The primal objective function has the value P = 1185. Proceed to the next tableau as follows: Phase II. The last row, Ø, still has a negative entry. A. In Tableau2:1. Since the coefficient of x1 in the last row, -1, is negative, x1 will enter the basis. 2. Compute the ratios bi / xi,1 as per the last column: select the row with the smallest positive ratio, L2 = 40. Thus x2,1 = 0.35 is the pivot , and slack variable s2 will leave the basis. B. To create Tableau3: 3. Compute row L32 by dividing row L22 by the pivot = 0.35. 4. Subtract multiples of row L32 from all other rows of Tableau2 so that x32 = e2 in Tableau3.
Tableau3 solution: For this tableau, b >= 0, the artificial variable, s*3, is not in the basis, and all entries in the last row corresponding to the variables x1, x2, x3, s1, and s2 are nonnegative. The primal simplex algorithm terminates. Basis: x1, x2, x3. The primal feasible program: xT = (40, 10, 35); sT = (0, 0, 0). The primal objective function has the value P = 1225. The optimal programs are: x = (40, 10, 35), s = (0, 0, 0); y = (15.71, 2.86, 7.14), t = (0, 0, 0); P = 1225. Unbounded and Unfeasible Problems. As shown on the graphical web page, the next example has an unbounded primal solution, with an unfeasible dual problem.
To solve this problem using the primal simplex algorithm, set up the initial tableau as usual:
Phase 0: Complete since there are no artificial variables. Phase I: Since b02 = -20 <= 0, the algorithm is in Phase I. Goal: Generate a feasible program so that b >= 0.
A. In Tableau0:
Phase I is complete: b = ß >= 0. Phase II. Try to increase the value of P = µ = 200 by eliminating negative entries from the last row. A. In Tableau1:1. Since the coefficient of x2 in the last row, -20.005, is the most negative, x2 will enter the basis. 2. Compute the ratios bi / xi,2 as per the last column: select the row with the smallest positive ratio, L1 = 50. Thus x1,2 = 1.0 is the pivot , and slack variable s1 will leave the basis. B. To create Tableau2: 3. Compute row L21 by dividing row L11 by the pivot = 1.0. 4. Subtract multiples of row L21 from all other rows of Tableau1 so that x22 = e1 in Tableau2.
Phase I is complete: b = ß >= 0. Phase II. The coefficient of s2 = -10.005 in the last row. A. In Tableau2:1. Since the coefficient of s2 in the last row is -10.005, s2 will enter the basis. 2. Compute the ratios bi / si,2 as per the last column. The smallest positive ratio, L1 = infinity. No suitable ratio exists. ==>> P is unbounded. As the following diagram shows, the objective function P is unbounded since it intersects the feasible set for any large positive number = P.
Degeneracy and Cycling. The primal simplex algorithm calculates a sequence of tableaus. The algorithm breaks down when in a given Tableauk:
a zero entry appears in the ß column and/or in the Ø row for a variable that is not one of the standard basis variables. The example from N. Paul Loomba (152) illustrates the degeneracy problem.
The three dimensional diagram shows how the three restraining planes intersect at the point (33.33, 16.67, 16.67).
This problem's initial tableau is:
The pivot column is 2, since -30 is the most negative Ø entry; the pivot row is 1, since 50.0 is the smallest b / x2 ratio; and the pivot = 2. However, row L03 also has a 50.0 = b / x2 ratio. Applying the primal simplex algorithm yields the next tableau:
The variable x2 has replaced s1 in the basis. But ß3 = b13 = 0.0 -- the tableau is degenerate. Charnes perturbation procedure resolves the degeneracy problem by adding small constants to the RHS of the constraints. Letting € = .1, the RHS vector b becomes: bp = (b1+€, b2+€2, b3+€3)' The perturbed problem's initial tableau is:
The pivot column is 2, since -30 is the most negative Ø entry; the pivot row is 3, since 50.005 is the smallest b / x2 ratio; and the pivot = 2. Applying the primal simplex algorithm yields the next tableau:
Because of the b0 vector was perturbed, no zero appears in the b1 vector. The variable x2 has replaced the slack variable s3 in the basis. The pivot column is 1, since -7 is the most negative Ø entry; the pivot row is 1, since 0.0990 is the least positive b / x1 ratio; and the pivot = 1. Applying the primal simplex algorithm yields:
The variable x1 has replaced the slack variable s1 in the basis. The pivot column is 3, since -9 is the most negative Ø entry; the pivot row is 2, since 16.6201 is the least positive b / x3 ratio; and the pivot = 3. Applying the primal simplex algorithm yields:
The variable x3 replaces the slack variable s3 in the basis. The basis consists of all three primal variables, x1, x2, and x3. The last tableau contains the solutions to the primal and dual perturbed problems. Letting:
The solution to the original primal problem is: (x1, x2, x3, P)' = B * (b1, b2, b3, 0)' = B *(100, 100, 100, 0) = (33.33, 16.67, 16.67, 1650.0)'. The solution to the dual problem is: (y1, y2, y3, D)' = (2.5, 3.00, 11.0, 1650.0)'. |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||