Professional Documents
Culture Documents
MIDTERM REVIEW
Jiming Peng
Department of Industrial Engineering
University of Houston
Summary from Exam 1
• Max: 29, Mean: 21. STD=5.8.
20
18
16
14
12
10
8 Column1
6
4
2
0
[0,15] (15,21) [21,25) [25,30]
Topics from the syllabus
• Specific topics include
• Basic introduction to linear optimization: modeling, linear algebra,
standard form, solving LO via LO solvers (Solver in Excel, Linprog
in Matlab, GAMS);
• Algorithms: Simplex method, primal and dual simplex method,
interior-point methods;
• Theory: Duality theory, sensitivity Analysis, convex analysis,
complementarity conditions;
• Special Scenarios: network flow models, assignment and
transportation problems
• Extension and Applications: Mixed Integer Programming, resource
allocation, arbitrage detection, compressed sensing, regression
etc.
Linear Programming
• Ozark Farms uses at least 800 lb of special feed daily. The
special feed is a mixture of corn and soybean meal with the
following compositions:
• lb per lb of feedstuff
protein fiber cost
corn 0.09 0.02 0.30
Soybean 0.60 0.06 0.90
meal
• Dietary requirements:
• At least 30% protein
• At most 5% fiber
• Our goal is to determine the daily minimum-cost feed mix.
Formulating the LP
• Decision variables:
• X1=lb of corn in the daily mix
• X2=lb of soybean in the daily mix
• Objective function:
• Minimize z=0.3*x1+0.9*x2
Identifying the Constraints
• 1. Ozark Farms needs at least 800 lb of feed a day:
• x1+x2 ≥ 800(lb)
• 2. Daily feed must include at least 30% protein:
• 0.09*x1+ 0.60*x2 >= 0.3( x1+x2)
• 3. Daily feed may include at most 5% fiber:
• 0.02*x1+ 0.06*x2<= 0.05(x1+x2 )
• 4. Non-negative variables:
• x1,x2>=0
The Scaled Mathematical Model
• Minimize z=0.3x1+0.9x2
• x1 + x2 ≥ 800
• -7x1 +10 x2 ≥ 0 (because -0.21*x1+ 0.30*x2 ≥ 0)
• -3x1+ x2 ≤ 0 ( 0.03*x1+ 0.01*x2≤ 0)
• x1 ,x2 ≥ 0
• Which algorithm would you like to use for the above problem?
• Two phase method
• Dual simplex!
Solving LP by Solver
•
470.5882 4376.471
329.4118
min f=3*x1+9*x2
-1082.35 3*x1-x2>=0
0 x1, x2>=0
Corn Soybean
Objective function Coefficient/cost 0.3 0.9 437.6471
Total amount 1 1 800 ≥ 800
protein 0.09 0.6 240 ≥ 240
fiber 0.02 0.06 9.411765 ≤ 40
variables
x1 x2
470.5882 329.4118
Output from Solver
Microsoft Excel 14.0 Answer Report
Worksheet: [Diet1.xlsx]Sheet1
Report Created: 10/10/2014 11:15:27 AM
Result: Solver found a solution. All Constraints and optimality conditions are satisfied.
Solver Engine
Engine: Simplex LP
Solution Time: 0.015 Seconds.
Iterations: 2 Subproblems: 0
Solver Options
Max Time Unlimited, Iterations Unlimited, Precision 0.000001, Use Automatic Scaling
Max Subproblems Unlimited, Max Integer Sols Unlimited, Integer Tolerance 1%, Solve Without Integer Constraints, Assume NonNegative
Variable Cells
Cell Name Original Value Final Value Integer
$D$10 x1 0 470.5882353 Contin
$E$10 x2 0 329.4117647 Contin
Constraints
Cell Name Cell Value Formula Status Slack
$F$5 Total amount 800 $F$5>=$H$5 Binding 0
$F$6 protein 240 $F$6>=$H$6 Binding 0
$F$7 fiber 9.411764706 $F$7<=$H$7 Not Binding 30.58823529
Sensitivity Report
Variable Cells
Final Reduced Objective Allowable Allowable
Cell Name Value Cost Coefficient Increase Decrease
$D$10 x1 470.5882353 0 0.3 0.6 0.93
$E$10 x2 329.4117647 0 0.9 1E+30 0.6
Constraints
Final Shadow Constraint Allowable Allowable
Cell Name Value Price R.H. Side Increase Decrease
$F$5 Total amount 800 0.547058824 800 1E+30 800
$F$6 protein 240 1.176470588 0 240 168
$F$7 fiber 9.411764706 0 0 1E+30 30.58823529
Simplex-
11
Wyndor Glass
Z- 3x1 - 5x2 =0 (0)
x1 +s1 =4 (1)
2x2 +s2 = 12 (2)
3x1+ 2x2 +s3 = 18 (3)
• Optimality test
• Entering variable (steepest ascent) – pivot column
• Leaving variable (minimum ratio test) – pivot row
• Gaussian elimination
Basic
x1 x2 s1 s2 s3 r.h.s.
variable
Z -3 -5 0 0 0 0
S1 1 0 1 0 0 4
X2 0 1 0 0.5 0 6
S3 3 2 0 0 1 18
Simplex-
15
• Optimality test
• Entering variable (steepest ascent) – pivot column
• Leaving variable (minimum ratio test) – pivot row
• Gaussian elimination
Basic
x1 x2 s1 s2 s3 r.h.s.
variable
Z -3 0 0 5/2 0 30
s1 1 0 1 0 0 4
x2 0 1 0 1/2 0 6
x1 1 0 0 -1/3 1/3 2
Simplex-
16
3 x1 8 x 2 6 3 y1 y2 8 y3 5
x1 6 x2 5
8y1 6 y2 4
8 x1 10
y1 0; y2 , y3 urs
x 2 0; x1 urs
Strong Duality Theorem
• Consider the standard LO in the form
• Max cTx Min bTy
• Ax+s=b, x,s≥0. ATy-w=c, y,w≥0
• Theorem: suppose (x,s) and (y,w) are feasible for
the primal and dual problem respectively. Then
we have
• bTy-cTx=xTw+yTs≥0
• The equality holds if and only if xTw=yTs=0. In such a
case, (x,s)/(y,w) is optimal for the primal/dual problem.
• Recall s=b-Ax, thus we have yT(b-Ax)=0, xT(ATy-c)=0.
Example
• Primal Dual
• max 4x1+x2+2x3 Min 2 y1+8y2
• s.t. 8x1+3x2+x3≤2 s.t. 8y1+6y2≥4;
• 6x1+x2+x3≤8 3y1+y2≥1;
• x1, x2, x3 ≥0 y1+y2≥2; y1,y2,y2≥0.
• Suppose the optimal solution of the primal problem is
x*=(0,0,2). What’s the optimal solution to the dual
problem?
• Observation: Since y2(8-6x1-x2-x3)=0, thus we have y2=0.
Since x3(y1+y2-2)=0, thus y1=2.
• Optimal solution: (y1=2,y2=0)!
Example
• Primal Dual
• max 4x1+x2+2x3 Min 12 y1+8y2
• s.t. 8x1+3x2+x3≤12 s.t. 8y1+6y2≥4;
• 6x1+x2+x3≤8 3y1+y2≥1;
• x1, x2, x3 ≥0 y1+y2≥2; y1,y2,y2≥0.
• Suppose the optimal solution of the primal problem is
x*=(0,0,8). What’s the optimal solution to the dual
problem?
• Observation: Since y1(12-8x1-3x2-x3)=0, thus we have
y1=0. Since x3(y1+y2-2)=0, thus y2=2.
• Optimal solution: (y1=0,y2=2)!
Prima-Dual Relationships
• Primal Dual
Feasible and bounded Feasible and bounded
Optimal Optimal
infeasible unbounded
unbounded infeasible
infeasible infeasible
Sensitivity Analysis
• Sensitivity analysis is concerned with how changes in
an LP’s parameters affect the optimal solution.
• There are six possible changes:
1.Changing the objective function coefficient of a nonbasic variable.
Reduced cost, row 0 in the final tableau
2.Changing the objective function coefficient of a basic variable.
Need to check whether the current basis remains optimal
3.Changing the right-hand side of a constraint.
Shadow price, the solution to the dual problem as listed in row 0 in the final tableau
corresponding to the slack variables
Wyndor Glass
Z- 3x1 - 5x2 =0 (0)
x1 +s1 =4 (1)
2x2 +s2 = 12 (2)
3x1+ 2x2 +s3 = 18 (3)
Sensitivity Analysis: Wyndor Example
• The basis matrix and its inverse
• , , cbv=(0,5,3)
• The reduced cost for non-basic variables and shadow
price for rhs of constraints:
• Check the Z-row in the final tableau:
• The allowable range of change:
• For non-basic variable, it is based on the reduced cost;
• For the RHS of constraints, we need to ensure
•
• ≥ 0.
Sensitivity analysis for nonstandard LO
• Consider the following example:
•
Max 3x1 + 4x2+ x3 Max 3x1 + 4x2+ x3 Min 50y1+15y2+10y3
s.t. x1+x2+x3≤50 s.t. x1+x2+x3+s1 =50 s.t. y1+2y2+y3≥3;
2x1-x2+x3≥15 2x1-x2+x3-s2+a2=15 y1-y2+y3≥4;
x1+x2 =10 x1+x2 + a3=10 y1+y2 ≥1;
x1,x2,x3≥0 x1,x2,x3, s1, s2, a2, a3≥0 y1≥0,y2≤0, y3 urs
Z x1 x2 x3 s1 s2 a2 a3 80
1 0 0 1 M 0 M+3 80
s2 -3 0 0 1 1 -1 -2 15
x3 0 0 1 1 0 0 -1 40
x2 1 1 0 0 0 0 1 10
Other Issues
• How to construct the augmented LO in big-M method or
the two phase method?
• How to deal with the degenerate cases and avoid cycling
in the simplex method?
• Farkas Lemma and separation theorem.