So lets suppose we have the following linear problem:
$\min -x+2y$
$s.t$
$x-y\le6$
$x-3y\le12$
$x\ge0 ,y\le2$
and I want to use simplex to find the optimal solution. First we convert this problem to a max problem that's in canonical form. Constraints are already $\le$. We make $\min$ to $\max$ and then we need $\forall x_i,x_i\ge0$. But here i get a bit confused. $y\le2 $ is troubling me. I know that $y\le2 $ means $y$ could be negative. So i create this virtual variable $w=2-y$ and replace $w $ with $y$ in the problem , and then i have this linear problem to solve:
$\max x-2w$
$s.t$
$x-w\le8$
$x-3w\le18$
$x\ge0 ,w\ge0$
However using simplex for the above problem gives me a solution of $x=8,w=0$. but of course this is not a feasible solution for the original problem.
What am i doing wrong here?
You must make the substitution $y = 2 - w$ in the problem, which gives
$$ \begin{align} & \text{max} & x - 2(2 - w) = x + w - 4 \\ & \text{s.t.} & x - (2 - w) \leq 6 \\ && x - 3(2 - w) \leq 12 \\ && x, w \geq 0. \end{align} $$
which is equivalent to
$$ \begin{align} & \text{max} & x + 2w\\ & \text{s.t.} & x + w \leq 8 \\ && x + 3w \leq 18 \\ && x, w \geq 0. \end{align} $$