Statjana said:
Dear all,
My area of expertise is elsewhere and I do not intent to become expert in the simplex method, just tryitng to understand the steps from my initial problem forumlation Tableau #1, to the final solution Tableau #4, the final solution is correct, btw. I also understand the steps from Tableau #1 to Tableau #2 (I guess that since this is the first step, even without negative values in the bottom row, we want to interate once, so chose smallest value -10). But then why in the next iteration do we chose 20 and not -15? No need to talk me through row manipulations. Could you just explain for me each time, why we choose the pivot coloumn and row? - Thanks alot! Help is much appreciated on this! I guess in Tableau #1, the equality had to be slpit to two equalities, with slacks, because otherwise there is not a pivot for every row?
Tableau #1
x y z s1 s2 s3 s4 -p
2/3 1/3 0 1 0 0 0 0 100
1/3 2/3 0 0 1 0 0 0 100
1 1 1 0 0 1 0 0 181
1 1 1 0 0 0 -1 0 181
10 12 20 0 0 0 0 1 0
Tableau #2
x y z s1 s2 s3 s4 -p
1 1/2 0 3/2 0 0 0 0 150
0 1/2 0 -1/2 1 0 0 0 50
0 1/2 1 -3/2 0 1 0 0 31
0 1/2 1 -3/2 0 0 -1 0 31
0 7 20 -15 0 0 0 1 -1500
Tableau #3
x y z s1 s2 s3 s4 -p
1 1/2 0 3/2 0 0 0 0 150
0 1/2 0 -1/2 1 0 0 0 50
0 0 0 0 0 1 1 0 0
0 1/2 1 -3/2 0 0 -1 0 31
0 -3 0 15 0 0 20 1 -2120
Tableau #4
x y z s1 s2 s3 s4 -p
1 0 -1 3 0 0 1 0 119
0 0 -1 1 1 0 1 0 19
0 0 0 0 0 1 1 0 0
0 1 2 -3 0 0 -2 0 62
0 0 6 6 0 0 14 1 -1934
Your tableaus are almost unreadable, because the columns do not line up well, and you never state exactly what your objective is, or whether you are maximizing or minimizing. Looking at your first tableau (which is almost readable) I guess your original LP is (after multiplying the first two constraints by 3 on both sides):
$$\begin{array}{rrrrcl}
\max/\min&Z = 10 x +12 y + 20 z & & \\
\text{s.t.} & 2x + y &\leq&300 \\
&x + 2y & \leq & 300 \\
& x+y+z&=& 181\\
& x,y,z &\geq & 0
\end{array}
$$
These two LPs can be easily solved using a package, and the solutions are:
(1) For the maximization problem: x = y = 0, z = 181, Z = 3620.
(2) For the minimization problem: x=119, y = 62, z = 0, Z = 1934
So, it looks like the right-hand-side entries x, y and Z in Tableau 4 are correct, and the problem is one of minimization. However, it also looks like some of the other Tableau entries are wrong.
As to your question: write out the Tableau entries as equations, so your objective equation for Tableau 2 would be
##-P + 7y + 20 z -15 s1 = -1500,## or ##-P = -1500 -7y -20 z + 15 s1##, so to decrease ##-P## we need to choose variables whose coefficients on the right are < 0. Note that because you introduce two "fake" slack/surplus variables in the equality constraint, you are dealing with an infeasible solution in Tableau 2, hence your objective value ##P = 1500## is super-optimal--less than the actual minimum among feasible solutions. Also, I your tableaus exhibit non-monotone behavior: in Tableaus 1--4 your ##P## values are 0, 1500, 2120 and 1934. I would have expected them to rise steadily.
I don't agree in detail with all the entries in your Tableau 4. Rather than using the outdated (and NOT recommended) method of converting an equality into two opposite inequalities, I just leave it as is. Thus, my tableaus would have a different number of columns from yours, if I used tableaus at all (which I do not). I use equations instead, but let the computer algebra package Maple do all the work. I supply slack variables s1 and s2 for the two inequality constraints but leave the third equation alone. Here are the steps:
eqs:={2*x+y+s1=300, x + 2*y + s2 = 300, x+y+z=181, Z-10*x-12*y-20*z=0}; <== input
eqs := {x + y + z = 181, x + 2 y + s2 = 300, 2 x + y + s1 = 300, Z - 10 x - 12 y - 20 z = 0} <== output
S1:=solve(eqs,{z,s1,s2,Z});
S1 := {Z = -10 x - 8 y + 3620, s1 = -2 x - y + 300, s2 = -x - 2 y + 300, z = -x - y + 181} <== first basic feasible solution (bfs)
S2:=solve(S1,{z,x,s2,Z});
S2 = {Z = -3*y+2120+5*s1, s2 = -3/2*y+150+1/2*s1, x = -1/2*y+150-1/2*s1, z = -1/2*y+31+1/2*s1} <== second bfs
S3:=solve(S2,{y,x,s2,Z});
S3 := {Z = 6 z + 1934 + 2 s1, s2 = 3 z + 57 - s1, x = z + 119 - s1, y = -2 z + 62 + s1} <== third bfs (optimal)
The first basic solution was obtained by letting s1, s2 and z be basic (and also Z, which is always kept basic). It happens to be feasible as well, but if some of the basic variables had come out < 0 we could have dealt with that. (Alternatively, I could have introduced and artificial variable "a" and written the third constraint as ##x+y+z+a=181##, then require that ##a \geq 0## come out as zero. That would be a two-phase approach, where Phase I is to minimize a, and if a comes out as zero, go on to Phase II (the actual optimzation), starting with the tableau/equations left at the end of Phase I. However, I did not bother with all that.)
So, S1 is the first system of equations, putting basic variables on the left of the "=" and non-basics on the right. (A system written that way is called a dictionary in Chvatal's book.) S1 is the first dictionary. If I really wanted to use a tableau I could get it from dictionary 1:
$$\begin{array}{r|rrrrr|r}
Z & x & y & z & s1 & s2 & \text{rhs} \\ \hline
1 & 10 & 8 &0 & 0&0 & 3620\\
0 & 2 & 1 & 0 & 1 & 0 & 300 \\
0 & 1 & 2 & 0 & 0 & 1 & 300 \\
0 & 1 & 1 & 1 & 0 & 0 & 181 \\
\end{array}$$
However, doing that is a waste of time, and so I will stop. BTW: if you want to see how I made the table, just right-click on the image and ask for a display of math at tex commands; that will show you the details.
Dictionary S2 is obtained by swapping x and s1 in S1; that is, we let x become basic, and then s1 becomes non-basic (by the usual ratio test). Of course, moving away from S1 we could have chosen to increase y instead, but increasing x decreases Z at the fastest rate, and is what is normally done in introductory discussions (but usually not in practice on LPs having hundreds of thousands of variables and constraints---as found in real-world industrial applications).
When we look at S2, the only favorable non-basic variable is y, because it is the only right-hand-side variable whose increase from 0 will decrease the value of Z. So we increase y and find that z leaves the basis---again by the standard minimum-ratio test. Swapping y and z in S2 gives the dictionary in S3, which is optimal. If you compare S3 with your Tableau 4 you will see some differences. In particular, it looks like your s2 is 19 while mine is 57.