Maximize X1 + X2 + 2 * X3 + X4
subject to
-X1 + X3 + 2 X4 < = -3 -X1 + X2 < = -7 -X1 + 2 X2 + X4 < = -5 X1, X2, X3, X4 > = 0
Phase 1: Before pivoting to make feasible.
X5 = -3 + X1 - X3 - 2 X4 + X0 X6 = -7 + X1 - X2 + X0 X7 = -5 + X1 - 2 X2 - X4 + X0 ----------------------------------------------- w = 0 - X0Taking the first pivot:
X0 enters. X6 leaves. z = -0.000000 The initial dictionary: X5 = 4+ 0 X1 + 1 X2 - 1 X3 - 2 X4 + 1 X6 X0 = 7- 1 X1 + 1 X2 + 0 X3 + 0 X4 + 1 X6 X7 = 2+ 0 X1 - 1 X2 + 0 X3 - 1 X4 + 1 X6 ----------------------------------------------- w = -7+ 1 X1 - 1 X2 + 0 X3 + 0 X4 - 1 X6 X1 enters. X0 leaves. z = -7.000000This first part is done by hand
The problem to type into the computer that represents the dictionary after the first pivot of the Phase 1 problem is:
5 3 1 -1 0 0 -1 4 0 -1 1 2 -1 7 1 -1 0 0 -1 2 0 1 0 1 -1
With the following translation of variables:
input vars. | slacks- implicitly rep.
--------------------+----------------------
Old: X1 X2 X3 X4 X6 | X5 X0 X7
New: X1 X2 X3 X4 X5 | X6 X7 X8
At the end, we will have to add -7 to z
because constants cannot be represented.
Solving the problem with variables renamed:
Phase 1: Input dictionary after first pivot.
X6 = 4 + 0 X1 + 1 X2 - 1 X3 - 2 X4 + 1 X5
X7 = 7 - 1 X1 + 1 X2 + 0 X3 + 0 X4 + 1 X5
X8 = 2 + 0 X1 - 1 X2 + 0 X3 - 1 X4 + 1 X5
-------------------------------------------------
z = -0 + 1 X1 - 1 X2 + 0 X3 + 0 X4 - 1 X5
X1 enters. X7 leaves. z = -0
After 1 pivot:
X6 = 4 + 1 X2 - 1 X3 - 2 X4 + 1 X5 + 0 X7
X1 = 7 + 1 X2 + 0 X3 + 0 X4 + 1 X5 - 1 X7
X8 = 2 - 1 X2 + 0 X3 - 1 X4 + 1 X5 + 0 X7
-------------------------------------------------
z = 7 + 0 X2 + 0 X3 + 0 X4 + 0 X5 - 1 X7
The optimal solution: 7
X1 = 7 X2 = 0 X3 = 0 X4 = 0
X5 = 0 X6 = 4 X7 = 0 X8 = 2
Use editor to rename variables:
Old: X1 X2 X3 X4 X6 X5 X0 X7
New: X1 X2 X3 X4 X5 X6 X7 X8
*************** Renaming variables to old names
Phase 1: Input dictionary after first pivot.
X5 = 4 + 0 X1 + 1 X2 - 1 X3 - 2 X4 + 1 X6
X0 = 7 - 1 X1 + 1 X2 + 0 X3 + 0 X4 + 1 X6
X7 = 2 + 0 X1 - 1 X2 + 0 X3 - 1 X4 + 1 X6
-------------------------------------------------
z = -0 + 1 X1 - 1 X2 + 0 X3 + 0 X4 - 1 X6
X1 enters. X0 leaves. z = -0
After 1 pivot:
X5 = 4 + 1 X2 - 1 X3 - 2 X4 + 1 X6 + 0 X0
X1 = 7 + 1 X2 + 0 X3 + 0 X4 + 1 X6 - 1 X0
X7 = 2 - 1 X2 + 0 X3 - 1 X4 + 1 X6 + 0 X0
-------------------------------------------------
z = 7 + 0 X2 + 0 X3 + 0 X4 + 0 X6 - 1 X0
The optimal solution: 7
X1 = 7 X2 = 0 X3 = 0 X4 = 0
X6 = 0 X5 = 4 X0 = 0 X7 = 2
Optimal since new solution is 7, so old solution is -7 + 7.
New problem for phase 2:
This part is also done by hand.
Update z and get rid of X0.
Maximize X1 + X2 + 2 X3 + X4
X1 = 7 + 1 X2 + 0 X3 + 0 X4 + 1 X6
So Maximize:
z = 7 + 2 X2 + 2 X3 + 1 X4 + 1 X6
subject to:
X5 = 4 + 1 X2 - 1 X3 - 2 X4 + 1 X6
X1 = 7 + 1 X2 + 0 X3 + 0 X4 + 1 X6
X7 = 2 - 1 X2 + 0 X3 - 1 X4 + 1 X6
Renaming variables again:
Input | Slacks
Old:X2 X3 X4 X6 | X5 X1 X7
New:X1 X2 X3 X4 | X5 X6 X7
New input:
4 3
2 2 1 1
4 -1 1 2 -1
7 -1 0 0 -1
2 1 0 1 -1
Solving the Phase 2 problem:
Phase 2: Input dictionary.
X5 = 4 + 1 X1 - 1 X2 - 2 X3 + 1 X4
X6 = 7 + 1 X1 + 0 X2 + 0 X3 + 1 X4
X7 = 2 - 1 X1 + 0 X2 - 1 X3 + 1 X4
-------------------------------------------------
z = -0 + 2 X1 + 2 X2 + 1 X3 + 1 X4
X1 enters. X7 leaves. z = -0
After 1 pivot:
X5 = 6 - 1 X2 - 3 X3 + 2 X4 - 1 X7
X6 = 9 + 0 X2 - 1 X3 + 2 X4 - 1 X7
X1 = 2 + 0 X2 - 1 X3 + 1 X4 - 1 X7
-------------------------------------------------
z = 4 + 2 X2 - 1 X3 + 3 X4 - 2 X7
The problem is UNBOUNDED.
The dictionary for the original problem:
To get solution to original problem, change back
to original variable names and add 7 to z:
Old:X2 X3 X4 X6 X5 X1 X7
New:X1 X2 X3 X4 X5 X6 X7
After 1 pivot:
X5 = 6 - 1 X3 - 3 X4 + 2 X6 - 1 X7
X1 = 9 + 0 X3 - 1 X4 + 2 X6 - 1 X7
X2 = 2 + 0 X3 - 1 X4 + 1 X6 - 1 X7
-------------------------------------------------
z = 11 + 2 X3 - 1 X4 + 3 X6 - 2 X7