Linear Programming Problem -- a walk through
Reading the data file: lp_demo_03.txt
Number of variables set to 2
line 1: -2 1 le 3 ---> Inequality is: -2 x1
+ 1 x2
≤
3
line 2: -1 1 le 5 ---> Inequality is: -1 x1
+ 1 x2
≤
5
line 3: 3 1 le 43 ---> Inequality is: 3 x1
+ 1 x2
≤
43
line 4: -1 3 le 27 ---> Inequality is: -1 x1
+ 3 x2
≤
27
line 5: 1 1 le 21 ---> Inequality is: 1 x1
+ 1 x2
≤
21
line 6: maximize -3 15 ---> set Maximize:
-3 x1
+ 15 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 |
-2 |
1 |
1 |
0 |
0 |
0 |
0 |
0 |
3 |
s2 |
-1 |
1 |
0 |
1 |
0 |
0 |
0 |
0 |
5 |
s3 |
3 |
1 |
0 |
0 |
1 |
0 |
0 |
0 |
43 |
s4 |
-1 |
3 |
0 |
0 |
0 |
1 |
0 |
0 |
27 |
s5 |
1 |
1 |
0 |
0 |
0 |
0 |
1 |
0 |
21 |
|
3 |
-15 |
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 -15 and
that is in column 2. So make column 2 the work column.
|
x1 |
x2 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
s1 |
-2 |
1 |
1 |
0 |
0 |
0 |
0 |
0 |
3 |
s2 |
-1 |
1 |
0 |
1 |
0 |
0 |
0 |
0 |
5 |
s3 |
3 |
1 |
0 |
0 |
1 |
0 |
0 |
0 |
43 |
s4 |
-1 |
3 |
0 |
0 |
0 |
1 |
0 |
0 |
27 |
s5 |
1 |
1 |
0 |
0 |
0 |
0 |
1 |
0 |
21 |
|
3 |
-15 |
0 |
0 |
0 |
0 |
0 |
1 |
0 |
The lowest ratio between positive values in column 2 and corresponding values in the the final column is 3 and
that is in row 1. So make row 1 the work row.
That makes the item in row 1 and column 2 the pivot item.
|
x1 |
x2 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
s1 |
-2 |
1 |
1 |
0 |
0 |
0 |
0 |
0 |
3 |
s2 |
-1 |
1 |
0 |
1 |
0 |
0 |
0 |
0 |
5 |
s3 |
3 |
1 |
0 |
0 |
1 |
0 |
0 |
0 |
43 |
s4 |
-1 |
3 |
0 |
0 |
0 |
1 |
0 |
0 |
27 |
s5 |
1 |
1 |
0 |
0 |
0 |
0 |
1 |
0 |
21 |
|
3 |
-15 |
0 |
0 |
0 |
0 |
0 |
1 |
0 |
Since this is alread the value 1 we need not change it.
Now use the elementary row operation *row+ to change the
other items in column 2 to 0.
- multiply row 1 by -1 and add to row 2.
- multiply row 1 by -1 and add to row 3.
- multiply row 1 by -3 and add to row 4.
- multiply row 1 by -1 and add to row 5.
- multiply row 1 by 15 and add to row 6.
|
x1 |
x2 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
s1 |
-2 |
1 |
1 |
0 |
0 |
0 |
0 |
0 |
3 |
s2 |
1 |
0 |
-1 |
1 |
0 |
0 |
0 |
0 |
2 |
s3 |
5 |
0 |
-1 |
0 |
1 |
0 |
0 |
0 |
40 |
s4 |
5 |
0 |
-3 |
0 |
0 |
1 |
0 |
0 |
18 |
s5 |
3 |
0 |
-1 |
0 |
0 |
0 |
1 |
0 |
18 |
|
-27 |
0 |
15 |
0 |
0 |
0 |
0 |
1 |
45 |
Now we need to copy the heading for the work column (column 2) to the
heading for the work row (row 1).
|
x1 |
x2 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
x2 |
-2 |
1 |
1 |
0 |
0 |
0 |
0 |
0 |
3 |
s2 |
1 |
0 |
-1 |
1 |
0 |
0 |
0 |
0 |
2 |
s3 |
5 |
0 |
-1 |
0 |
1 |
0 |
0 |
0 |
40 |
s4 |
5 |
0 |
-3 |
0 |
0 |
1 |
0 |
0 |
18 |
s5 |
3 |
0 |
-1 |
0 |
0 |
0 |
1 |
0 |
18 |
|
-27 |
0 |
15 |
0 |
0 |
0 |
0 |
1 |
45 |
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 -27 and
that is in column 1. So make column 1 the work column.
|
x1 |
x2 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
x2 |
-2 |
1 |
1 |
0 |
0 |
0 |
0 |
0 |
3 |
s2 |
1 |
0 |
-1 |
1 |
0 |
0 |
0 |
0 |
2 |
s3 |
5 |
0 |
-1 |
0 |
1 |
0 |
0 |
0 |
40 |
s4 |
5 |
0 |
-3 |
0 |
0 |
1 |
0 |
0 |
18 |
s5 |
3 |
0 |
-1 |
0 |
0 |
0 |
1 |
0 |
18 |
|
-27 |
0 |
15 |
0 |
0 |
0 |
0 |
1 |
45 |
The lowest ratio between positive values in column 1 and corresponding values in the the final column is 2 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 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
x2 |
-2 |
1 |
1 |
0 |
0 |
0 |
0 |
0 |
3 |
s2 |
1 |
0 |
-1 |
1 |
0 |
0 |
0 |
0 |
2 |
s3 |
5 |
0 |
-1 |
0 |
1 |
0 |
0 |
0 |
40 |
s4 |
5 |
0 |
-3 |
0 |
0 |
1 |
0 |
0 |
18 |
s5 |
3 |
0 |
-1 |
0 |
0 |
0 |
1 |
0 |
18 |
|
-27 |
0 |
15 |
0 |
0 |
0 |
0 |
1 |
45 |
Since this is alread the value 1 we need not change it.
Now use the elementary row operation *row+ to change the
other items in column 1 to 0.
- multiply row 2 by 2 and add to row 1.
- multiply row 2 by -5 and add to row 3.
- multiply row 2 by -5 and add to row 4.
- multiply row 2 by -3 and add to row 5.
- multiply row 2 by 27 and add to row 6.
|
x1 |
x2 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
x2 |
0 |
1 |
-1 |
2 |
0 |
0 |
0 |
0 |
7 |
s2 |
1 |
0 |
-1 |
1 |
0 |
0 |
0 |
0 |
2 |
s3 |
0 |
0 |
4 |
-5 |
1 |
0 |
0 |
0 |
30 |
s4 |
0 |
0 |
2 |
-5 |
0 |
1 |
0 |
0 |
8 |
s5 |
0 |
0 |
2 |
-3 |
0 |
0 |
1 |
0 |
12 |
|
0 |
0 |
-12 |
27 |
0 |
0 |
0 |
1 |
99 |
Now we need to copy the heading for the work column (column 1) to the
heading for the work row (row 2).
|
x1 |
x2 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
x2 |
0 |
1 |
-1 |
2 |
0 |
0 |
0 |
0 |
7 |
x1 |
1 |
0 |
-1 |
1 |
0 |
0 |
0 |
0 |
2 |
s3 |
0 |
0 |
4 |
-5 |
1 |
0 |
0 |
0 |
30 |
s4 |
0 |
0 |
2 |
-5 |
0 |
1 |
0 |
0 |
8 |
s5 |
0 |
0 |
2 |
-3 |
0 |
0 |
1 |
0 |
12 |
|
0 |
0 |
-12 |
27 |
0 |
0 |
0 |
1 |
99 |
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 3. So make column 3 the work column.
|
x1 |
x2 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
x2 |
0 |
1 |
-1 |
2 |
0 |
0 |
0 |
0 |
7 |
x1 |
1 |
0 |
-1 |
1 |
0 |
0 |
0 |
0 |
2 |
s3 |
0 |
0 |
4 |
-5 |
1 |
0 |
0 |
0 |
30 |
s4 |
0 |
0 |
2 |
-5 |
0 |
1 |
0 |
0 |
8 |
s5 |
0 |
0 |
2 |
-3 |
0 |
0 |
1 |
0 |
12 |
|
0 |
0 |
-12 |
27 |
0 |
0 |
0 |
1 |
99 |
The lowest ratio between positive values in column 3 and corresponding values in the the final column is 4 and
that is in row 4. So make row 4 the work row.
That makes the item in row 4 and column 3 the pivot item.
|
x1 |
x2 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
x2 |
0 |
1 |
-1 |
2 |
0 |
0 |
0 |
0 |
7 |
x1 |
1 |
0 |
-1 |
1 |
0 |
0 |
0 |
0 |
2 |
s3 |
0 |
0 |
4 |
-5 |
1 |
0 |
0 |
0 |
30 |
s4 |
0 |
0 |
2 |
-5 |
0 |
1 |
0 |
0 |
8 |
s5 |
0 |
0 |
2 |
-3 |
0 |
0 |
1 |
0 |
12 |
|
0 |
0 |
-12 |
27 |
0 |
0 |
0 |
1 |
99 |
Use the elementary row operation *row to change the
pivot item to be 1. That is, multiply row 4 by
1 / 2.
|
x1 |
x2 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
x2 |
0 |
1 |
-1 |
2 |
0 |
0 |
0 |
0 |
7 |
x1 |
1 |
0 |
-1 |
1 |
0 |
0 |
0 |
0 |
2 |
s3 |
0 |
0 |
4 |
-5 |
1 |
0 |
0 |
0 |
30 |
s4 |
0 |
0 |
1 |
-5/2 |
0 |
1/2 |
0 |
0 |
4 |
s5 |
0 |
0 |
2 |
-3 |
0 |
0 |
1 |
0 |
12 |
|
0 |
0 |
-12 |
27 |
0 |
0 |
0 |
1 |
99 |
Now use the elementary row operation *row+ to change the
other items in column 3 to 0.
- multiply row 4 by 1 and add to row 1.
- multiply row 4 by 1 and add to row 2.
- multiply row 4 by -4 and add to row 3.
- multiply row 4 by -2 and add to row 5.
- multiply row 4 by 12 and add to row 6.
|
x1 |
x2 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
x2 |
0 |
1 |
0 |
-1/2 |
0 |
1/2 |
0 |
0 |
11 |
x1 |
1 |
0 |
0 |
-3/2 |
0 |
1/2 |
0 |
0 |
6 |
s3 |
0 |
0 |
0 |
5 |
1 |
-2 |
0 |
0 |
14 |
s4 |
0 |
0 |
1 |
-5/2 |
0 |
1/2 |
0 |
0 |
4 |
s5 |
0 |
0 |
0 |
2 |
0 |
-1 |
1 |
0 |
4 |
|
0 |
0 |
0 |
-3 |
0 |
6 |
0 |
1 |
147 |
Now we need to copy the heading for the work column (column 3) to the
heading for the work row (row 4).
|
x1 |
x2 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
x2 |
0 |
1 |
0 |
-1/2 |
0 |
1/2 |
0 |
0 |
11 |
x1 |
1 |
0 |
0 |
-3/2 |
0 |
1/2 |
0 |
0 |
6 |
s3 |
0 |
0 |
0 |
5 |
1 |
-2 |
0 |
0 |
14 |
s1 |
0 |
0 |
1 |
-5/2 |
0 |
1/2 |
0 |
0 |
4 |
s5 |
0 |
0 |
0 |
2 |
0 |
-1 |
1 |
0 |
4 |
|
0 |
0 |
0 |
-3 |
0 |
6 |
0 |
1 |
147 |
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 -3 and
that is in column 4. So make column 4 the work column.
|
x1 |
x2 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
x2 |
0 |
1 |
0 |
-1/2 |
0 |
1/2 |
0 |
0 |
11 |
x1 |
1 |
0 |
0 |
-3/2 |
0 |
1/2 |
0 |
0 |
6 |
s3 |
0 |
0 |
0 |
5 |
1 |
-2 |
0 |
0 |
14 |
s1 |
0 |
0 |
1 |
-5/2 |
0 |
1/2 |
0 |
0 |
4 |
s5 |
0 |
0 |
0 |
2 |
0 |
-1 |
1 |
0 |
4 |
|
0 |
0 |
0 |
-3 |
0 |
6 |
0 |
1 |
147 |
The lowest ratio between positive values in column 4 and corresponding values in the the final column is 2 and
that is in row 5. So make row 5 the work row.
That makes the item in row 5 and column 4 the pivot item.
|
x1 |
x2 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
x2 |
0 |
1 |
0 |
-1/2 |
0 |
1/2 |
0 |
0 |
11 |
x1 |
1 |
0 |
0 |
-3/2 |
0 |
1/2 |
0 |
0 |
6 |
s3 |
0 |
0 |
0 |
5 |
1 |
-2 |
0 |
0 |
14 |
s1 |
0 |
0 |
1 |
-5/2 |
0 |
1/2 |
0 |
0 |
4 |
s5 |
0 |
0 |
0 |
2 |
0 |
-1 |
1 |
0 |
4 |
|
0 |
0 |
0 |
-3 |
0 |
6 |
0 |
1 |
147 |
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 |
|
x2 |
0 |
1 |
0 |
-1/2 |
0 |
1/2 |
0 |
0 |
11 |
x1 |
1 |
0 |
0 |
-3/2 |
0 |
1/2 |
0 |
0 |
6 |
s3 |
0 |
0 |
0 |
5 |
1 |
-2 |
0 |
0 |
14 |
s1 |
0 |
0 |
1 |
-5/2 |
0 |
1/2 |
0 |
0 |
4 |
s5 |
0 |
0 |
0 |
1 |
0 |
-1/2 |
1/2 |
0 |
2 |
|
0 |
0 |
0 |
-3 |
0 |
6 |
0 |
1 |
147 |
Now use the elementary row operation *row+ to change the
other items in column 4 to 0.
- multiply row 5 by 1 / 2
and add to row 1.
- multiply row 5 by 3 / 2
and add to row 2.
- multiply row 5 by -5 and add to row 3.
- multiply row 5 by 5 / 2
and add to row 4.
- multiply row 5 by 3 and add to row 6.
|
x1 |
x2 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
x2 |
0 |
1 |
0 |
0 |
0 |
1/4 |
1/4 |
0 |
12 |
x1 |
1 |
0 |
0 |
0 |
0 |
-1/4 |
3/4 |
0 |
9 |
s3 |
0 |
0 |
0 |
0 |
1 |
1/2 |
-5/2 |
0 |
4 |
s1 |
0 |
0 |
1 |
0 |
0 |
-3/4 |
5/4 |
0 |
9 |
s5 |
0 |
0 |
0 |
1 |
0 |
-1/2 |
1/2 |
0 |
2 |
|
0 |
0 |
0 |
0 |
0 |
9/2 |
3/2 |
1 |
153 |
Now we need to copy the heading for the work column (column 4) to the
heading for the work row (row 5).
|
x1 |
x2 |
s1 |
s2 |
s3 |
s4 |
s5 |
z |
|
x2 |
0 |
1 |
0 |
0 |
0 |
1/4 |
1/4 |
0 |
12 |
x1 |
1 |
0 |
0 |
0 |
0 |
-1/4 |
3/4 |
0 |
9 |
s3 |
0 |
0 |
0 |
0 |
1 |
1/2 |
-5/2 |
0 |
4 |
s1 |
0 |
0 |
1 |
0 |
0 |
-3/4 |
5/4 |
0 |
9 |
s2 |
0 |
0 |
0 |
1 |
0 |
-1/2 |
1/2 |
0 |
2 |
|
0 |
0 |
0 |
0 |
0 |
9/2 |
3/2 |
1 |
153 |
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
- x2 = 12
- x1 = 9
- s3 = 4
- s1 = 9
- s2 = 2
the objective function has a
Maximum = 153
©Roger M. Palay Saline, MI 48176 October, 2010