Linear Programming Problem -- a walk through
Reading the data file: lp_demo_sec01b.txt
Number of variables set to 2
line 1: 1 2 le 26 ---> Inequality is: 1 x1
+ 2 x2
≤
26
line 2: -2 3 le 18 ---> Inequality is: -2 x1
+ 3 x2
≤
18
line 3: -1 1 ge 1 ---> Inequality is: -1 x1
+ 1 x2
≥
1
line 4: -3 2 le 7 ---> Inequality is: -3 x1
+ 2 x2
≤
7
line 5: 2 1 ge 7 ---> Inequality is: 2 x1
+ 1 x2
≥
7
line 6: minimize -2 5 ---> set Minimize:
-2 x1
+ 5 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 |
s5 |
z |
|
s1 |
1 |
2 |
1 |
0 |
0 |
0 |
0 |
0 |
26 |
s2 |
-2 |
3 |
0 |
1 |
0 |
0 |
0 |
0 |
18 |
s3 |
1 |
-1 |
0 |
0 |
1 |
0 |
0 |
0 |
-1 |
s4 |
-3 |
2 |
0 |
0 |
0 |
1 |
0 |
0 |
7 |
s5 |
-2 |
-1 |
0 |
0 |
0 |
0 |
1 |
0 |
-7 |
|
-2 |
5 |
0 |
0 |
0 |
0 |
0 |
1 |
0 |
Preprocessing
There is at least one negative value in the
last column (excluding the final row). Therefore we need to start the
preprocessing algorithm.
The lowest negative value in the last column is -7 and
that is in row 5. Therefore, make row 5 the work row.
|
x1 |
x2 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
s1 |
1 |
2 |
1 |
0 |
0 |
0 |
0 |
0 |
26 |
s2 |
-2 |
3 |
0 |
1 |
0 |
0 |
0 |
0 |
18 |
s3 |
1 |
-1 |
0 |
0 |
1 |
0 |
0 |
0 |
-1 |
s4 |
-3 |
2 |
0 |
0 |
0 |
1 |
0 |
0 |
7 |
s5 |
-2 |
-1 |
0 |
0 |
0 |
0 |
1 |
0 |
-7 |
|
-2 |
5 |
0 |
0 |
0 |
0 |
0 |
1 |
0 |
The lowest negative value in row 5 is -2 and
that is in column 1. Therefore, make column 1 the work column.
That makes the item in row 5 and column 1 the pivot item.
|
x1 |
x2 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
s1 |
1 |
2 |
1 |
0 |
0 |
0 |
0 |
0 |
26 |
s2 |
-2 |
3 |
0 |
1 |
0 |
0 |
0 |
0 |
18 |
s3 |
1 |
-1 |
0 |
0 |
1 |
0 |
0 |
0 |
-1 |
s4 |
-3 |
2 |
0 |
0 |
0 |
1 |
0 |
0 |
7 |
s5 |
-2 |
-1 |
0 |
0 |
0 |
0 |
1 |
0 |
-7 |
|
-2 |
5 |
0 |
0 |
0 |
0 |
0 |
1 |
0 |
Use the elementary row operation *row to change the
pivot item to be 1. That is, multiply row 5 by
-1 / 2.
|
x1 |
x2 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
s1 |
1 |
2 |
1 |
0 |
0 |
0 |
0 |
0 |
26 |
s2 |
-2 |
3 |
0 |
1 |
0 |
0 |
0 |
0 |
18 |
s3 |
1 |
-1 |
0 |
0 |
1 |
0 |
0 |
0 |
-1 |
s4 |
-3 |
2 |
0 |
0 |
0 |
1 |
0 |
0 |
7 |
s5 |
1 |
1/2 |
0 |
0 |
0 |
0 |
-1/2 |
0 |
7/2 |
|
-2 |
5 |
0 |
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 5 by -1 and add to row 1.
- multiply row 5 by +2 and add to row 2.
- multiply row 5 by -1 and add to row 3.
- multiply row 5 by +3 and add to row 4.
- multiply row 5 by +2 and add to row 6.
|
x1 |
x2 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
s1 |
0 |
3/2 |
1 |
0 |
0 |
0 |
1/2 |
0 |
45/2 |
s2 |
0 |
4 |
0 |
1 |
0 |
0 |
-1 |
0 |
25 |
s3 |
0 |
-3/2 |
0 |
0 |
1 |
0 |
1/2 |
0 |
-9/2 |
s4 |
0 |
7/2 |
0 |
0 |
0 |
1 |
-3/2 |
0 |
35/2 |
s5 |
1 |
1/2 |
0 |
0 |
0 |
0 |
-1/2 |
0 |
7/2 |
|
0 |
6 |
0 |
0 |
0 |
0 |
-1 |
1 |
7 |
Now we need to copy the heading for the work column (column 1) to the
heading for the work row (row 5).
|
x1 |
x2 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
s1 |
0 |
3/2 |
1 |
0 |
0 |
0 |
1/2 |
0 |
45/2 |
s2 |
0 |
4 |
0 |
1 |
0 |
0 |
-1 |
0 |
25 |
s3 |
0 |
-3/2 |
0 |
0 |
1 |
0 |
1/2 |
0 |
-9/2 |
s4 |
0 |
7/2 |
0 |
0 |
0 |
1 |
-3/2 |
0 |
35/2 |
x1 |
1 |
1/2 |
0 |
0 |
0 |
0 |
-1/2 |
0 |
7/2 |
|
0 |
6 |
0 |
0 |
0 |
0 |
-1 |
1 |
7 |
Having finished the steps of the preprocessing routine, we need
to see if there are any remaining negative values in the final
column. If so, then we restart the preprocessing steps.
The lowest negative value in the last column is -9 / 2 = -4.5 and
that is in row 3. Therefore, make row 3 the work row.
|
x1 |
x2 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
s1 |
0 |
3/2 |
1 |
0 |
0 |
0 |
1/2 |
0 |
45/2 |
s2 |
0 |
4 |
0 |
1 |
0 |
0 |
-1 |
0 |
25 |
s3 |
0 |
-3/2 |
0 |
0 |
1 |
0 |
1/2 |
0 |
-9/2 |
s4 |
0 |
7/2 |
0 |
0 |
0 |
1 |
-3/2 |
0 |
35/2 |
x1 |
1 |
1/2 |
0 |
0 |
0 |
0 |
-1/2 |
0 |
7/2 |
|
0 |
6 |
0 |
0 |
0 |
0 |
-1 |
1 |
7 |
The lowest negative value in row 3 is -3 / 2 = -1.5 and
that is in column 2. Therefore, make column 2 the work column.
That makes the item in row 3 and column 2 the pivot item.
|
x1 |
x2 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
s1 |
0 |
3/2 |
1 |
0 |
0 |
0 |
1/2 |
0 |
45/2 |
s2 |
0 |
4 |
0 |
1 |
0 |
0 |
-1 |
0 |
25 |
s3 |
0 |
-3/2 |
0 |
0 |
1 |
0 |
1/2 |
0 |
-9/2 |
s4 |
0 |
7/2 |
0 |
0 |
0 |
1 |
-3/2 |
0 |
35/2 |
x1 |
1 |
1/2 |
0 |
0 |
0 |
0 |
-1/2 |
0 |
7/2 |
|
0 |
6 |
0 |
0 |
0 |
0 |
-1 |
1 |
7 |
Use the elementary row operation *row to change the
pivot item to be 1. That is, multiply row 3 by
-2 / 3.
|
x1 |
x2 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
s1 |
0 |
3/2 |
1 |
0 |
0 |
0 |
1/2 |
0 |
45/2 |
s2 |
0 |
4 |
0 |
1 |
0 |
0 |
-1 |
0 |
25 |
s3 |
0 |
1 |
0 |
0 |
-2/3 |
0 |
-1/3 |
0 |
3 |
s4 |
0 |
7/2 |
0 |
0 |
0 |
1 |
-3/2 |
0 |
35/2 |
x1 |
1 |
1/2 |
0 |
0 |
0 |
0 |
-1/2 |
0 |
7/2 |
|
0 |
6 |
0 |
0 |
0 |
0 |
-1 |
1 |
7 |
Now use the elementary row operation *row+ to change the
other items in column 2 to 0.
- multiply row 3 by -3 / 2
and add to row 1.
- multiply row 3 by -4 and add to row 2.
- multiply row 3 by -7 / 2
and add to row 4.
- multiply row 3 by -1 / 2
and add to row 5.
- multiply row 3 by -6 and add to row 6.
|
x1 |
x2 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
s1 |
0 |
0 |
1 |
0 |
1 |
0 |
1 |
0 |
18 |
s2 |
0 |
0 |
0 |
1 |
8/3 |
0 |
1/3 |
0 |
13 |
s3 |
0 |
1 |
0 |
0 |
-2/3 |
0 |
-1/3 |
0 |
3 |
s4 |
0 |
0 |
0 |
0 |
7/3 |
1 |
-1/3 |
0 |
7 |
x1 |
1 |
0 |
0 |
0 |
1/3 |
0 |
-1/3 |
0 |
2 |
|
0 |
0 |
0 |
0 |
4 |
0 |
1 |
1 |
-11 |
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 |
s5 |
z |
|
s1 |
0 |
0 |
1 |
0 |
1 |
0 |
1 |
0 |
18 |
s2 |
0 |
0 |
0 |
1 |
8/3 |
0 |
1/3 |
0 |
13 |
x2 |
0 |
1 |
0 |
0 |
-2/3 |
0 |
-1/3 |
0 |
3 |
s4 |
0 |
0 |
0 |
0 |
7/3 |
1 |
-1/3 |
0 |
7 |
x1 |
1 |
0 |
0 |
0 |
1/3 |
0 |
-1/3 |
0 |
2 |
|
0 |
0 |
0 |
0 |
4 |
0 |
1 |
1 |
-11 |
Having finished the steps of the preprocessing routine, we need
to see if there are any remaining negative values in the final
column. If so, then we restart the preprocessing steps.
There are no more negative values is the final column.
Therefore, preprocessing is done...
Regular Processing
Nothing to be done since there are no negative values in
the last row, excluding the final column.
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 = 18
- s2 = 13
- x2 = 3
- s4 = 7
- x1 = 2
the objective function has a
Minimum = 11
©Roger M. Palay Saline, MI 48176 October, 2010