I have to find a maximum and minimum of this linear programming problem.
$$\begin{align} max\quad x_1+x_2 \end{align}$$
Constrains $$\begin{align*} x_1+x_2+x_3 =3 \\ -2x_1+x_2+x_4=5 \\ x_2+x_5=7\\ x_1+x_6=6 \end{align*} \\ x_i \geq 0 $$
Origin simplex-table will be:
\begin{bmatrix}&x1&x2&x3&x4&x5&x6&B\\C_1&1&1&1&0&0&0&3\\C_2&-2&1&0&1&0&0&5\\C_3&0&1&0&0&1&0&7\\C_4&1&0&0&0&0&1&6\\-F&-1&-1&0&0&0&0&0\end{bmatrix}
Where $C_i$ is constraint i.
To find an optimal solution, which is maximum, we need to take the minimal value in -F row, excluding B column (leading column). I'll take x1 column and mark this column as $x_r$.
To find the leading row we need to calculate $\frac{B_i}{x_r}$ and the row, where this fraction is minimal (including 0) becomes the leading row. If $x_r<0$ we skip this row automatically.
The element that is at the intersection of leading row and leading column is leading element.
The leading column, which represents a variable, moves to basis using Jordan-Gauss elimination.
According to this table, the leading column is $x_1$ column, leading row is $C_1$ and the leading element is 1. Moving this variable to basis we got the next simplex-table:
\begin{bmatrix}1&1&1&0&0&0&3\\0&3&2&1&0&0&11\\0&1&0&0&1&0&7\\0&-1&-1&0&0&1&3\\0&0&1&0&0&0&3\end{bmatrix}
F-row has no negative values, the solution is optimal. Yes, it's optimal, but for a different problem, where F looks like this:
$$\begin{align} max\quad x_1-x_2 \end{align}$$
I can achieve the true result choosing x2 as leading column instead of x1. But I'm working on inplementation of simplex-method and it's takes the 1st column if the minimal value in F row is not alone.
How can i achieve the true result, according to MathCad.
Second problem is if i have to find a minimum: $$\begin{align} min\quad x_1+x_2 \end{align}$$
How can i transform max problem into min problem? I know about min(F) = -max(F). But when i write down a simplex-table, I need to write F row with opposite signs, so i got an origin problem.
I have a problem (and my programm) solving min problems at all. What is the main steps to transform a min problem into max problem? How to check if solution is optimal ?