Linear programming – Simplex Method
Niki holds two part-time jobs, Job I and Job II. She never wants to work more than
a total of 12 hours a week. She has determined that for every hour she works at Job
I, she needs 2 hours of preparation time, and for every hour she works at Job II,
she needs one hour of preparation time, and she cannot spend more than 16 hours
for preparation. If she makes sh40 an hour at Job I, and sh30 an hour at Job II,
how many hours should she work per week at each job to maximize her income?
Solution
In solving this problem, we will follow the algorithm listed above.
STEP 1. Set up the problem. Write the objective function and the constraints.
• x1 = The number of hours per week Niki will work at Job I and
• x2 = The number of hours per week Niki will work at Job II.
It is customary to choose the variable that is to be maximized as Z.
The problem is formulated as follows:
STEP 2. Convert the inequalities into equations. This is done by adding one
slack variable for each inequality.
For example to convert the inequality x1+x2≤12 into an equation, we add a non-
negative variable y1, and we get
x1+x2+y1=12
2x1+ x2≤16, we add a non-negative variable y2, and we get
2x1+ x2 + y2= 16
non-negative variables are also referred to as slack variables.
We rewrite the objective function Z=40x1+30x2 as
−40x1−30x2+Z=0
1
After adding the slack variables, our problem reads
Objective function: −40x1−30x2+Z=0
Subject to constraints: x1+x2+y1=12
2x1+x2+y2=16
x1≥0; x2≥0
STEP 3. Construct the initial simplex tableau. Each inequality constraint
appears in its own row. Write the objective function as the bottom row. the problem
can be summarised into an augmented matrix called the initial simplex tableau as
follows.
1(x1)+1(x2)+1(y1) + 0(y2)+0(Z)=12
2(x1)+1(x2)+0(y1) + 1(y2)+0(Z)=16
−40(x1)−30(x2)+ 0(y1) + 0(y2)+1(Z)=0
Here the vertical line separates the left-hand side of the equations from the right
side. The horizontal line separates the constraints from the objective function. The
right side of the equation is represented by the column C.
If we arbitrarily choose x1=0 and x2=0, we get: y1=12, y2=16, and Z=0
1(0)+1(0)+1(y1) + 0(y2)+0(Z)=12 …. 0+0+y1 +0 + 0 = 12, y1=12
2(0)+1(0)+0(y1) + 1(y2)+0(Z)=16…… 0+0+0 + y2 + 0 = 16, y2=16
−40(0)−30(0)+ 0(y1) + 0(y2)+1(Z)=0… 0+0+0+0+Z = 0, Z=0
The solution obtained by arbitrarily assigning values to some variables and then
solving for the remaining variables is called the basic solution associated with the
tableau. So the above solution is the basic solution associated with the initial simplex
tableau.
2
STEP 4. The most negative entry in the bottom row identifies the pivot
column.
The most negative entry in the bottom row is -40; therefore, the column 1 is
identified.
Question Why do we choose the most negative entry in the bottom row?
Answer The most negative entry in the bottom row represents the largest
coefficient in the objective function - the coefficient whose entry will increase the
value of the objective function the quickest.
STEP 5. Calculate the quotients. The smallest quotient identifies a row.
The element in the intersection of the column identified in step 4 and the
row identified in this step is identified as the pivot element.
Following the algorithm, in order to calculate the quotient, we divide the entries in
the far-right column by the entries in column 1, excluding the entry in the bottom
row.
The smallest of the two quotients, 12 and 8, is 8. Therefore row 2 is identified. The
intersection of column 1 and row 2 is the entry 2, which has been highlighted. This
is our pivot element.
3
STEP 6. Perform pivoting to make all other entries in this column zero.
Pivoting is a process of obtaining a 1 in the location of the pivot element, and then
making all other entries zeros in that column. So now our job is to make our pivot
element a 1 by dividing the entire second row by 2. The result follows.
To obtain a zero in the entry first above the pivot element, we multiply the second
row by -1 and add it to row 1. We get
To obtain a zero in the element below the pivot, we multiply the second row by 40
and add it to the last row.
STEP 7. When there are no more negative entries in the bottom row, we
are finished; otherwise, we start again from step 4.
Since there is still a negative entry, -10, in the bottom row, we need to begin, again,
from step 4. we will identify the column and row that give us the pivot element, and
highlight the pivot element. The result is as follows.
We make the pivot element 1 by multiplying row 1 by 2, and we get
4
Now to make all other entries as zeros in this column, we first multiply row 1 by -1/2
and add it to row 2, and then multiply row 1 by 10 and add it to the bottom row.
We no longer have negative entries in the bottom row, therefore we are finished.
Question Why are we finished when there are no negative entries in the bottom
row?
Answer The answer lies in the bottom row. The bottom row corresponds to the
equation:
0x1+0x2+20y1+10y2+Z=400
or
Z=400−20y1−10y2
Since all variables are non-negative, the highest value Z can ever achieve is 400,
and that will happen only when y1 and y2 are zero.
STEP 8. Read off your answers.
We now read off our answers, that is, we determine the basic solution associated
with the final simplex tableau. Again, we look at the columns that have a 1 and all
other entries zeros.
Since the columns labeled y1 and y2 are not such columns, we arbitrarily
choose y1=0, and y2=0, and we get
5
0(x1)+1(x2)+0(Z) = 8, x2=8
1(x1)+0(x2)+0(Z) = 4, x1=4
0(x1)+0(x2)+1(Z) = 400, Z=400
The matrix reads x1=4, x2=8 and Z=400.
The final solution says that if Niki works 4 hours at Job I and 8 hours at Job II, she
will maximize her income to sh400. Since both slack variables are zero, it means that
she would have used up all the working time, as well as the preparation time, and
none will be left.