Simplex Method: Example 1: Maximize Z 3x + 2x

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 17

Simplex Method: Example 1

Maximize z = 3x1 + 2x2

subject to

-x1 + 2x2 ≤ 4
3x1 + 2x2 ≤ 14
x1 – x2 ≤ 3

x1, x2 ≥ 0

Solution.

First, convert every inequality constraints in the LPP into an equality constraint, so that the
problem can be written in a standard from. This can be accomplished by adding a slack variable
to each constraint. Slack variables are always added to the less than type constraints.

Converting inequalities to equalities

-x1 + 2x2 + x3 = 4
3x1 + 2x2 + x4 = 14
x1 – x2 + x5 = 3
x1, x2, x3, x4, x5 ≥ 0

Where x3, x4 and x5 are slack variables.

Since slack variables represent unused resources, their contribution in the objective function is
zero. Including these slack variables in the objective function, we get

Maximize z = 3x1 + 2x2 + 0x3 + 0x4 + 0x5

Initial basic feasible solution

Now we assume that nothing can be produced. Therefore, the values of the decision variables are
zero.
x1 = 0, x2 = 0, z = 0

When we are not producing anything, obviously we are left with unused capacity
x3 = 4, x4 = 14, x5 = 3

We note that the current solution has three variables (slack variables x3, x4 and x5) with non-zero
solution values and two variables (decision variables x1 and x2) with zero values. Variables with
non-zero values are called basic variables. Variables with zero values are called non-basic
variables.
Simplex Method: Table 1

a11 = -1, a12 = 2, a13 = 1, a14 = 0, a15 = 0, b1 = 4


a21 = 3, a22 = 2, a23 = 0, a24 = 1, a25 = 0, b2 = 14
a31= 1, a32 = -1, a33 = 0, a34 = 0, a35 = 1, b3 = 3

Calculating values for the index row (zj – cj)

z1 – c1 = (0 X (-1) + 0 X 3 + 0 X 1) - 3 = -3
z2 – c2 = (0 X 2 + 0 X 2 + 0 X (-1)) - 2 = -2
z3 – c3 = (0 X 1 + 0 X 0 + 0 X 0) - 0 = 0
z4 – c4 = (0 X 0 + 0 X 1 + 0 X 0) - 0 = 0
z5 – c5 = (0 X 0 + 0 X 0 + 0 X 1) – 0 = 0

Choose the smallest negative value from zj – cj (i.e., – 3). So column under x1 is the key column.
Now find out the minimum positive value
Minimum (14/3, 3/1) = 3
So row x5 is the key row.
Here, the pivot (key) element = 1 (the value at the point of intersection).
Therefore, x5 departs and x1 enters.

We obtain the elements of the next table using the following rules:

1. If the values of zj – cj are positive, the inclusion of any basic variable will not increase the
value of the objective function. Hence, the present solution maximizes the objective function. If
there are more than one negative values, we choose the variable as a basic variable
corresponding to which the value of zj – cj is least (most negative) as this will maximize the
profit.
2. The numbers in the replacing row may be obtained by dividing the key row elements by the
pivot element and the numbers in the other two rows may be calculated by using the formula:

 New number= old number- (corresponding no. of key row) X (corresponding no. of key column)
pivot element

Calculating values for table 2

x3 row

a11 = -1 – 1 X ((-1)/1) = 0
a12 = 2 – (-1) X ((-1)/1) = 1
a13 = 1 – 0 X ((-1)/1) = 1
a14 = 0 – 0 X ((-1)/1) = 0
a15 = 0 – 1 X ((-1)/1) = 1
b1 = 4 – 3 X ((-1)/1) = 7

x4 row

a21 = 3 – 1 X (3/1) = 0
a22 = 2 – (-1) X (3/1) = 5
a23 = 0 – 0 X (3/1) = 0
a24 = 1 – 0 X (3/1) = 1
a25 = 0 – 1 X (3/1) = -3
b2 = 14 – 3 X (3/1) = 5

x1 row

a31 = 1/1 = 1
a32 = -1/1 = -1
a33 = 0/1 = 0
a34 = 0/1 = 0
a35 = 1/1 = 1
b3 = 3/1 = 3

Table 2

cj 3 2 0 0 0
Basic variables Solution values
cB x1 x2 x3 x4 x5
B b (= XB)
0 x3 0 1 1 0 1 7
0 x4 0 5 0 1 -3 5
3 x1 1 -1 0 0 1 3
zj-cj 0 -5 0 0 3
Calculating values for the index row (zj – cj)

z1 – c1 = (0 X 0 + 0 X 0 + 3 X 1) - 3 = 0
z2 – c2 = (0 X 1 + 0 X 5 + 3 X (-1)) – 2 = -5
z3 – c3 = (0 X 1 + 0 X 0 + 3 X 0) - 0 = 0
z4 – c4 = (0 X 0 + 0 X 1 + 3 X 0) - 0 = 0
z5 – c5 = (0 X 1 + 0 X (-3) + 3 X 1) – 0 = 3

Key column = x2 column


Minimum (7/1, 5/5) = 1
Key row = x4 row
Pivot element = 5
x4 departs and x2 enters.

Calculating values for table 3

x3 row

a11 = 0 – 0 X (1/5) = 0
a12 = 1 – 5 X (1/5) = 0
a13 = 1 – 0 X (1/5) = 1
a14 = 0 – 1 X (1/5) = -1/5
a15 = 1 – (-3) X (1/5) = 8/5
b1 = 7 – 5 X (1/5) = 6

x2 row

a21 = 0/5 = 0
a22 = 5/5 = 1
a23 = 0/5 = 0
a24 = 1/5
a25 = -3/5
b2 = 5/5 = 1

x1 row

a31 = 1 – 0 X (-1/5) = 1
a32 = -1 – 5 X (-1/5) = 0
a33 = 0 – 0 X (-1/5) = 0
a34 = 0 – 1 X (-1/5) = 1/5
a35 = 1 – (-3) X (-1/5) = 2/5
b3 = 3 – 5 X (-1/5) = 4

Don't convert the fractions into decimals, because many fractions cancel out during the process
while the conversion into decimals will cause unnecessary complications.
Simplex Method: Final Optimal Table

cj 3 2 0 0 0
Basic variables Solution values
cB x1 x2 x3 x4 x5
B b (= XB)
0 x3 0 0 1 -1/5 8/5 6
2 x2 0 1 0 1/5 -3/5 1
3 x1 1 0 0 1/5 2/5 4
zj-cj 0 0 0 1 0

Since all the values of zj – cj are positive, this is the optimal solution.
x1 = 4, x2 = 1
z = 3 X 4 + 2 X 1 = 14.

Maximization Case: Linear Programming Simplex Method


Example
Luminous Lamps produces three types of lamps - A, B, and C. These lamps are processed on
three machines - X, Y, and Z. The full technology and input restrictions are given in the
following table.

Machine
Product Profit per unit
X Y Z
A 10 7 2 12
B 2 3 4 3
C 1 2 1 1
Available Time 100 77 80

Find out a suitable product mix so as to maximize the profit.

Solution.

The decision problem can be formulated as

Maximize z = 12x1 + 3x2 + x3

subject to

10x1 + 2x2 + x3 ≤ 100


7x1 + 3x2 + 2x3≤ 77
2x1+ 4x2 + x3≤ 80
x1, x2, x3≥ 0

Converting inequalities to equalities

10x1 + 2x2 + x3 + x4 = 100


7x1 + 3x2 + 2x3 + x5 = 77
2x1+ 4x2 + x3 + x6 = 80
x1, x2, x3, x4, x5, x6 ≥ 0

Where x4, x5 and x6 are slack variables.

Including these slack variables in the objective function, we get

Maximize z = 12x1 + 3x2 + x3 + 0x4 + 0x5 + 0x6

Initial basic feasible solution

x1 = 0, x2 = 0, x3 = 0, z = 0
x4 = 100, x5 = 77, x6 = 80

Table 1

Key column = x1 column.


Minimum (100/10, 77/7, 80/2) = 10
Key row = x4 row
Pivot element = 10
x4 departs and x1 enters

Now we are assuming that you can easily calculate the values yourself.
"One that would have the fruit must climb the tree." -Thomas Fuller

Table 2

cj 12 3 1 0 0 0
Basic variables Solution values
cB x1 x2 x3 x4 x5 x6
B b (= XB)
12 x1 1 1/5 1/10 1/10 0 0 10
0 x5 0 8/5 13/10 -7/10 1 0 7
0 x6 0 18/5 4/5 -1/5 0 1 60
zj-cj 0 -3/5 1/5 6/5 0 0

Simplex Method: Final Optimal Table

cj 12 3 1 0 0 0
Basic variables Solution values
cB x1 x2 x3 x4 x5 x6
B b (= XB)
12 x1 1 0 -1/16 3/16 -1/8 0 73/8
3 x2 0 1 13/16 -7/16 5/8 0 35/8
0 x6 0 0 -17/8 11/8 -9/4 1 177/4
zj-cj 0 0 11/16 15/16 3/8 0

An optimal policy is x1 =73/8, x2 = 35/8, x3 = 0.

The associated optimal value of the objective function is z = 12 X (73/8) + 3 X (35/8) + 1 X 0 =


981/8.

Step 2:

Set up the initial solution.


Write down the coefficients of all the variables in given LPP in the tabular form, as shown in
table below to get an initial basic Feasible solution.

xB = B-1 b

The first row in table indicates the coefficient cj of variables in objective function, which remain
same in successive tables. These values represent cost or profit per unit of objective function of
each of the variables.

The second row gives major column headings for the simple table. Column CB gives the
coefficients of the current basic variables in the objective function. Column xB gives the current
values of the corresponding variables in the basic.

Number aij represent the rate at which resource (i- 1, 2- m) is consumed by each unit of an
activity j (j = 1,2 … n).

The values zj represents the amount by which the value of objective function Z would be
decreased or increased if one unit of given variable is added to the new solution.

It should be remembered that values of non-basic variables are always zero at each iteration.

So x1 = x2 = 0 here, column xB gives the values of basic variables in the first column.

So 5, = 4, s2 = 2, here; The complete starting feasible solution can be immediately read from
table 2 as s1 = 4, s2, x, = 0, x2 = 0 and the value of the objective function is zero.
Step 3:

Test for optimality:

Now, proceed to test basic feasible for optimality by the rules given below. This is done by
computing the “net evaluation” Dj for variable xj by the formula

Optimality Test:

(i) If all Δj ≥ 0, the solution under test will be optimal.

(ii) If at least one Δj is negative, the solution under test is not optimal, then proceed to improve
the solution in step 4.

(iii) If corresponding to most negative Δj, all elements of the column Xj are negative or zero (≤
0), then the solution under test will be unbounded

Applying this rule for testing the optimality of starting basic feasible solution, it is observed
that Δ1, and Δ2 both are negative. Hence proceed to improve this solution in step 4.
Step 4:

In order to improve this basic feasible solution, the vector or entering the basis matrix and the
vector to be removed from the basis matrix are determined by the following rules, such vectors
are usually named as “incoming vector” and “outgoing vector” respectively.

“Incoming Vector”:

The incoming vector Xk is always selected corresponding to the most negative value of Δj. (say
Δk). Here Δk = Mix (Δ1,Δ2) = Min [ – 3, -2] = – 3 = Δ.

Therefore k = 1 and column vector x1, must enter the basis matrix. The column x1 is marked by
an upward arrow (↑).

“Outgoing Vector”:

The outgoing vector βr is selected corresponding to the minimum ratio of elements of XB by the
corresponding positive elements of predetermined incoming vector XK. This rule is called the
Minimum Ratio Rule. In mathematical form, this rule is written as,

Comparing both sides of this equation, r = 2 so the vector B2 marked with downward arrow (↓)
should be removed from the basis matrix.

Now starting table (2) is modified to table (3)


Step 5:

In order to bring B2 in place of incoming vector X1 = unity must occupy the marked ‘□’
position and zero at all other places of X1. If the number in the marked ‘□’ position is other than
unity, divide all elements of that row by the ‘key element’ (the element at the intersection of
minimum ratio arrow (←) and incoming vector arrow (↑) is called the key element). Then
subtract appropriate multiples of this new row from the other remaining rows, so as to obtain
zero in the remaining position of the column X1.

Thus, the process can be fortified by simple matrix transformation as follow:

The intermediate coefficient matrix is:

Table 4:

Now construct the improved simple table as follows:


From this table, the improved basic feasible solution is read as:

x1 = 2, x2 = 0, s1 = 2 , s2 = 0

The improved value of Z = 6

Thus the optimal solution is obtained as

xB = 3, x2 = 1, max z = 11

Step 6:

Now repeat step 3 through 5 as and when needed until an optimum solution is obtained in table
5.

Δk = Most negative Δj = – 5 = Δ2

... k = 2 and Hence X2 should be entering vector (Key column) By minimum ratio ratio

Since negative Ratio is not counted,] so the second ratio is not considered.

Since first ratio is minimum, remove the first vector p, form the basis matrix. Hence the key
element is 2.

Developing the first Row by the key elements 2, the intermediate coefficient matrix is obtained
as
This solution as read from this table is x1 = 3, x2 = 2, S1, = 0, S2 = 0 and Z= 11.

Also using the formula Δj = CB Xj – Cj verify that all Δj‘s are non-negative. Hence the optimum.

x1, = 3

x2 – 1

Max Z = 11

Simple Way for Simplex Computations:

Complete solution with its different computational steps can be more conveniently represented
by a single table (6).
Thus the optimal solution is obtained as:

X1 = 3, x2 = 1, max z = 11

Example 2:

Minimize z=x2– 3x3 + 2x5

Subject to 3x2 – 23 + 2x5 ≤ 7


Schematic diagram of simplex Table:
Flow Chart of Simplex Method:

You might also like