Beruflich Dokumente
Kultur Dokumente
method
The graphical method is a solution method when you have 2 variables (maximum 3, using graphs
and figures in three dimensions).
Step 1. Graph the constraints and find the region of feasible solutions (feasible region).
Step 2. Graph the objective function and slide it, according to the objective (maximize or
minimize) to the optimal point, if it exists.
Decrease
direction of
the objective
function
Decrease
direction of
the objective
function
Optimal
point:
X1* = 4.5
X2* = 3
z*= 7.5 Z*= 7.5
Multiple Unbounded
solution solution
Infeasible Infeasible
solution solution
Software
QM for Windows
Download at:
http://wps.prenhall.com/bp_taylor_introms_11/220/56508/14466195.cw/content/
Standard and canonical forms of Linear
Programming models. Transformation from one
form to another. Unrestricted variables.
STANDARD FORM CANONICAL FORM
1. All constraints are equations (not inequalities) 1. All constraints are inequalities (≥ in
minimization and ≤ in maximization).
2. All variables are non-negative
2. All variables are non-negative
3. The objective function can be maximization or
minimization 3. The objective function can be maximization
Min or Max z = or minimization.
= or
Min z = 6A -6B +3C +7D -7E -7x4 Min z = 6A -6B +3C +7D -7E -7x4
s.t. s.t. Constraint 1 without
slack (or, in this case,
A -B +½C +⅓D -⅓E +⅘x4 –S1 = 68 A -B +½C +⅓D -⅓E +⅘x4 ≥ 68 surplus)
Constraint 2 is written
twice (one with ≥ and
-2A +2B -3C -5D +5E +8x4 ≥ 87 the other one with ≤
-2A +2B -3C -5D +5E +8x4 = 87
+2A -2B +3C +5D -5E -8x4 ≥ -87 and multiply one –in
this case, the second
one, by -1)
½A -½B +⅛C +1/9D -1/9E -1/10x4 +S3 = 100 -½A +½B -⅛C -1/9D +1/9E +1/10x4 ≥ -100 Constraint 3, without
slack, is multiplied by -1
to make it ≥
A, B, C, D, E, X4, S1, S3 ≥ 0 A, B, C, D, E, X4 ≥ 0
Simplex Method using Matrices (Algorithm)
1. Convert to standard form, and then express in matrix notation.
2. Choose a starting basic feasible solution (BFS) with basis B (usually, with the slack variables).
Nonbasic Variables (NBV or XN) = 0 Basic Variables (BV or XB) different from 0.
The NBV form matrix N. The BV form matrix B.
In a basic solution, matrix B has inverse B-1.
The solution is feasible if xB = B-1b ≥ 0
3. Is it optimal? (If so, stop; otherwise, go to step 4).
Costos marginales = Matriz de costos básicos * Inversa de B * vector j de la matriz tecnológica – su costo en la función objetivo.
Calculate the marginal costs zj-cj for all nonbasic variables: zj - cj = CB B-1 aj - cj j ∈ N
Optimality criteria:
If zj-cj ≥ 0 ∀ j ∈ N in maximization problems, ⇒ the BFS is optimal
If zj-cj ≤ 0 ∀ j ∈ N in minimization problems, ⇒ the BFS is optimal
4. Choose the entering variable (Which variable enters the basis)
In maximization problems: Choose the variable with the most negative zj – cj zj-cj << 0
In minimization problems: Choose the variable with the most positive zj – cj zj-cj >> 0
4 0
XB = 12 y2 = 2
Feasibility criterion (minimum ratio test) for 18 2
both min and max problems:
$%
xk = min , 𝑦* >0
&'
X2 = min { --- , 12/2 , 18/2 } = 6
With the feasibility criterion we ensure we preserve s1, s2, s3
the non-negativity in the new solution.
S2 leaves the basis.
Step 6. With the new basis, calculate XB
and z.
In the previous basis: Is it feasible? Yes. All elements in vector
Basic variables: S1, S2, S3 XB = B-1b are positive.
In the new basis:
1 0 0 4 4 S1
Basic variables : S1, X2, S3
0 ½ 0 12 6 x2
XB = =
0 -1 1 18 6 S3
as1 a2 as3
z1 – c1 = -3
zs2 – cs2= 5/2
4 1
XB = 6 y1 = 0
Feasibility criterion (minimum ratio test) for 6 3
both min and max problems:
$%
xk = min , 𝑦* >0 X2 = min {4/1, --- , 6/3 } = 2
&'
This preserves the non-negativity in the new s1, x2, s3
solution.
S3 exits the basis.
Step 6. With the new basis, calculate XB
and z.
In the previous basis: Is it feasible? Yes. All the elements of vector
Basic variables: S1, X2, S3 XB = B-1b are positive.
In the new basis:
1 ⅓ -⅓ 4 2 S1
Basic variables: S1, X2, X1
0 ½ 0 12 6 x2
XB = =
0 - ⅓ ⅓ 18 2 x1
as1 a2 a1
as2
In our current solution, the nonbasic variables
are S3 and S2. 0 -0 = 3/2
zs2 – cs2= ( 0 5 3 ) 1 ⅓ -⅓
0 ½ 0 1
Therefore, we have to check whether both 0 - ⅓ ⅓ 0
zs3-cs3 and zs2-cs2 are greater tan or equal to 0.
It is optimal because all zj-cj are positive.
The optimal solution is:
z* = 36
CBXB
x1* = 2
x2* = 6
Come from XB
S1* = 2
S2* = 0
S3* = 0 Nonbasic
variables = 0
With the initial solution, where the basis was S1, S2 S3, z = 0.
With the next solution, where the basis was S1, x2 S3, z = 30.
With the optimal solution, where the basis is S1, x2 x1, z* = 36.
Optimality criteria in different types of
solutions:
Unique solution:
If zj-cj ≥ 0 ∀ j ∈ N in maximization problems, ⇒ the solution is optimal
If zj-cj ≤ 0 ∀ j ∈ N in minimization problems, ⇒ the solution is optimal
Multiple solutions:
There is a zj-cj = 0 in the optimal solution
Unbounded solution:
$%
It is not possible to find xk = min , 𝑦* > 0 , that is, yk ≤ 0 in all positions.
&'
Exercises
Min z = -x1 –x2 Max z = 2x1 +3x2
s.t. s.t.
x1 – x2 ≤ 1 x1 – x2 ≤ 1
x1 + x2 ≤ 2 x1 -2x2 ≤ 2
x1, x2 ≥ 0 x1, x2 ≥ 0
Note: This problem has multiple solutions. Note: This problem has an unbounded solution.
(There is a zj-cj = 0 in the optimal solution)
z*=-2, x1*=0, x2*=2, s1*=3 s2*=0
z*=-2, x1*=1.5, x2*=0.5, s1*=0 s2*=0
Simplex tableau (Método simplex tabular)
z xB xN RHS
z 1 0 cBB-1N-cN cBB-1b
xB 0 I B-1N B-1b
cB xB b: XN XB
cB xB B-1b B-1N I
(each B-1ai) (Each B-1ai)
(initially 0)
cBB-1b cBB-1N-cN 0
(that is, z) (that is, zj-cj) (that is zj-cj)
Example
ORIGINAL PROBLEM STANDARD FORM
CB XB b: x1 x2 s1 s2 s3
Max z = 4x1 +1x2 + 0s1 + 0s2 + 0s3
0 S1 8 2 1 1 0 0
s.t.
0 S2 5 0 1 0 1 0
0 S3 4 1 -1 0 0 1 2x1 +1x2 +1S1 +0S2 +0S3 = 8
0x1 +1x2 +0S1 +1S2 +0S3 = 5
1x1 -1x2 +0S1 +0s2 +1s3 = 4
x1, x2 ≥ 0
Coef. of VB: S1, S2, S3
Basic B-1b B-1ai
basic variables Value of the VNB: X1, X2
variables basic
in the O.F. variables
Not optimal, there are zj-cj ≤ 0 ∀ j ∈ VNB New basis: x1 enters (the most negative; -4 is more negative than -1).
1 0 0 2 2
y1 = B-1 a1 = 0 1 0 * 0 = 0 There is a tie, I choose the
0 0 1 1 1
s1, s2, s3 variable I want, but only
𝑠= 8 2 one. S1 exits.
-: E G
Exits min , 𝑦* > 0 = min 𝑠> 5 ÷ 0 = min , −, = min 4, −, 4
&' > =
𝑠? 4 1
Coef. of New basis:
Basic B-1b B-1ai
basic variables Value of the
variables VB: X1, S2, S3
basic
in the O.F. variables VNB: S1, X2
CB XB b: x1 x2 s1 s2 s3
0 S1 8 2 1 1 0 0 We have to form the identity matrix in
0 S2 5 0 1 0 1 0 the columns under the basic variables.
0 S3 4 1 -1 0 0 1
0 -4 -1 0 0 0
4 X1 4 1 ½ ½ 0 0 R1’ = R1/ 2 (because it has to
become 1)
0 S2 5 0 1 0 1 0
R2’ = R2 (because it was already 0)
0 S3 0 0 -3/2 -1/2 0 1
R3’ = R3 – R1’
CB XB b: x1 x2 s1 s2 s3
0 S1 8 2 1 1 0 0
0 S2 5 0 1 0 1 0
0 S3 4 1 -1 0 0 1
0 -4 -1 0 0 0 z = cBƃ = (4*4 + 0*5 +0*0) = 16
4 X1 4 1 ½ ½ 0 0 z1-c1 = cBx1-c1 = (4*1 + 0*0 +0*0) - 4 = 0
0 S2 5 0 1 0 1 0 z2-c2 = cBx2-c2 = (4*1/2 + 0*1 +0*-3/2) - 1 = 1
0 S3 0 0 -3/2 -1/2 0 1
zs1-cs1 = cBs1-cs1 = (4*1/2 + 0*0 +0*-1/2) - 0 = 2
zs2-cs2 = cBs2-cs2 = (4*0 + 0*1 +0*0) - 0 = 0
16 0 1 2 0 0 zs3-cs3 = cBs3-cs3 = (4*0 + 0*0 +0*1) - 0 = 0
It is optimal (there are no negatives in max). Unique solution, there are no zeros in the marginal costs of the
nonbasic variables.
Coef. of New basis:
Basic B-1b B-1ai
basic variables Value of the
variables VB: X1, S2, S3
basic
in the O.F. variables VNB: S1, X2
a1 as2 as3
CB XB b: x1 x2 s1 s2 s3
0 S1 8 2 1 1 0 0 2 0 0 ½ 0 0
B = 0 1 0 B-1 = 0 1 0
0 S2 5 0 1 0 1 0 1 0 1 -½ 0 1
0 S3 4 1 -1 0 0 1
0 -4 -1 0 0 0
4 X1 4 1 ½ ½ 0 0
Notice that where we originally had the
0 S2 5 0 1 0 1 0 identity matrix, now we have B-1
0 S3 0 0 -3/2 -1/2 0 1
16 0 1 2 0 0
Degeneracy and redundancy
Degeneracy: a basic variable with a value of 0.
It usually implies that there exists redundancy in the constraints.
If there exists more than one basis that represents an extreme point (vertex), that extreme point is
degenerate.
Suppose there is a tie between x1 and x2. According to the lexicographic rule, we should choose
x1.