State of the Smart Building Startup Landscape 2024!
Twotanks.ppt
1. 1
INTRODUCTION TO LINEAR PROGRAMMING
MAIN LEARNING OBLECTIVES
•Basic concept of linear optimization, and associated terminology
•Meaning and possible use of marginal values
•Strengths, weakness and limitations of LP technique
SUPPORTING EXAMPLES
•Two-Tanks Blending Problem : doing hand calculations
•Simple Refinery : using the computer
4. 4
TWO-TANKS BLENDING PROBLEM
0
200
400
300 600
lines of constant proceeds
increasing
profit
feasible
region
optimum
S spec
Demand
Max X1
Max X2
X1
X2
A
B C
D
GRAPHICAL SOLUTION
5. 5
TWO-TANKS BLENDING PROBLEM
Transform the inequalities into equalities
Supply +X1 +S1 = 500
+X2 +S2 = 600
Demand +X1 +X2 +S3 = 800
Quality +X1*(-1.2) +X2*(0.5) +S4 = 0
Objective +X1*170 +X2*170 +S1*180 +S2*150 = P
or +X1*(-10) +X2*20 +180000 = P
Si’s are called slack variables.
Equations (2/2)
7. 7
TWO-TANKS BLENDING PROBLEM
E1'=E1*(-180) : Supply1 -180 -180 -90000
E2'=E2*(-150) : Supply2 -150 -150 -90000
E5'=E5+E1'+E2’: Proceeds -10 20 0 0 0 0 P- 180000
E1 Supply1 1 1 500
E2 Supply2 1 1 600
E3 Demand 1 1 1 800
E4 Quality -1.2 0.5 1 0
E5 = E5’ Proceeds -10 20 0 0 0 0 P- 180000
Canonical form of the LP matrix : S1, S2, S3, S4 in the BASIS
X1 X2 S1 S2 S3 S4 RHS
Make objective function of X1 and X2 only
Increase X2 to increase proceeds:
•lowest max X2 is 0 (see E4);
•pivot column is X2; pivot row E4; pivot element is 0.5.
SIMPLEX METHOD (1/6)
8. 8
TWO-TANKS BLENDING PROBLEM
E1 Supply1 1 1 500
E2-E4’=E2’ Supply2 2.4 1 -2 600
E3-E4’=E3’ Demand 3.4 1 -2 800
E4’=E4/0.5 Quality -2.4 1 2 0
E5-20*E4’=E5’ Objective 38 0 0 0 0 -40 P- 180000
X1 X2 S1 S2 S3 S4 RHS
Bring X2 into the basis; take S4 out:
•make coeff de X2 in E4 equal to 1
•eliminate X2 from other equations
Increase X1 to increase objective function:
•lowest max X1 is 235 (see E3’);
•pivot column is X1; pivot row E3’; pivot element is 3.4.
SIMPLEX METHOD (2/6)
9. 9
TWO-TANKS BLENDING PROBLEM
E1=E1’-E3 Supply1 0 1 0.3 -0.6 265
E2=E2’-2.4*E3 Supply2 0 1 -0.7 -0.6 35
E3= E3’/3.4 Demand 1 0.3 -0.6 235
E4=E4’ Quality 0 1 0.7 0.6 565
E5=E5’-38*E3 Proceeds 0 0 0 0 -11 -18 P- 188941
X1 X2 S1 S2 S3 S4 RHS
Bring X1into the basis; take S3 out:
•make coeff of X1in E3 equal to 1
•eliminate X1from other equations
P max=188941 for S3 and S4 =0
Optimal solution:
•X1=235; S1=265
•X2=565; S2=35
SIMPLEX METHOD (3/6)
10. 10
TWO-TANKS BLENDING PROBLEM
SIMPLEX METHOD (4/6)
Canonical form of the LP matrix with basic variables X1, ….., X9:
X1 + A1,10 * X10 + ………+ A1,j * Xj + ……….+ A1,n * Xn = B1
X2 + A2,10 * X10 + ………+ A2,j * Xj + ……….+ A2,n * Xn = B2
. . . . .
. . . . .
. . . . .
. . . . .
X9 + A9,10 * X10 + ……….+ A9,j * Xj + ………+ A9,n * Xn = B9
Basic Variables Non-basic (or independent) variables RHS
Objective (max), P - M10 * X10 - ……… - Mj * Xj - …… - Mn * Xn + constant = P
Mj’s = Dj’s in the mathematical LP theory
= marginal or dual values at the optimum (positive for non-basic variables;
zero for basic variables)
11. 11
TWO-TANKS BLENDING PROBLEM
SIMPLEX METHOD (5/6)
RELATIONSHIP BETWEEN MARGINAL VALUES
Mi’s = marginal values for the rows
= marginal values of corresponding slack variables;
called dual prices (by LAMPS), or shadow prices …
Mj’s = marginal values for the columns
= marginal values of corresponding primary variables;
called reduced costs, or shadow costs …
(Input Cost)j
= coefficient of Xj in original objective (in original canonical equation) e.g.
input cost of X1 is -10, the cost of downgrading 1 ton of component 1
Mj = (reduced cost)j = Sum (Mi * Ai,j) - (input cost)j e.g.
M1 = +1*(marg.val.S1 = 0) + (+1)*(marg.val.S3 = 11.18) + (-1.2)*(marg.val.S4 = 17.65)
- (-10) = 0
12. 12
TWO-TANKS BLENDING PROBLEM
SIMPLEX METHOD (6/6)
USING MARGINAL VALUES
•Marginal values are useful to understand constraints’ impact on objective function;
hence to conduct a ‘what if’ analysis.
•Marginal value of a non-basic - constrained - variable is meaningful when the
constraint is met i.e. at the margin, or for the last unit produced / used.
It does not represent the average unit contribution of that variable. It should not be used
to predict a (large) quantified change of the objective function.