Linear Programming Problem -- a walk through 
 
Reading the data file:   lp_demo1409c.txt
          Number of variables set to 2 
line 1: 2 3 le 25  --->    Inequality is:   2 x1
 + 3 x2
 ≤ 
25
line 2: 1 2 le 16  --->    Inequality is:   1 x1
 + 2 x2
 ≤ 
16
line 3: 2 1 le 15  --->    Inequality is:   2 x1
 + 1 x2
 ≤ 
15
line 4: 7 2 le 51  --->    Inequality is:   7 x1
 + 2 x2
 ≤ 
51
line 5: maximize 3 1  --->            set Maximize:   
3 x1
 + 1 x2
Create the Initial Tableau 
After reconfiguring the objective function and converting any '≥' constraints 
to a '≤' form, we can produce the following tableau: 
 
 
 
|   |  
 x1  |  
 x2  |  
 s1  |  
 s2  |  
 s3  |  
 s4  |  
 z  |  
  |  
 
|  s1  |  
 2  |  
 3  |  
 1  |  
 0  |  
 0  |  
 0  |  
 0  |  
 25  |  
 
 
|  s2  |  
 1  |  
 2  |  
 0  |  
 1  |  
 0  |  
 0  |  
 0  |  
 16  |  
 
 
|  s3  |  
 2  |  
 1  |  
 0  |  
 0  |  
 1  |  
 0  |  
 0  |  
 15  |  
 
 
|  s4  |  
 7  |  
 2  |  
 0  |  
 0  |  
 0  |  
 1  |  
 0  |  
 51  |  
 
 
|   |  
 -3  |  
 -1  |  
 0  |  
 0  |  
 0  |  
 0  |  
 1  |  
 0  |  
 
 
Processing
There is at least one negative value in the 
last row (excluding the final column).  Therefore we need to start the 
regular simplex processing algorithm.
 
The lowest negative value in the last row is -3 and 
 that is in column 1. So make column 1 the work column.
 
 
|   |  
 x1  |  
 x2  |  
 s1  |  
 s2  |  
 s3  |  
 s4  |  
 z  |  
  |  
 
|  s1  |  
 2  |  
 3  |  
 1  |  
 0  |  
 0  |  
 0  |  
 0  |  
 25  |  
 
 
|  s2  |  
 1  |  
 2  |  
 0  |  
 1  |  
 0  |  
 0  |  
 0  |  
 16  |  
 
 
|  s3  |  
 2  |  
 1  |  
 0  |  
 0  |  
 1  |  
 0  |  
 0  |  
 15  |  
 
 
|  s4  |  
 7  |  
 2  |  
 0  |  
 0  |  
 0  |  
 1  |  
 0  |  
 51  |  
 
 
|   |  
 -3  |  
 -1  |  
 0  |  
 0  |  
 0  |  
 0  |  
 1  |  
 0  |  
 
 
The lowest ratio between positive values in column 1  and corresponding values in the the final column is 7.28571428571429 and 
 that is in row 4. So make row 4 the work row.
That makes the item in row 4 and column 1 the pivot item.
 
 
|   |  
 x1  |  
 x2  |  
 s1  |  
 s2  |  
 s3  |  
 s4  |  
 z  |  
  |  
 
|  s1  |  
 2  |  
 3  |  
 1  |  
 0  |  
 0  |  
 0  |  
 0  |  
 25  |  
 
 
|  s2  |  
 1  |  
 2  |  
 0  |  
 1  |  
 0  |  
 0  |  
 0  |  
 16  |  
 
 
|  s3  |  
 2  |  
 1  |  
 0  |  
 0  |  
 1  |  
 0  |  
 0  |  
 15  |  
 
 
|  s4  |  
 7  |  
 2  |  
 0  |  
 0  |  
 0  |  
 1  |  
 0  |  
 51  |  
 
 
|   |  
 -3  |  
 -1  |  
 0  |  
 0  |  
 0  |  
 0  |  
 1  |  
 0  |  
 
 
Use the elementary row operation *row to change the 
pivot item to be 1.  That is, multiply row 4 by 
1 / 7.  
 
|   |  
 x1  |  
 x2  |  
 s1  |  
 s2  |  
 s3  |  
 s4  |  
 z  |  
  |  
 
|  s1  |  
 2  |  
 3  |  
 1  |  
 0  |  
 0  |  
 0  |  
 0  |  
 25  |  
 
 
|  s2  |  
 1  |  
 2  |  
 0  |  
 1  |  
 0  |  
 0  |  
 0  |  
 16  |  
 
 
|  s3  |  
 2  |  
 1  |  
 0  |  
 0  |  
 1  |  
 0  |  
 0  |  
 15  |  
 
 
|  s4  |  
 1  |  
 2/7  |  
 0  |  
 0  |  
 0  |  
 1/7  |  
 0  |  
 51/7  |  
 
 
|   |  
 -3  |  
 -1  |  
 0  |  
 0  |  
 0  |  
 0  |  
 1  |  
 0  |  
 
 
Now use the elementary row operation *row+ to change the 
other items in column 1 to 0.  
- multiply row 4 by -2 and add to row 1. 
 - multiply row 4 by -1 and add to row 2. 
 - multiply row 4 by -2 and add to row 3. 
 - multiply row 4 by 3 and add to row 5. 
 
 
 
 
|   |  
 x1  |  
 x2  |  
 s1  |  
 s2  |  
 s3  |  
 s4  |  
 z  |  
  |  
 
|  s1  |  
 0  |  
 17/7  |  
 1  |  
 0  |  
 0  |  
 -2/7  |  
 0  |  
 73/7  |  
 
 
|  s2  |  
 0  |  
 12/7  |  
 0  |  
 1  |  
 0  |  
 -1/7  |  
 0  |  
 61/7  |  
 
 
|  s3  |  
 0  |  
 3/7  |  
 0  |  
 0  |  
 1  |  
 -2/7  |  
 0  |  
 3/7  |  
 
 
|  s4  |  
 1  |  
 2/7  |  
 0  |  
 0  |  
 0  |  
 1/7  |  
 0  |  
 51/7  |  
 
 
|   |  
 0  |  
 -1/7  |  
 0  |  
 0  |  
 0  |  
 3/7  |  
 1  |  
 153/7  |  
 
 
Now we need to copy the heading for the work column  (column 1) to the 
heading for the work row (row 4). 
 
 
|   |  
 x1  |  
 x2  |  
 s1  |  
 s2  |  
 s3  |  
 s4  |  
 z  |  
  |  
 
|  s1  |  
 0  |  
 17/7  |  
 1  |  
 0  |  
 0  |  
 -2/7  |  
 0  |  
 73/7  |  
 
 
|  s2  |  
 0  |  
 12/7  |  
 0  |  
 1  |  
 0  |  
 -1/7  |  
 0  |  
 61/7  |  
 
 
|  s3  |  
 0  |  
 3/7  |  
 0  |  
 0  |  
 1  |  
 -2/7  |  
 0  |  
 3/7  |  
 
 
|  x1  |  
 1  |  
 2/7  |  
 0  |  
 0  |  
 0  |  
 1/7  |  
 0  |  
 51/7  |  
 
 
|   |  
 0  |  
 -1/7  |  
 0  |  
 0  |  
 0  |  
 3/7  |  
 1  |  
 153/7  |  
 
 
Having finished the steps of the processing routine, we need 
to see if there are any remaining negative values in the final 
column.  If so, then we restart the processing steps. 
 
The lowest negative value in the last row is -1 / 7  = -0.142857142857143 and 
 that is in column 2. So make column 2 the work column.
 
 
|   |  
 x1  |  
 x2  |  
 s1  |  
 s2  |  
 s3  |  
 s4  |  
 z  |  
  |  
 
|  s1  |  
 0  |  
 17/7  |  
 1  |  
 0  |  
 0  |  
 -2/7  |  
 0  |  
 73/7  |  
 
 
|  s2  |  
 0  |  
 12/7  |  
 0  |  
 1  |  
 0  |  
 -1/7  |  
 0  |  
 61/7  |  
 
 
|  s3  |  
 0  |  
 3/7  |  
 0  |  
 0  |  
 1  |  
 -2/7  |  
 0  |  
 3/7  |  
 
 
|  x1  |  
 1  |  
 2/7  |  
 0  |  
 0  |  
 0  |  
 1/7  |  
 0  |  
 51/7  |  
 
 
|   |  
 0  |  
 -1/7  |  
 0  |  
 0  |  
 0  |  
 3/7  |  
 1  |  
 153/7  |  
 
 
The lowest ratio between positive values in column 2  and corresponding values in the the final column is 1 and 
 that is in row 3. So make row 3 the work row.
That makes the item in row 3 and column 2 the pivot item.
 
 
|   |  
 x1  |  
 x2  |  
 s1  |  
 s2  |  
 s3  |  
 s4  |  
 z  |  
  |  
 
|  s1  |  
 0  |  
 17/7  |  
 1  |  
 0  |  
 0  |  
 -2/7  |  
 0  |  
 73/7  |  
 
 
|  s2  |  
 0  |  
 12/7  |  
 0  |  
 1  |  
 0  |  
 -1/7  |  
 0  |  
 61/7  |  
 
 
|  s3  |  
 0  |  
 3/7  |  
 0  |  
 0  |  
 1  |  
 -2/7  |  
 0  |  
 3/7  |  
 
 
|  x1  |  
 1  |  
 2/7  |  
 0  |  
 0  |  
 0  |  
 1/7  |  
 0  |  
 51/7  |  
 
 
|   |  
 0  |  
 -1/7  |  
 0  |  
 0  |  
 0  |  
 3/7  |  
 1  |  
 153/7  |  
 
 
Use the elementary row operation *row to change the 
pivot item to be 1.  That is, multiply row 3 by 
7 / 3.  
 
|   |  
 x1  |  
 x2  |  
 s1  |  
 s2  |  
 s3  |  
 s4  |  
 z  |  
  |  
 
|  s1  |  
 0  |  
 17/7  |  
 1  |  
 0  |  
 0  |  
 -2/7  |  
 0  |  
 73/7  |  
 
 
|  s2  |  
 0  |  
 12/7  |  
 0  |  
 1  |  
 0  |  
 -1/7  |  
 0  |  
 61/7  |  
 
 
|  s3  |  
 0  |  
 1  |  
 0  |  
 0  |  
 7/3  |  
 -2/3  |  
 0  |  
 1  |  
 
 
|  x1  |  
 1  |  
 2/7  |  
 0  |  
 0  |  
 0  |  
 1/7  |  
 0  |  
 51/7  |  
 
 
|   |  
 0  |  
 -1/7  |  
 0  |  
 0  |  
 0  |  
 3/7  |  
 1  |  
 153/7  |  
 
 
Now use the elementary row operation *row+ to change the 
other items in column 2 to 0.  
- multiply row 3 by -17 / 7 
 and add to row 1. 
 - multiply row 3 by -12 / 7 
 and add to row 2. 
 - multiply row 3 by -2 / 7 
 and add to row 4. 
 - multiply row 3 by 1 / 7 
 and add to row 5. 
 
 
 
 
|   |  
 x1  |  
 x2  |  
 s1  |  
 s2  |  
 s3  |  
 s4  |  
 z  |  
  |  
 
|  s1  |  
 0  |  
 0  |  
 1  |  
 0  |  
 -17/3  |  
 4/3  |  
 0  |  
 8  |  
 
 
|  s2  |  
 0  |  
 0  |  
 0  |  
 1  |  
 -4  |  
 1  |  
 0  |  
 7  |  
 
 
|  s3  |  
 0  |  
 1  |  
 0  |  
 0  |  
 7/3  |  
 -2/3  |  
 0  |  
 1  |  
 
 
|  x1  |  
 1  |  
 0  |  
 0  |  
 0  |  
 -2/3  |  
 1/3  |  
 0  |  
 7  |  
 
 
|   |  
 0  |  
 0  |  
 0  |  
 0  |  
 1/3  |  
 1/3  |  
 1  |  
 22  |  
 
 
Now we need to copy the heading for the work column  (column 2) to the 
heading for the work row (row 3). 
 
 
|   |  
 x1  |  
 x2  |  
 s1  |  
 s2  |  
 s3  |  
 s4  |  
 z  |  
  |  
 
|  s1  |  
 0  |  
 0  |  
 1  |  
 0  |  
 -17/3  |  
 4/3  |  
 0  |  
 8  |  
 
 
|  s2  |  
 0  |  
 0  |  
 0  |  
 1  |  
 -4  |  
 1  |  
 0  |  
 7  |  
 
 
|  x2  |  
 0  |  
 1  |  
 0  |  
 0  |  
 7/3  |  
 -2/3  |  
 0  |  
 1  |  
 
 
|  x1  |  
 1  |  
 0  |  
 0  |  
 0  |  
 -2/3  |  
 1/3  |  
 0  |  
 7  |  
 
 
|   |  
 0  |  
 0  |  
 0  |  
 0  |  
 1/3  |  
 1/3  |  
 1  |  
 22  |  
 
 
Having finished the steps of the processing routine, we need 
to see if there are any remaining negative values in the final 
column.  If so, then we restart the processing steps. 
 
There are no more negative values is the final column. 
Therefore, regular processing is done... 
Display the answers. Note that if a variable does not 
appear in the following list then it should be given the value 0. 
The list is generated from the final tableau by reading down the 
labels on the left and assigning to each the value in the rightmost 
column. Any slack variables in the labels on the left will be 
included in the list, but they can be ignored. 
When 
 
-  s1  = 8 
 -  s2  = 7 
 -  x2  = 1 
 -  x1  = 7 
 
 
 the objective function has a 
Maximum = 22 
©Roger M. Palay     Saline, MI 48176     October, 2010