Linear Programming Problem -- a walk through
Reading the data file: lp_demo_09.txt
Number of variables set to 3
line 1: 2 3 4 le 72 ---> Inequality is: 2 x1
+ 3 x2
+ 4 x3
≤
72
line 2: 2 3 8 le 96 ---> Inequality is: 2 x1
+ 3 x2
+ 8 x3
≤
96
line 3: 1 6 10 le 120 ---> Inequality is: 1 x1
+ 6 x2
+ 10 x3
≤
120
line 4: 6 3 20 le 240 ---> Inequality is: 6 x1
+ 3 x2
+ 20 x3
≤
240
line 5: 2 3 24 le 240 ---> Inequality is: 2 x1
+ 3 x2
+ 24 x3
≤
240
line 6: maximize 10 15 24 ---> set Maximize:
10 x1
+ 15 x2
+ 24 x3
Create the Initial Tableau
After reconfiguring the objective function and converting any '≥' constraints
to a '≤' form, we can produce the following tableau:
|
x1 |
x2 |
x3 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
s1 |
2 |
3 |
4 |
1 |
0 |
0 |
0 |
0 |
0 |
72 |
s2 |
2 |
3 |
8 |
0 |
1 |
0 |
0 |
0 |
0 |
96 |
s3 |
1 |
6 |
10 |
0 |
0 |
1 |
0 |
0 |
0 |
120 |
s4 |
6 |
3 |
20 |
0 |
0 |
0 |
1 |
0 |
0 |
240 |
s5 |
2 |
3 |
24 |
0 |
0 |
0 |
0 |
1 |
0 |
240 |
|
-10 |
-15 |
-24 |
0 |
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 -24 and
that is in column 3. So make column 3 the work column.
|
x1 |
x2 |
x3 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
s1 |
2 |
3 |
4 |
1 |
0 |
0 |
0 |
0 |
0 |
72 |
s2 |
2 |
3 |
8 |
0 |
1 |
0 |
0 |
0 |
0 |
96 |
s3 |
1 |
6 |
10 |
0 |
0 |
1 |
0 |
0 |
0 |
120 |
s4 |
6 |
3 |
20 |
0 |
0 |
0 |
1 |
0 |
0 |
240 |
s5 |
2 |
3 |
24 |
0 |
0 |
0 |
0 |
1 |
0 |
240 |
|
-10 |
-15 |
-24 |
0 |
0 |
0 |
0 |
0 |
1 |
0 |
The lowest ratio between positive values in column 3 and corresponding values in the the final column is 10 and
that is in row 5. So make row 5 the work row.
That makes the item in row 5 and column 3 the pivot item.
|
x1 |
x2 |
x3 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
s1 |
2 |
3 |
4 |
1 |
0 |
0 |
0 |
0 |
0 |
72 |
s2 |
2 |
3 |
8 |
0 |
1 |
0 |
0 |
0 |
0 |
96 |
s3 |
1 |
6 |
10 |
0 |
0 |
1 |
0 |
0 |
0 |
120 |
s4 |
6 |
3 |
20 |
0 |
0 |
0 |
1 |
0 |
0 |
240 |
s5 |
2 |
3 |
24 |
0 |
0 |
0 |
0 |
1 |
0 |
240 |
|
-10 |
-15 |
-24 |
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 / 24.
|
x1 |
x2 |
x3 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
s1 |
2 |
3 |
4 |
1 |
0 |
0 |
0 |
0 |
0 |
72 |
s2 |
2 |
3 |
8 |
0 |
1 |
0 |
0 |
0 |
0 |
96 |
s3 |
1 |
6 |
10 |
0 |
0 |
1 |
0 |
0 |
0 |
120 |
s4 |
6 |
3 |
20 |
0 |
0 |
0 |
1 |
0 |
0 |
240 |
s5 |
1/12 |
1/8 |
1 |
0 |
0 |
0 |
0 |
1/24 |
0 |
10 |
|
-10 |
-15 |
-24 |
0 |
0 |
0 |
0 |
0 |
1 |
0 |
Now use the elementary row operation *row+ to change the
other items in column 3 to 0.
- multiply row 5 by -4 and add to row 1.
- multiply row 5 by -8 and add to row 2.
- multiply row 5 by -10 and add to row 3.
- multiply row 5 by -20 and add to row 4.
- multiply row 5 by 24 and add to row 6.
|
x1 |
x2 |
x3 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
s1 |
5/3 |
5/2 |
0 |
1 |
0 |
0 |
0 |
-1/6 |
0 |
32 |
s2 |
4/3 |
2 |
0 |
0 |
1 |
0 |
0 |
-1/3 |
0 |
16 |
s3 |
1/6 |
19/4 |
0 |
0 |
0 |
1 |
0 |
-5/12 |
0 |
20 |
s4 |
13/3 |
1/2 |
0 |
0 |
0 |
0 |
1 |
-5/6 |
0 |
40 |
s5 |
1/12 |
1/8 |
1 |
0 |
0 |
0 |
0 |
1/24 |
0 |
10 |
|
-8 |
-12 |
0 |
0 |
0 |
0 |
0 |
1 |
1 |
240 |
Now we need to copy the heading for the work column (column 3) to the
heading for the work row (row 5).
|
x1 |
x2 |
x3 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
s1 |
5/3 |
5/2 |
0 |
1 |
0 |
0 |
0 |
-1/6 |
0 |
32 |
s2 |
4/3 |
2 |
0 |
0 |
1 |
0 |
0 |
-1/3 |
0 |
16 |
s3 |
1/6 |
19/4 |
0 |
0 |
0 |
1 |
0 |
-5/12 |
0 |
20 |
s4 |
13/3 |
1/2 |
0 |
0 |
0 |
0 |
1 |
-5/6 |
0 |
40 |
x3 |
1/12 |
1/8 |
1 |
0 |
0 |
0 |
0 |
1/24 |
0 |
10 |
|
-8 |
-12 |
0 |
0 |
0 |
0 |
0 |
1 |
1 |
240 |
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 -12 and
that is in column 2. So make column 2 the work column.
|
x1 |
x2 |
x3 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
s1 |
5/3 |
5/2 |
0 |
1 |
0 |
0 |
0 |
-1/6 |
0 |
32 |
s2 |
4/3 |
2 |
0 |
0 |
1 |
0 |
0 |
-1/3 |
0 |
16 |
s3 |
1/6 |
19/4 |
0 |
0 |
0 |
1 |
0 |
-5/12 |
0 |
20 |
s4 |
13/3 |
1/2 |
0 |
0 |
0 |
0 |
1 |
-5/6 |
0 |
40 |
x3 |
1/12 |
1/8 |
1 |
0 |
0 |
0 |
0 |
1/24 |
0 |
10 |
|
-8 |
-12 |
0 |
0 |
0 |
0 |
0 |
1 |
1 |
240 |
The lowest ratio between positive values in column 2 and corresponding values in the the final column is 4.21052631578947 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 |
x3 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
s1 |
5/3 |
5/2 |
0 |
1 |
0 |
0 |
0 |
-1/6 |
0 |
32 |
s2 |
4/3 |
2 |
0 |
0 |
1 |
0 |
0 |
-1/3 |
0 |
16 |
s3 |
1/6 |
19/4 |
0 |
0 |
0 |
1 |
0 |
-5/12 |
0 |
20 |
s4 |
13/3 |
1/2 |
0 |
0 |
0 |
0 |
1 |
-5/6 |
0 |
40 |
x3 |
1/12 |
1/8 |
1 |
0 |
0 |
0 |
0 |
1/24 |
0 |
10 |
|
-8 |
-12 |
0 |
0 |
0 |
0 |
0 |
1 |
1 |
240 |
Use the elementary row operation *row to change the
pivot item to be 1. That is, multiply row 3 by
4 / 19.
|
x1 |
x2 |
x3 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
s1 |
5/3 |
5/2 |
0 |
1 |
0 |
0 |
0 |
-1/6 |
0 |
32 |
s2 |
4/3 |
2 |
0 |
0 |
1 |
0 |
0 |
-1/3 |
0 |
16 |
s3 |
2/57 |
1 |
0 |
0 |
0 |
4/19 |
0 |
-5/57 |
0 |
80/19 |
s4 |
13/3 |
1/2 |
0 |
0 |
0 |
0 |
1 |
-5/6 |
0 |
40 |
x3 |
1/12 |
1/8 |
1 |
0 |
0 |
0 |
0 |
1/24 |
0 |
10 |
|
-8 |
-12 |
0 |
0 |
0 |
0 |
0 |
1 |
1 |
240 |
Now use the elementary row operation *row+ to change the
other items in column 2 to 0.
- multiply row 3 by -5 / 2
and add to row 1.
- multiply row 3 by -2 and add to row 2.
- multiply row 3 by -1 / 2
and add to row 4.
- multiply row 3 by -1 / 8
and add to row 5.
- multiply row 3 by 12 and add to row 6.
|
x1 |
x2 |
x3 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
s1 |
30/19 |
0 |
0 |
1 |
0 |
-10/19 |
0 |
1/19 |
0 |
408/19 |
s2 |
24/19 |
0 |
0 |
0 |
1 |
-8/19 |
0 |
-3/19 |
0 |
144/19 |
s3 |
2/57 |
1 |
0 |
0 |
0 |
4/19 |
0 |
-5/57 |
0 |
80/19 |
s4 |
82/19 |
0 |
0 |
0 |
0 |
-2/19 |
1 |
-15/19 |
0 |
720/19 |
x3 |
3/38 |
0 |
1 |
0 |
0 |
-1/38 |
0 |
1/19 |
0 |
180/19 |
|
-144/19 |
0 |
0 |
0 |
0 |
48/19 |
0 |
-1/19 |
1 |
5520/19 |
Now we need to copy the heading for the work column (column 2) to the
heading for the work row (row 3).
|
x1 |
x2 |
x3 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
s1 |
30/19 |
0 |
0 |
1 |
0 |
-10/19 |
0 |
1/19 |
0 |
408/19 |
s2 |
24/19 |
0 |
0 |
0 |
1 |
-8/19 |
0 |
-3/19 |
0 |
144/19 |
x2 |
2/57 |
1 |
0 |
0 |
0 |
4/19 |
0 |
-5/57 |
0 |
80/19 |
s4 |
82/19 |
0 |
0 |
0 |
0 |
-2/19 |
1 |
-15/19 |
0 |
720/19 |
x3 |
3/38 |
0 |
1 |
0 |
0 |
-1/38 |
0 |
1/19 |
0 |
180/19 |
|
-144/19 |
0 |
0 |
0 |
0 |
48/19 |
0 |
-1/19 |
1 |
5520/19 |
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 -144 / 19 = -7.57894736842105 and
that is in column 1. So make column 1 the work column.
|
x1 |
x2 |
x3 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
s1 |
30/19 |
0 |
0 |
1 |
0 |
-10/19 |
0 |
1/19 |
0 |
408/19 |
s2 |
24/19 |
0 |
0 |
0 |
1 |
-8/19 |
0 |
-3/19 |
0 |
144/19 |
x2 |
2/57 |
1 |
0 |
0 |
0 |
4/19 |
0 |
-5/57 |
0 |
80/19 |
s4 |
82/19 |
0 |
0 |
0 |
0 |
-2/19 |
1 |
-15/19 |
0 |
720/19 |
x3 |
3/38 |
0 |
1 |
0 |
0 |
-1/38 |
0 |
1/19 |
0 |
180/19 |
|
-144/19 |
0 |
0 |
0 |
0 |
48/19 |
0 |
-1/19 |
1 |
5520/19 |
The lowest ratio between positive values in column 1 and corresponding values in the the final column is 6 and
that is in row 2. So make row 2 the work row.
That makes the item in row 2 and column 1 the pivot item.
|
x1 |
x2 |
x3 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
s1 |
30/19 |
0 |
0 |
1 |
0 |
-10/19 |
0 |
1/19 |
0 |
408/19 |
s2 |
24/19 |
0 |
0 |
0 |
1 |
-8/19 |
0 |
-3/19 |
0 |
144/19 |
x2 |
2/57 |
1 |
0 |
0 |
0 |
4/19 |
0 |
-5/57 |
0 |
80/19 |
s4 |
82/19 |
0 |
0 |
0 |
0 |
-2/19 |
1 |
-15/19 |
0 |
720/19 |
x3 |
3/38 |
0 |
1 |
0 |
0 |
-1/38 |
0 |
1/19 |
0 |
180/19 |
|
-144/19 |
0 |
0 |
0 |
0 |
48/19 |
0 |
-1/19 |
1 |
5520/19 |
Use the elementary row operation *row to change the
pivot item to be 1. That is, multiply row 2 by
19 / 24.
|
x1 |
x2 |
x3 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
s1 |
30/19 |
0 |
0 |
1 |
0 |
-10/19 |
0 |
1/19 |
0 |
408/19 |
s2 |
1 |
0 |
0 |
0 |
19/24 |
-1/3 |
0 |
-1/8 |
0 |
6 |
x2 |
2/57 |
1 |
0 |
0 |
0 |
4/19 |
0 |
-5/57 |
0 |
80/19 |
s4 |
82/19 |
0 |
0 |
0 |
0 |
-2/19 |
1 |
-15/19 |
0 |
720/19 |
x3 |
3/38 |
0 |
1 |
0 |
0 |
-1/38 |
0 |
1/19 |
0 |
180/19 |
|
-144/19 |
0 |
0 |
0 |
0 |
48/19 |
0 |
-1/19 |
1 |
5520/19 |
Now use the elementary row operation *row+ to change the
other items in column 1 to 0.
- multiply row 2 by -30 / 19
and add to row 1.
- multiply row 2 by -2 / 57
and add to row 3.
- multiply row 2 by -82 / 19
and add to row 4.
- multiply row 2 by -3 / 38
and add to row 5.
- multiply row 2 by 144 / 19
and add to row 6.
|
x1 |
x2 |
x3 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
s1 |
0 |
0 |
0 |
1 |
-5/4 |
0 |
0 |
1/4 |
0 |
12 |
s2 |
1 |
0 |
0 |
0 |
19/24 |
-1/3 |
0 |
-1/8 |
0 |
6 |
x2 |
0 |
1 |
0 |
0 |
-1/36 |
2/9 |
0 |
-1/12 |
0 |
4 |
s4 |
0 |
0 |
0 |
0 |
-41/12 |
4/3 |
1 |
-1/4 |
0 |
12 |
x3 |
0 |
0 |
1 |
0 |
-1/16 |
0 |
0 |
1/16 |
0 |
9 |
|
0 |
0 |
0 |
0 |
6 |
0 |
0 |
-1 |
1 |
336 |
Now we need to copy the heading for the work column (column 1) to the
heading for the work row (row 2).
|
x1 |
x2 |
x3 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
s1 |
0 |
0 |
0 |
1 |
-5/4 |
0 |
0 |
1/4 |
0 |
12 |
x1 |
1 |
0 |
0 |
0 |
19/24 |
-1/3 |
0 |
-1/8 |
0 |
6 |
x2 |
0 |
1 |
0 |
0 |
-1/36 |
2/9 |
0 |
-1/12 |
0 |
4 |
s4 |
0 |
0 |
0 |
0 |
-41/12 |
4/3 |
1 |
-1/4 |
0 |
12 |
x3 |
0 |
0 |
1 |
0 |
-1/16 |
0 |
0 |
1/16 |
0 |
9 |
|
0 |
0 |
0 |
0 |
6 |
0 |
0 |
-1 |
1 |
336 |
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 and
that is in column 8. So make column 8 the work column.
|
x1 |
x2 |
x3 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
s1 |
0 |
0 |
0 |
1 |
-5/4 |
0 |
0 |
1/4 |
0 |
12 |
x1 |
1 |
0 |
0 |
0 |
19/24 |
-1/3 |
0 |
-1/8 |
0 |
6 |
x2 |
0 |
1 |
0 |
0 |
-1/36 |
2/9 |
0 |
-1/12 |
0 |
4 |
s4 |
0 |
0 |
0 |
0 |
-41/12 |
4/3 |
1 |
-1/4 |
0 |
12 |
x3 |
0 |
0 |
1 |
0 |
-1/16 |
0 |
0 |
1/16 |
0 |
9 |
|
0 |
0 |
0 |
0 |
6 |
0 |
0 |
-1 |
1 |
336 |
The lowest ratio between positive values in column 8 and corresponding values in the the final column is 48 and
that is in row 1. So make row 1 the work row.
That makes the item in row 1 and column 8 the pivot item.
|
x1 |
x2 |
x3 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
s1 |
0 |
0 |
0 |
1 |
-5/4 |
0 |
0 |
1/4 |
0 |
12 |
x1 |
1 |
0 |
0 |
0 |
19/24 |
-1/3 |
0 |
-1/8 |
0 |
6 |
x2 |
0 |
1 |
0 |
0 |
-1/36 |
2/9 |
0 |
-1/12 |
0 |
4 |
s4 |
0 |
0 |
0 |
0 |
-41/12 |
4/3 |
1 |
-1/4 |
0 |
12 |
x3 |
0 |
0 |
1 |
0 |
-1/16 |
0 |
0 |
1/16 |
0 |
9 |
|
0 |
0 |
0 |
0 |
6 |
0 |
0 |
-1 |
1 |
336 |
Use the elementary row operation *row to change the
pivot item to be 1. That is, multiply row 1 by
4.
|
x1 |
x2 |
x3 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
s1 |
0 |
0 |
0 |
4 |
-5 |
0 |
0 |
1 |
0 |
48 |
x1 |
1 |
0 |
0 |
0 |
19/24 |
-1/3 |
0 |
-1/8 |
0 |
6 |
x2 |
0 |
1 |
0 |
0 |
-1/36 |
2/9 |
0 |
-1/12 |
0 |
4 |
s4 |
0 |
0 |
0 |
0 |
-41/12 |
4/3 |
1 |
-1/4 |
0 |
12 |
x3 |
0 |
0 |
1 |
0 |
-1/16 |
0 |
0 |
1/16 |
0 |
9 |
|
0 |
0 |
0 |
0 |
6 |
0 |
0 |
-1 |
1 |
336 |
Now use the elementary row operation *row+ to change the
other items in column 8 to 0.
- multiply row 1 by 1 / 8
and add to row 2.
- multiply row 1 by 1 / 12
and add to row 3.
- multiply row 1 by 1 / 4
and add to row 4.
- multiply row 1 by -1 / 16
and add to row 5.
- multiply row 1 by 1 and add to row 6.
|
x1 |
x2 |
x3 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
s1 |
0 |
0 |
0 |
4 |
-5 |
0 |
0 |
1 |
0 |
48 |
x1 |
1 |
0 |
0 |
1/2 |
1/6 |
-1/3 |
0 |
0 |
0 |
12 |
x2 |
0 |
1 |
0 |
1/3 |
-4/9 |
2/9 |
0 |
0 |
0 |
8 |
s4 |
0 |
0 |
0 |
1 |
-14/3 |
4/3 |
1 |
0 |
0 |
24 |
x3 |
0 |
0 |
1 |
-1/4 |
1/4 |
0 |
0 |
0 |
0 |
6 |
|
0 |
0 |
0 |
4 |
1 |
0 |
0 |
0 |
1 |
384 |
Now we need to copy the heading for the work column (column 8) to the
heading for the work row (row 1).
|
x1 |
x2 |
x3 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
s5 |
0 |
0 |
0 |
4 |
-5 |
0 |
0 |
1 |
0 |
48 |
x1 |
1 |
0 |
0 |
1/2 |
1/6 |
-1/3 |
0 |
0 |
0 |
12 |
x2 |
0 |
1 |
0 |
1/3 |
-4/9 |
2/9 |
0 |
0 |
0 |
8 |
s4 |
0 |
0 |
0 |
1 |
-14/3 |
4/3 |
1 |
0 |
0 |
24 |
x3 |
0 |
0 |
1 |
-1/4 |
1/4 |
0 |
0 |
0 |
0 |
6 |
|
0 |
0 |
0 |
4 |
1 |
0 |
0 |
0 |
1 |
384 |
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
- s5 = 48
- x1 = 12
- x2 = 8
- s4 = 24
- x3 = 6
the objective function has a
Maximum = 384
©Roger M. Palay Saline, MI 48176 October, 2010