Week 7 - Linear Programming New
Week 7 - Linear Programming New
programming
“Linear” = direct proportionality of
relationship of variables.
“Programming” = making schedules or plans
of activities to undertake in the future.
Linear Programming = planning by the use
of linear relationship of variables involved.
Linear Programming model is designed to maximize
(minimize) an objective function of the form:
𝑥1 , 𝑥 2 , … , 𝑥𝑛 ≥ 0 implicit
constraints
System of Linear Equations
A system of equations is a collection of two or more
equations with a same set of unknowns.
In solving a system of equations, we try to find values
for each of the unknowns that will satisfy every
equation in the system.
The equations in the system can be linear or non-
linear.
A system of linear equations can be solved four
different ways:
• Substitution
• Gaussian Elimination
• Matrices
• Graphing
System of Equations in Two Variables
x + y = P12,000 - eq. 1
0.09x + 0.11y = P1,180 - eq. 2
x = 12,000 – y – eq. 3
: x + y = P12,000 - eq. 1
7,000 + 5,000 = P 12,000
P12,000 = P12,000
New Equation:
- 0.09x - .09 y = -1080
0.09 x + 0.11y = 1,180
0.02y = 100
0.02 0.02
y = 5,000 - eq. 3
2a + 4b = 50 - eq. 1//*-3
3a + 5b = 66 - eq. 2//*2
Cj 80 60 0 0
Prod Qty X Y S1 S2
0 S1 30 2 1 1 0
0 S2 24 1 2 0 1
Zj 0 0 0 0 0
Cj – Zj 80 60 0 0
Table 1: Determine the pivotal row ( the lowest value of Qty )
and column ( optimum column )
Cj 80 60 0 0
Prod Qty X Y S1 S2
0 S1 30 2 1 1 0
0 S2 24 1 2 0 1
Zj 0 0 0 0 0
Cj – Zj 80 60 0 0
Table 1:
Cj 80 60 0 0
Prod Qty X Y S1 S2
0 S1 30 2 1 1 0
0 S2 24 1 2 0 1
Zj 0 0 0 0 0
Cj – Zj 80 60 0 0
Table 2:
Cj 80 60 0 0
Prod Qty X Y S1 S2
80 X 15 1 1/2 1/2 0
0 S2 24 1 2 0 1
Zj 0 0 0 0 0
Cj – Zj 80 60 0 0
Table 2:
Cj 80 60 0 0
Prod Qty X Y S1 S2
80 X 15 1 1/2 1/2 0
0 S2 24 1 2 0 1
Zj 0 0 0 0 0
Cj – Zj 80 60 0 0
Computing S2:
15(-1) = -15+24 = 9
1(-1) = -1 + 1 = 0
½(-1) = -1/2 +2 = 1 ½ or 3/2
½ ( -1) = - ½ + 0 = - ½
0–1=1
Computing S2:
15(-1) = -15+24 = 9
1(-1) = -1 + 1 = 0
½(-1) = -1/2 +2 = 1 ½ or 3/2
½ ( -1) = - ½ + 0 = - ½
0–1=1
Table 3:
Cj 80 60 0 0
Prod Qty X Y S1 S2
80 X 15 1 1/2 1/2 0
0 S2 9 0 3/2 -1/2 1
Zj 1200 80 40 40 0
Cj – Zj 0 20 - 40 0
Table 3: Cj 80 60 0 0
Prod Qty X Y S1 S2
80 X 15 1 1/2 1/2 0
0 S2 9 0 3/2 -1/2 1 Divide 3/2
Zj 1200 80 40 40 0
Cj – Zj 0 20 - 40 0
Table 4:
Cj 80 60 0 0
Prod Qty X Y S1 S2
80 X 15 1 1/2 1/2 0
60 Y 6 0 1 -1/3 2/3
Zj 1200 80 40 40 0
Cj – Zj 0 20 - 40 0
Table 4:
Cj 80 60 0 0
Prod Qty X Y S1 S2
80 X 15 1 1/2 1/2 0
60 Y 6 0 1 -1/3 2/3
Zj 1200 80 40 40 0
Cj – Zj 0 20 - 40 0
6(- ½) + 15 = -3 +15 = 12
0 (- ½) + 1 = 0 +1 =1
1 (- ½) + ½ = - ½ + ½ = 0
- 1/3 (- ½) + ½ = 1/6 + ½ = 4/6 = 2/3
2/3 (- ½) + 0 = 1/3 + 0 = 1/3 = 0 - 1/3 = - 1/3
Solving for the new entries in the x row:
6(- ½) + 15 = -3 +15 = 12
0 (- ½) + 1 = 0 +1 =1
1 (- ½) + ½ = - ½ + ½ = 0
- 1/3 (- ½) + ½ = 1/6 + ½ = 4/6 = 2/3
2/3 (- ½) + 0 = 1/3 + 0 = 1/3 = 0 - 1/3 = - 1/3
Last Table:
Cj 80 60 0 0
Prod Qty X Y S1 S2
80 X 12 1 0 2/3 - 1/3
60 Y 6 0 1 -1/3 2/3
Zj 960 80 0 160/3 -80/3
360 0 60 -60/3 120/3
1,320 80 60 100/3 40/3
Cj – Zj 0 0 -100/3 -40/3
Last Table:
Cj 80 60 0 0
Prod Qty X Y S1 S2
80 X 12 1 0 2/3 - 1/3
60 Y 6 0 1 -1/3 2/3
Zj 960 80 0 160/3 -80/3
360 0 60 -60/3 120/3
1,320 80 60 100/3 40/3
Cj – Zj 0 0 -100/3 -40/3
Subject to : 2x + y + S1 = 30 x + 2y + S2 = 24
2(12) + 6 + 0 = 30 12 + 2 (6) + 0 = 24
24 + 6 + 0 = 30 12 + 12 + 0 =24
30 = 30 24 = 24
Simplex Maximization Problem
Example.
Maximize: Z = 80X + 60Y
Subject to: 4X + 2Y ≤ 60
2X + 4Y ≤ 48
X≥0
Y≥0
.
Simplex Maximization Problem
Steps in solving a Maximization problem:
1) Set up the constraints from the conditions of the
problem.
2) Convert the inequality explicit constraints to equations
by adding slack variables.
3) Enter the numerical coefficients and variables in the
simplex table.
4) Calculate Cj and Zj values.
5) Determine the optimum column or entering variable by
choosing the most positive value in the Cj – Zj row.
6) Divide the quantity-column values by the non-zero and
non-negative entries in the optimum column. The
smallest quotient belongs to the pivotal row.
Simplex Maximization Problem
Steps in solving a Maximization problem:
7) Compute the values for the replacing row by dividing all
entries by the pivot. Enter the result in the next table.
8) Compute new entries for the remaining rows by reducing
the optimum column entries to zero (entries in the
constraint rows).
9) Calculate Cj and Zj values. Compute also for Cj – Zj row.
10) If there is a positive entry in the Cj – Zj row, return to step
5. The final solution has been obtained if there is no
positive value in the Cj – Zj row.
Simplex Maximization Problem
Example.
Maximize: Z = 80X + 60Y
Subject to: 4X + 2Y ≤ 60
2X + 4Y ≤ 48
X≥0
Y≥0
.
Simplex Maximization Problem
Simplex Tableau 1
Contribution to profit column
Variable column (Entering Variables)
Constant column
OF coeff.
Cj 80 60 0 0 row
Prod Qty x y S1 S2 Variable row
0 S1 30 2 1 1 0 Constraints
coeff. rows
0 S2 24 1 2 0 1
Zj 0 0 0 0 0
Cj – Zj 80 60 0 0
Simplex Maximization Problem
Continuation.
Simplex Maximization Problem Containing “ ≥ ”
In Maximization problem, we always add a slack variable
to convert a constraint to equation.
If the constraint has a “≥” symbol, we cannot transform it
to equation by immediately adding a slack variable for
obvious reason.
Instead, first convert “≥” symbol to “≤” by multiplying the
inequality constraint by negative 1.
Then add a slack variable.
Simplex Maximization Problem Containing “ ≥ ”
Example.
Maximize: 50X1 + 20X2
Subject to: X1 ≤ 20
X2 ≤ 30
X1 + X2 ≥ 48
X1 ≥ 0
X2 ≥ 0
Simplex Maximization Problem
Example.
A poultry raiser plans to raise chicken, ducks and
turkeys. He has room for only 200 birds and wishes to
limit the number of turkeys to a maximum of 25, the
number of turkeys and ducks to a maximum of 100. His
estimated profits are Php 30, Php 25 and Php 125 on
each chicken, duck and turkey respectively. How many
of each should he raise to maximize his profit?
.
Simplex Maximization Problem Containing “ = ”
As a rule, add a slack variable to the left member of the
constraint containing the equal symbol.
Example.
Maximize: 5X1 + 4X2
Subject to: 2X1 + X2 = 12
2X1 + 3X2 ≤ 24
2X1 + 9X2 ≥ 36
X1 ≥ 0
X2 ≥ 0
.
Simplex Minimization Problem
Steps in solving a Minimization problem are similar to
maximization except for 3 processes.
1) The Cj column of the initial table begins with the
coefficient of artificial variables and of slack variables in
the objective with positive coefficients in the constraints.
2) Instead of looking for the most positive quantity in Cj – Zj
row for the optimum column, look for the most negative
entry.
3) The optimum table or final table has entries in the Cj – Zj
row which are either zero or positive.
Simplex Minimization Problem
Summary of converting constraints to equations:
1) Add an artificial variable if the symbol is “=“.
2) Add a slack variable if the symbol if “≤”.
3) Subtract a slack variable but add an artificial variable if
the symbol is “≥”.