How can I verify my linear program solutions?

170 Views Asked by At

I started solving linear programs with the Simplex algorithm, however it is unclear to me how can I verify my solutions.

I have heard about geometrical solutions easy to check visually, but I'd rather do it just with algebra. How can I verify my linear program solutions?

For context, here is the particular problem I just solved I'd like to verify:


$$max \ (3x_1-x_2)$$ $$\begin{cases} x_1-x_2 \le 3\\ \color{red}{2x_1\le x_2}\\ x_1+x_2\ge 12\\ x_2 \le 10\\ x_1,x_2 \ge 0 \end{cases}$$

Change it to

$$\begin{cases} x_1-x_2 \le 3\\ \color{red}{2x_1 - x_2 \le 0}\\ x_1+x_2\ge 12\\ x_2 \le 10\\ x_1,x_2 \ge 0 \end{cases}$$

I transform it to the standard form...

$$\begin{cases} x_1-x_2 + x_3 = 3\\ 2x_1 - x_2 + 0 + x_4 = 0\\ x_1+x_2 + 0 + 0 - x_5 = 12\\ 0 + x_2 + 0 + 0 + 0 + x_6 = 10\\ x_1,x_2 \ge 0 \end{cases}$$


$$\begin{bmatrix} 1 & -1 & 1 & 0 & 0 & 0 & 3 \\ 2 & -1 & 0 & 1 & 0 & 0 & 0 \\ 1 & 1 & 0 & 0 & -1 & 0 & 12 \\ 0 & 1 & 0 & 0 & 0 & 1 & 10 \\ 3 & -1 & 0 & 0 & 0 & 0 & 0 \end{bmatrix}$$

The pivot column is the second one, and the pivot row is the fourth. So we got our pivot:

$$\begin{bmatrix} 1 & -1 & 1 & 0 & 0 & 0 & 3 \\ 2 & -1 & 0 & 1 & 0 & 0 & 0 \\ 1 & 1 & 0 & 0 & -1 & 0 & 12 \\ 0 & [1] & 0 & 0 & 0 & 1 & 10 \\ 3 & -1 & 0 & 0 & 0 & 0 & 0 \end{bmatrix}$$

$$r_4 + r_1$$ $$r_4 + r_2$$ $$-r_4 + r_3$$ $$r_4 + r_5$$

$$\begin{bmatrix} 1 & 0 & 1 & 0 & 0 & 1 & 13 \\ 2 & 0 & 0 & 1 & 0 & 1 & 10 \\ 1 & 0 & 0 & 0 & -1 & -1 & 2 \\ 0 & [1] & 0 & 0 & 0 & 1 & 10 \\ 3 & 0 & 0 & 0 & 0 & 1 & 10 \end{bmatrix}$$

The objective row has no negative terms, so we're done. The basic feasible solution here is

$$(x_1, x_2, x_3, x_4, x_5, x_6) = (0,10,13,10,0,0)$$

Now we evaluate this solution with the objective function:

$$3x_1-x_2 = 3(0)-10 = -10$$

1

There are 1 best solutions below

0
On

For verifying a solution, Wolfram Alpha might be useful (also free and fast) if you do not actually have Mathematica. I actually wrote the following up in Mathematica then pasted that into WA. You should be able to duplicate this for your other checks:

Maximize[{3*x1 - x2, 
x1 - x2 <= 3 && 2 x1 <= x2 && x1 + x2 >= 12 && x2 <= 10 && x1 >= 0 &&
x2 >= 0}, {x1, x2}]

Note that Minimize works similarly.