# Minimization Exercise - John works in two storesExample of the Simplex Method - Two-Phase

### Problem Data

We want to Minimize the following problem:

Objective Function
Z = 8X1 + 6X2
Subject to the following constraints
• X1 + X2 20
• X1 + 0X2 12
• X1 + 0X2 5
• 0X1 + X2 10
• 0X1 + X2 6

X1, X2 ≥ 0

Description
Minimization Exercise - John works in two storesJohn must work at least 20 hours a week to supplement his income while attending school. He has the opportunity to work in two retail stores. In store 1, he can work between 5 and 12 hours a week, and in store 2, he is allowed between 6 and 10 hours. Both stores pay the same hourly wage. In deciding how many hours to work in each store, John wants to base his decision on work stress. Based on interviews with present employees, John estimates that, on an ascending scale of 1 to 10, the stress factors are 8 and 6 at stores 1 and 2, respectively. Because stress mounts by the hour, he assumes that the total stress for each store at the end of the week is proportional to the number of hours he works in the store. How many hours should John work in each store?

## Solution

To solve the problem, the iterations of the simplex method will be performed until the optimal solution is found.

Next, the problem will be adapted to the standard linear programming model, adding the slack, excess and/or artificial variables in each of the constraints and converting the inequalities into equalities:

• Constraint 1: It has sign “” (greatest equal), therefore the excess variable S1 will be subtracted and the artificial variable A1 will be added. In the initial matrix, A1 will be in the base.
• Constraint 2: It has sign “” (least equal), therefore the slack variable S2. This variable will be placed at the base in the initial matrix.
• Constraint 3: It has sign “” (greatest equal), therefore the excess variable S3 will be subtracted and the artificial variable A2 will be added. In the initial matrix, A2 will be in the base.
• Constraint 4: It has sign “” (least equal), therefore the slack variable S4. This variable will be placed at the base in the initial matrix.
• Constraint 5: It has sign “” (greatest equal), therefore the excess variable S5 will be subtracted and the artificial variable A3 will be added. In the initial matrix, A3 will be in the base.

Since the problem has artificial variables, the two-phase method will be used. In the first phase, the objective function will be modified to minimize the sum of the artificial variables.

Now we will show the problem in the standard form. We will place the coefficient 0 (zero) where appropriate to create our initial matrix:

Objective Function:

Minimize Z = 0X1 + 0X2 + 0S1 + 0S2 + 0S3 + 0S4 + 0S5 + A1 + A2 + A3

Subject to:

• X1 + X2 - S1 + 0S2 + 0S3 + 0S4 + 0S5 + A1 + 0A2 + 0A3 = 20
• X1 + 0X2 + 0S1 + S2 + 0S3 + 0S4 + 0S5 + 0A1 + 0A2 + 0A3 = 12
• X1 + 0X2 + 0S1 + 0S2 - S3 + 0S4 + 0S5 + 0A1 + A2 + 0A3 = 5
• 0X1 + X2 + 0S1 + 0S2 + 0S3 + S4 + 0S5 + 0A1 + 0A2 + 0A3 = 10
• 0X1 + X2 + 0S1 + 0S2 + 0S3 + 0S4 - S5 + 0A1 + 0A2 + A3 = 6

### Initial Matrix Phase One

We will use the coefficients of the equations to elaborate our first table:

Table 1 Cj Cb Base X1 X2 S1 S2 S3 S4 S5 A1 0 0 0 0 0 0 0 1 1 1 1 1 1 -1 0 0 0 0 1 0 0 20 0 1 0 0 1 0 0 0 0 0 0 12 1 1 0 0 0 -1 0 0 0 1 0 5 0 0 1 0 0 0 1 0 0 0 0 10 1 0 1 0 0 0 0 -1 0 0 1 6 2 2 -1 0 -1 0 -1 0 0 0 31

a) Reduced Cost Vector Calculation (Z):

The values recorded in row Z were obtained as follows:

• Z1 = (Cb,1×X1,1) + (Cb,2×X1,2) + (Cb,3×X1,3) + (Cb,4×X1,4) + (Cb,5×X1,5) - Cj,1 = (1×1) + (0×1) + (1×1) + (0×0) + (1×0) - (0) = 2
• Z2 = (Cb,1×X2,1) + (Cb,2×X2,2) + (Cb,3×X2,3) + (Cb,4×X2,4) + (Cb,5×X2,5) - Cj,2 = (1×1) + (0×0) + (1×0) + (0×1) + (1×1) - (0) = 2
• Z3 = (Cb,1×S1,1) + (Cb,2×S1,2) + (Cb,3×S1,3) + (Cb,4×S1,4) + (Cb,5×S1,5) - Cj,3 = (1×-1) + (0×0) + (1×0) + (0×0) + (1×0) - (0) = -1
• Z4 = (Cb,1×S2,1) + (Cb,2×S2,2) + (Cb,3×S2,3) + (Cb,4×S2,4) + (Cb,5×S2,5) - Cj,4 = (1×0) + (0×1) + (1×0) + (0×0) + (1×0) - (0) = 0
• Z5 = (Cb,1×S3,1) + (Cb,2×S3,2) + (Cb,3×S3,3) + (Cb,4×S3,4) + (Cb,5×S3,5) - Cj,5 = (1×0) + (0×0) + (1×-1) + (0×0) + (1×0) - (0) = -1
• Z6 = (Cb,1×S4,1) + (Cb,2×S4,2) + (Cb,3×S4,3) + (Cb,4×S4,4) + (Cb,5×S4,5) - Cj,6 = (1×0) + (0×0) + (1×0) + (0×1) + (1×0) - (0) = 0
• Z7 = (Cb,1×S5,1) + (Cb,2×S5,2) + (Cb,3×S5,3) + (Cb,4×S5,4) + (Cb,5×S5,5) - Cj,7 = (1×0) + (0×0) + (1×0) + (0×0) + (1×-1) - (0) = -1
• Z8 = (Cb,1×A1,1) + (Cb,2×A1,2) + (Cb,3×A1,3) + (Cb,4×A1,4) + (Cb,5×A1,5) - Cj,8 = (1×1) + (0×0) + (1×0) + (0×0) + (1×0) - (1) = 0
• Z9 = (Cb,1×A2,1) + (Cb,2×A2,2) + (Cb,3×A2,3) + (Cb,4×A2,4) + (Cb,5×A2,5) - Cj,9 = (1×0) + (0×0) + (1×1) + (0×0) + (1×0) - (1) = 0
• Z10 = (Cb,1×A3,1) + (Cb,2×A3,2) + (Cb,3×A3,3) + (Cb,4×A3,4) + (Cb,5×A3,5) - Cj,10 = (1×0) + (0×0) + (1×0) + (0×0) + (1×1) - (1) = 0
• Z11 = (Cb,1×R1) + (Cb,2×R2) + (Cb,3×R3) + (Cb,4×R4) + (Cb,5×R5) = (1×20) + (0×12) + (1×5) + (0×10) + (1×6) = 31

b) Optimality Condition (Incoming Variable):

In the reduced cost vector (Z) we have positive values, so we must select the highest value for the pivot column (minimization).

In the vector Z (excluding the last value), we have the following numbers: [2, 2, -1, 0, -1, 0, -1, 0, 0, 0]. The highest value is = 2 which corresponds to the X1 variable. This variable will enter the base and its values in the table will form our pivot column.

d) Feasibility Condition (Outgoing Variable):

The feasibility condition will be verified by dividing the values of column R by the pivot column X1. To process the division, the denominator must be strictly positive (If it's negative or zero, it'll display N/A = Not applicable). The lowest value will define the variable that will exit from the base:

• Row A1 → R1 / X1,1 = 20 / 1 = 20
• Row S2 → R2 / X1,2 = 12 / 1 = 12
• Row A2 → R3 / X1,3 = 5 / 1 = 5 (The Lowest Value)
• Row S4 → R4 / X1,4 = 10 / 0 = NA
• Row A3 → R5 / X1,5 = 6 / 0 = NA

The lowest value corresponds to the A2 row. This variable will come from the base. The pivot element corresponds to the value that crosses the X1 column and the A2 row = 1.

Enter the variable X1 and the variable A2 leaves the base. The pivot element is 1

## Learn with step-by-step explanations

At PM Calculators we strive to help you overcome those tricky subjects in an easier way.

### Membership

With access to our membership you will have access to 13 applications to learn projects, linear programming, statistics, among others.

#### What calculators are included?

• Critical Path PERT and CPM

• Linear Programming Methods

• Normal Distribution

• Break-even and more