I want to solve the following linear programming problem:
$$\min (5y_1-10y_2+7y_3-3y_4) \\ y_1+y_2+7y_3+2y_4=3 \\ -2y_1-y_2+3y_3+3y_4=2 \\ 2y_1+2y_2+8y_3+y_4=4 \\ y_i \geq 0, i \in \{ 1, \dots, 4 \}$$
$\begin{bmatrix} 1 & 1 & 7 & 2 & | & 3\\ -2 & -1 & 3 & 3 & | & 2\\ 2 & 2 & 8 & 1 & | & 4 \end{bmatrix} \to \begin{bmatrix} 1 & 1 & 7 & 2 & | & 3\\ 0 & 1 & 17 & 7 & | & 8\\ 0 & 0 & 6 & 3 & | & 2 \end{bmatrix}$
So the problem is written equivalently as follows:
$$-\max (-5y_1+10y_2-7y_3+3y_4) \\ y_1+y_2+7y_3+2y_4=3 \\ y_2+17y_3+7y_4=8 \\ 6y_3+3y_4=2 \\ y_i \geq 0, i \in \{ 1, \dots, 4 \}$$
But we want the $3 \times 3$ identity matrix to appear at the matrix that represents the linear programming problem, right?
So we solve the following problem, right?
$$-\max (-5y_1+10y_2-7y_3+3y_4) \\ y_1+y_2+7y_3+2y_4=3 \\ y_2+17y_3+7y_4+y_5=8 \\ 6y_3+3y_4+y_6=2 \\ y_i \geq 0, i \in \{ 1, \dots,6 \}$$
Then:
$\begin{matrix} B & c_B & b & P_1 & P_2 & P_3 & P_4 & P_5 & P_5 & \theta & \\ P_1 & -5 & 3 & 1 & 1 & 7 & 2 & 0 & 0 & \frac{3}{7} &L_1 \\ P_5 & 0 & 8 & 0 & 1 & 17 & 7 & 1 & 0 & \frac{8}{17} & L_2\\ P_6 & 0 & 2 & 0 & 0 & 6 & 3 & 0 &1 & \frac{1}{3} &L_3 \\ & z & 0 & -5 & 10 & -7 & 3 & 0 & 0 & & L_4 \end{matrix}$
$|-7|> |-5|$ so $P_3$ gets in the basis and $P_6$ gets out of the basis.
Then we get the following tableau:
$\begin{matrix} B & c_B & b & P_1 & P_2 & P_3 & P_4 & P_5 & P_5 & \theta & \\ P_1 & -5 & \frac{2}{3} & 1 & 1 & 0 & -\frac{3}{2} & 0 & -\frac{7}{6} & &L_1'=L_1-7L_3' \\ P_5 & 0 & \frac{7}{3} & 0 & 1 & 0 & -\frac{3}{2} & 1 & -\frac{17}{6} & & L_2'=L_2-17L_3'\\ P_3 & -7 & \frac{1}{3} & 0 & 0 & 1 & \frac{1}{2} & 0 &\frac{1}{6} & &L_3'=\frac{L_3}{6} \\ & z & \frac{7}{3} & -5 & 10 & 0 & \frac{13}{2} & 0 & \frac76 & & L_4'=L_4+7L_3' \end{matrix}$
Have I maybe done something wrong? Because from the last tableau we get that $P_1$ gets out of the basis and $P_1$ gets in the basis...
EDIT: We could introduce the artificial variables as follows:
$$- \max (-5x_1+10x_2-7x_3+3x_4) \\ x_1+x_2+7x_3+2x_4+x_5=3 \\ -2x_1-x_2+3x_3+3x_4+x_6=2 \\ 2x_1+2x_2+8x_3+x_4+x_7=4 \\ x_i \geq 0, i=1,2, \dots, 7$$
At the first phase, we solve the linear programming problem $\min (x_5+x_6+x_7)$ under the new restrictions and at the second phase the initial problem, for which we will have found from the first phase a basic feasible solution.
The problem of the first phase can be written as follows:
$$ -\max (-x_5-x_6-x_7) \\ x_1+x_2+7x_3+2x_4+x_5=3 \\ -2x_1-x_2+3x_3+3x_4+x_6=2 \\ 2x_1+2x_2+8x_3+x_4+x_7=4 \\ x_i \geq 0, i=1,2, \dots, 7$$
Then I thought the simplex tableau would be the following:
$\begin{matrix} B & c_B & b & P_1 & P_2 & P_3 & P_4 & P_5 & P_6 & P_7 & \theta & \\ P_5 & -1 & 3 & 1 & 1 & 7 & 2 & 1 & 0 & 0 & & L_1\\ P_6 & -1 & 2 & -2 & -1 & 3 & 3 & 0 & 1 & 0 & & L_2\\ P_7 & -1 & 4 & 2 & 2 & 8 & 1 & 0 & 0 & 1 & & L_3\\ & z & 0 & 0 & 0 & 0 & 0 & 1 & 1 & 1 & & L_4 \end{matrix}$
But I found that it is this one:
How do we find the $z_k-c_k$- values?
EDIT 2: I get the following tableaus:
$\begin{matrix} B & c_B & b & P_1 & P_2 & P_3 & P_4 & P_5 & P_6 & P_7 & \theta & \\ P_1 & -1 & 3 & 1& 1&7 & 2 & 1 & 0 & 0 & \frac{3}{7} & L_1 \\ P_5 & -1 & 2 & -2 & -1 & 3 & 3 & 0& 1 & 0 &\frac{2}{3} &L_2\\ P_6 & -1 & 4 & 2 & 2 & 8 & 1 & 0 & 0 & 1 &\frac12 &L_3\\ & z & -9& -1 & -2 & -18 & -6& 0& 0 & 0 & & \end{matrix}$
$$$$
$ \begin{matrix} B & c_B & b & P_1 & P_2 & P_3 & P_4 & P_5 & P_6 & P_7 & \theta & \\ P_3 & 0 & \frac{3}{7} & \frac{1}{7}& \frac{1}{7}&1 & \frac{2}{7}& \frac{1}{7} & 0 & 0 & \frac{3}{2} & L_1'=\frac{L_1}{7} \\ P_6 & -1 & \frac{11}{7} & \frac{-17}{7} & -\frac{10}{7} & 0 & \frac{15}{7} & -\frac{3}{7}& 1 & 0 &\frac{11}{15} &L_2'=L_2-3L_1'\\ P_7 & -1 & \frac{4}{7} & \frac{6}{7} & \frac{6}{7} & 0 & -\frac{9}{7} & -\frac{8}{7} & 0 & 1 &- &L_3'=L_3-8L_1'\\ & z & \frac{-9}{7}& \frac{11}{7} & \frac{4}{7} & 0 & \frac{-6}{7}& \frac{18}{17}& 0 & 0 & & L_4'=L_4+18 L_1' \end{matrix}$
$ \begin{matrix} B & c_B & b & P_1 & P_2 & P_3 & P_4 & P_5 & P_6 & P_7 & \theta & \\ P_3 & 0 & \frac{23}{105} & \frac{7}{15}& \frac{1}{3}&1 & 0& \frac{1}{5} & -\frac{2}{15} & 0 & & L_1''=L_1'-\frac{2}{7}L_2'' \\ P_4 & 0 & \frac{11}{15} & \frac{-17}{15} & -\frac{2}{3} & 0 & 1 & -\frac{1}{5}& \frac{7}{15} & 0 & &L_2''=\frac{7}{15} L_2'\\ P_7 & -1 & \frac{17}{5} & -\frac{123}{35} & 0 & 0 & 0 & -\frac{7}{15} & \frac{9}{15} & 1 & &L_3''=L_3'+\frac{9}{7}L_2''\\ & z & \frac{3}{5}& \frac{3}{5} & 0 & 0 & 0& \frac{12}{5}& \frac{6}{15} & 0 & & L_4''=L_4'+\frac{6}{7} L_2'' \end{matrix}$
$$$$
But according to my textbook it should be as follows:
Have I done something wrong at the calculations?