Date post: | 26-Mar-2015 |
Category: |
Documents |
Upload: | seth-fitzgerald |
View: | 214 times |
Download: | 0 times |
DMOR
Linear Programming 2
Solving LPs – general case
• Till now we talked about the standard form– Maximization– Constraints of the form ≤– RHS of the constraints ≥ 0– All variables ≥ 0
• In this case, point (0,0,…,0) is always a feasible cornerpoint solution
• What if the problem is NOT in the standard form?
Minimization
1. Transform into maximization: – min Z = 12x1 + 5x2 – 7x3
– max (–Z) = –12x1 – 5x2 + 7x3
• Put -1 in column Z in the simplex tableau to remember • After solving an LP as a maximization problem:
– Multiply the objective function value by -1– Decision variables values taken from the tableau are the
solution to the original problem
2. Another method – less popular – solve the simplex tableau as minimization problem with appropriately modified rules.
Equality constraints• Bicycle company problem:
• Introduce an artificial variable a1 [artificial variable]
• An artificial variable differs from a slack variable – we have to make it zero, because point (x1,x2,s1,s2,a1) = (0,0,2,3,4) is not feasible.
2-phase simplex algorithm
• To do it we use 2-phase simplex algorithm– Phase 1: minimize all artificial variables (we only
have one: a1); if the minimum is zero, then we have a feasible cornerpoint solution…
– Phase 2: … from which we start to search for the optimal solution the same way as in basic simplex algorithm introduced in the last lecture
Phase 1• Transform
– min W = a1 + a2 + a3 + …
– max –W + a1 + a2 + a3 + … = 0
• The original objective function is written along with the objective function used in phase 1 of the algorithm
• The first simplex tableau in phase 1 is never in the proper form, because artificial variables, which are basic variables first „appear” two times in the given column.
• We need some preliminary transformation
Phase 1• We make it into the proper form
• 4 units of constraint violation
• d
Phase 1• When solving, we have to remember to modify the original
objective function as well
• We finished phase 1. We have to continue into phase 2, because there is a negative coefficient in the original objective function raw
Phase 2
• Solution: (x1,x2,s1,s2) = (2,2,0,1); Z=50
What happened?• We start in the cornerpoint which is not feasible for phase 2, but is
feasible for phase 1• We finish phase 1 in the cornerpoint, which is feasible both for phase
1 and phase 2
Infeasible problem
• If phase 1 ends and value of W is still positive, the problem is infeasible.
• How to check why:– IIS – irreducible infeasible set – commonly a very
small subset of all constraints, which taken together are infeasible, but
– Throwing away one or more constraints from this set results in a feasible problem
Constraints of the type ≥ with positive RHS
• These constraints mean that the origin of the coordinate system is infeasible
• We cannot simply multiply eveything by -1, because the RHS will then be negative.
• Solution: we introduce a surplus variable 3x1 + 5x2 ≥ 20 3x⇒ 1 + 5x2 − s1 = 20.
• Surplus variable may not be used as a basic variable for the constraint, in which it occurs, because it has a coefficient -1 instead of +1
• But the constraint is now the equality constraint, so we can treat it the same way as other equality constraints:
3x1 + 5x2 − s1 + a1 = 20
Negative RHS of the constraint
• Problem – basic variable for this constraint would have to be negative and it cannot
• Solution: multiply by -1 and treat the resulting constraint of the type ≥, =, ≤ respectively.
Example conversion
min Z = 15x1 + 10x2 ← minimiation instead of maximizationx1 ≤ 2x2 = 3 ← equality instead of ≤x1 + x2 ≥ 4 ← ≥ instead of ≤
max (-W) + a1 + a2 = 0 [phase 1 objective function]max (-Z) + 15x1 + 10x2 =0 [phase 2 objective function]x1 + s1 = 2x2 + a1 = 3x1 + x2 – s2 + a2 = 4
Variables that may be negative• Two possibilities:
1. Lower bound • E.g. production level can fall no more than Lj from the
present level xj ≥ Lj
• Solution – change of variables xj = xj + L′ j
2. No bounds at all: next slide
No bounds on a variable
• Unbounded variable xj is replaced by the difference between two nonnegative variables xj = xj
+ – xj-
• Simplex will automatically assign one of them a nonzero value.– Columns for these variables are a mirror image of one another (+1 in one
and -1 in another), so both variables cannot be basic at the same time– If xj
+ > 0 then xj = xj+
– If xj- > 0 then xj = - xj
-,
– If xj+ =xj
- = 0 then xj = 0.
• If we have a lot of unbounded variables we use for each of them one variable xj
-. In the optimal solution xj- will be the absolute value of the
most negative variable xj . Variables xj+ tell us then by how much a
given variable exceeds this most negative variable
Tropical Treats Kissable Lip shine– Jessica Simpson & Urban Chic Boutique
• Dear Students of DMOR class at WSE, My name is Jessica Simpson. I have been going through some tough times recently and am having a real problem with one of mycosmetic lines. The info for the line is on the next page. Recently though costs are changing based on market demand in addition to highly fluctuating resource costs. My problem is this we currently have an LP that we solve to find the optimal amount to produce of each product. However, every time a parameter changes, I am always forced to resolve the LP and this takes too long. I was hoping you guys could find a better way. Lately I have just been out of it. For example, Nick and I decided to split our Hummer in half, and now I need to buy a new one. Oh yeah, about the LP it seems to have been misplaced when I was moving out of my Malibu house. Please Help! -Jessica
http://www.urbanchic-boutique.com/dhop/jessica-simpson-dessert-treats/jessica-simpson-tropical-treats-kissable-lip-shine/prod_89.html
Problem data
• Jessica sells 4 kinds of tropical lip shine.• Exactly 950 total units must be produced. • Customers demand that at least 400 units of Mango lip shine be
produced. • Formulate an LP to maximize profit. • Raw Materials Available <=4600 • Labor Available <=5000
Peach Pineapple Orange Mango
Raw material 2 3 4 7
Hours of labor 3 4 5 6
Sale price ($) 4 6 7 8
Formulating an LP• Amount of each lip shine
– X1: peach– X2: pineapple– X3: orange– X4: mango
max
Our results
• What may change?:– Based on market demand, prices can change – Cost of resources and labor change constantly – Amount of resources can change – New products can be introduced
• Pytanie: How/when can I determine if my current solution (or basis) is still optimal given the change without having to resolve the LP?
Decision variables 0 400 150 400
Objective function 6650
Sensitivity report
• Should it look like this?Microsoft Excel 12.0 Raport wrażliwościArkusz: [example.xlsx]ProblemRaport utworzony: 2013-03-12 12:07:53
Komórki decyzyjne Wartość Przyrost
Komórka Nazwa końcowa marginalny$B$6 Decision variables Peach 0 -1,000001907$C$6 Decision variables Pineapple 400 0$D$6 Decision variables Orange 150 0$E$6 Decision variables Mango 400 0
Warunki ograniczające Wartość Mnożnik
Komórka Nazwa końcowa Lagrange'a$H$2 Raw Material 4600 1$H$3 Hours of labor 4750 0$H$4 Quantity all 950 3$H$5 Qunatity mango 400 -2
Common errors
Forgetting to Check • Assume Non-Negativity• Forgetting to Check Assume Linear Model
• We will assume for all conditions derived that degeneracy is not present
• At the end of the lecture we will show how to modify the conditions when degeneracy is present.
Sensitivity report for an LP
Microsoft Excel 12.0 Raport wrażliwościArkusz: [example.xlsx]ProblemRaport utworzony: 2013-03-12 12:07:18
Komórki decyzyjne Wartość Przyrost Współczynnik Dopuszczalny Dopuszczalny
Komórka Nazwa końcowa krańcowy funkcji celu wzrost spadek$B$6 Decision variables Peach 0 -1 4 1 1E+30$C$6 Decision variables Pineapple 400 0 6 0,666666667 0,5$D$6 Decision variables Orange 150 0 7 1,000000001 0,5$E$6 Decision variables Mango 400 0 8 2 1E+30
Warunki ograniczające Wartość Cena Prawa strona Dopuszczalny Dopuszczalny
Komórka Nazwa końcowa dualna w. o. wzrost spadek$H$2 Raw Material 4600 1 4600 250 150$H$3 Hours of labor 4750 0 5000 1E+30 250$H$4 Quantity all 950 3 950 50 100$H$5 Qunatity mango 400 -2 400 37,5 125
Decision variables 0 400 150 400
Objective function 6650
Type of Change 1: Changing the Cost Coefficient of a Basic Variable
“Hi guys I was at the market and noticed the price of pineapple went up by 50 cents. That means if I raise the price of the pineapple lip shine by 50 cents I will make more money. Right?” Jessica
Solution:Be careful!! The next steps applies only to basic variables. Steps to Take: • Step 1: Check if the change of the objective coefficient is within
the allowable range?• Step 2: If so, the optimal basic feasible solution will not change.
Calculate the change in profit.
Microsoft Excel 12.0 Raport wrażliwościArkusz: [example.xlsx]ProblemRaport utworzony: 2013-03-12 12:07:18
Komórki decyzyjne Wartość Przyrost Współczynnik Dopuszczalny Dopuszczalny
Komórka Nazwa końcowa krańcowy funkcji celu wzrost spadek$B$6 Decision variables Peach 0 -1 4 1 1E+30$C$6 Decision variables Pineapple 400 0 6 0,666666667 0,5$D$6 Decision variables Orange 150 0 7 1,000000001 0,5$E$6 Decision variables Mango 400 0 8 2 1E+30
Warunki ograniczające Wartość Cena Prawa strona Dopuszczalny Dopuszczalny
Komórka Nazwa końcowa dualna w. o. wzrost spadek$H$2 Raw Material 4600 1 4600 250 150$H$3 Hours of labor 4750 0 5000 1E+30 250$H$4 Quantity all 950 3 950 50 100$H$5 Qunatity mango 400 -2 400 37,5 125
Exercise
Problem A• Suppose the price of x1 is increased by 60
cents. What is the new optimal solution and change in profit?
Problem B• Suppose the price of x3 is decreased by 60
cents. What is the new optimal solution and change in profit?
Type of Change 2: Changing the Cost Coefficient of a Non-Basic Variable
“Hello Class, I went to the store to buy some of my peach gloss and found out none of it was being produced because it wasn’t profitable. What should I charge to make them in the optimal mix?”, Jessica (with help of agent)
In order to answer this, we need to look at the “reduced costs” • If the reduced cost of a non basic variable xi is – ri, it means
that increasing the “cost” of the variable by ri will lead to an optimum basis that includes xi.
• What is the relationship between the reduced cost and the z row coefficient?
Microsoft Excel 12.0 Raport wrażliwościArkusz: [example.xlsx]ProblemRaport utworzony: 2013-03-12 12:07:18
Komórki decyzyjne Wartość Przyrost Współczynnik Dopuszczalny Dopuszczalny
Komórka Nazwa końcowa krańcowy funkcji celu wzrost spadek$B$6 Decision variables Peach 0 -1 4 1 1E+30$C$6 Decision variables Pineapple 400 0 6 0,666666667 0,5$D$6 Decision variables Orange 150 0 7 1,000000001 0,5$E$6 Decision variables Mango 400 0 8 2 1E+30
Warunki ograniczające Wartość Cena Prawa strona Dopuszczalny Dopuszczalny
Komórka Nazwa końcowa dualna w. o. wzrost spadek$H$2 Raw Material 4600 1 4600 250 150$H$3 Hours of labor 4750 0 5000 1E+30 250$H$4 Quantity all 950 3 950 50 100$H$5 Qunatity mango 400 -2 400 37,5 125
ExerciseProblem C: • What property exists after we increase the price of the peach gloss to exactly $5?. Problem D: • What is the reduced cost of a basic variable? Explain!Problem E: (Assume max problem!) • Here is an optimal simplex tableau: determine the reduced cost of variable c:
Problem C: If we increase the price of cream by 1, then we are indifferent about pivoting it into the basis. Thus there exist multiple optimal solutions. Problem D: Reduced costs for max problems are non-positive. They tell us how much we need to increase the price of a product by before we start producing it. If we are already producing it (i.e., it is basic) it has a reduced cost of zero. Problem E : The reduced cost of c is -2 .
Type of Change 3: Changing a Right Hand Side Coefficient
“Uggh! You won’t believe this. After seeing me on Newlyweds, MTV decided it would be profitable to make a reality show where instead of having 4600 of raw materials, I have only 4499 .What should I do (that is, what happens to the optimal solution)?”, Jessica from Maui
Solution:• Step 1: Determine if the right hand side
change is within the allowable range• Step 2: If so the optimal basis will NOT
change, and we can use the shadow price of the constraint to determine the change in the optimal objective value.
Microsoft Excel 12.0 Raport wrażliwościArkusz: [example.xlsx]ProblemRaport utworzony: 2013-03-12 12:07:18
Komórki decyzyjne Wartość Przyrost Współczynnik Dopuszczalny Dopuszczalny
Komórka Nazwa końcowa krańcowy funkcji celu wzrost spadek$B$6 Decision variables Peach 0 -1 4 1 1E+30$C$6 Decision variables Pineapple 400 0 6 0,666666667 0,5$D$6 Decision variables Orange 150 0 7 1,000000001 0,5$E$6 Decision variables Mango 400 0 8 2 1E+30
Warunki ograniczające Wartość Cena Prawa strona Dopuszczalny Dopuszczalny
Komórka Nazwa końcowa dualna w. o. wzrost spadek$H$2 Raw Material 4600 1 4600 250 150$H$3 Hours of labor 4750 0 5000 1E+30 250$H$4 Quantity all 950 3 950 50 100$H$5 Qunatity mango 400 -2 400 37,5 125
Definition: . The shadow price of the i-th constraint is the amount by which the optimal Z-Value of the LP is improved if the RHS is increased by one unit.
VERY IMPORTANT: The Shadow Price of the i-th constraint is ONLY valid within the RHS range of the i-th constraint.
ExerciseProblem F: What is the change in the objective function if the number of
available labor hours changes to 4800? What if this number is 4700?Problem G: . What can you tell me about the shadow price of a “≥
constraint”? How about an “= constraint”?
Problem F: Step 1: If the number is 4800, then the change is within the allowable decrease of 250, and the current basis remains optimal. Step 2: The shadow price of the labor constraint is zero. Why? Thus the change in the objective is 0 × 200 = 0. If the number if 4700, this is a decrease of 300 and we are outside the allowable range. Can you say anything about this case? Problem G: A “≥ constraint” for a maximization problem always has a nonpositive shadow price. Intuitively, if we increase the RHS, then we further restrict the feasible region, which can not make us better off! We can say nothing about the sign of an “= constraint”. It could be positive, negative, or 0.
Type of Change 4: Purchasing Extra Resources
“Guys, My sister Ashlee just lost her recording contract. I know, it’s shocking. Anyway, she needs a job; she is willing to work for 1 hour. She also said she could convert her unit of talent into a unit of raw material, whatever that means. What is the most I should pay for the unit of raw materials and for her?”, Jessica
Solution: Each increases is within the range. So, we can use the
shadow prices to determine the change in objective if either change takes place. But we cannot assume that changing both is OK.
• The Raw Material SP is 1, corresponding to a revenue increase of $1 if we accept the offer. Thus to breakeven or profit we should pay no more then $1 for the unit
• The Labor SP is 0, resulting in no additional revenue if we hire Ashley. And you say our models don’t reflect reality!!!
Microsoft Excel 12.0 Raport wrażliwościArkusz: [example.xlsx]ProblemRaport utworzony: 2013-03-12 12:07:18
Komórki decyzyjne Wartość Przyrost Współczynnik Dopuszczalny Dopuszczalny
Komórka Nazwa końcowa krańcowy funkcji celu wzrost spadek$B$6 Decision variables Peach 0 -1 4 1 1E+30$C$6 Decision variables Pineapple 400 0 6 0,666666667 0,5$D$6 Decision variables Orange 150 0 7 1,000000001 0,5$E$6 Decision variables Mango 400 0 8 2 1E+30
Warunki ograniczające Wartość Cena Prawa strona Dopuszczalny Dopuszczalny
Komórka Nazwa końcowa dualna w. o. wzrost spadek$H$2 Raw Material 4600 1 4600 250 150$H$3 Hours of labor 4750 0 5000 1E+30 250$H$4 Quantity all 950 3 950 50 100$H$5 Qunatity mango 400 -2 400 37,5 125
Exercise
Problem H • Suppose now that Raw Materials cost $5 per unit . Suppose
Johnny Knoxville offers to sell you an addition unit for $.50 Should you take the deal? What is the break-even price?
Problem I Same for labor as problem H
Problem H The key is to interpret the shadow price as follows: If Jessica can buy one more unit at $4, then profits increase by $1 since the shadow price is 1. Thus Jessica could pay 4+1=5 and profits will increase by 1-1=0. Thus the most Jessica should pay is 5. Since 4.5 is less then 5, she should take the deal. Problem I TThe shadow price here is 0. We are not using all of the labor we are given. Additional labor is worthless, and we should not pay for it.
• “Hey Yall, I just got the best idea for a new flavor of Lip Gloss called Limonette. To make some, 8 units of raw material are needed and 7 hours of labor are needed. If I sell it for $7, will any be produced?”, Jessica
Solution:• Step 1: Determine if the right hand side change is within the allowable range.• Step 2: Price out to calculate the reduced cost.
Type of Change 5: A New Product
Peach Pineapple Orange Mango Limonette
Raw material 2 3 4 7 8
Hours of labor 3 4 5 6 7
Sale price ($) 4 6 7 8 7
“reduced cost”: 7 - [ 3 * 1 – 2 * 0 + 1 * 8 + 0 * 7 ] = -4
One more altogether
Mango does not increase
Microsoft Excel 12.0 Raport wrażliwościArkusz: [example.xlsx]ProblemRaport utworzony: 2013-03-12 12:07:18
Komórki decyzyjne Wartość Przyrost Współczynnik Dopuszczalny Dopuszczalny
Komórka Nazwa końcowa krańcowy funkcji celu wzrost spadek$B$6 Decision variables Peach 0 -1 4 1 1E+30$C$6 Decision variables Pineapple 400 0 6 0,666666667 0,5$D$6 Decision variables Orange 150 0 7 1,000000001 0,5$E$6 Decision variables Mango 400 0 8 2 1E+30
Warunki ograniczające Wartość Cena Prawa strona Dopuszczalny Dopuszczalny
Komórka Nazwa końcowa dualna w. o. wzrost spadek$H$2 Raw Material 4600 1 4600 250 150$H$3 Hours of labor 4750 0 5000 1E+30 250$H$4 Quantity all 950 3 950 50 100$H$5 Qunatity mango 400 -2 400 37,5 125
Type of Change 6: Parametrics “Guys, what would a graph of the optimal objective value look like that
used the amount of available raw materials as a parameter?” Definitely not Jessica Simpson
Solution: • In the allowable range (4450,4850), profit is linear in raw materials and
the slope is equal to the shadow price value (1)• We do the same for values outside this interval. • In the respective intervals, the function is linear. In general it is
concave.
Profit as a function of raw materials
3000 3080 3160 3240 3320 3400 3480 3560 3640 3720 3800 3880 3950 4030 4110 4190 4270 4350 4430 4510 4590 4670 4750 4830 4910 4990 5070 51500
1000
2000
3000
4000
5000
6000
7000
8000
Exercise
Problem I • What type of function is our graph? Problem J • Is it possible for an optimal BFS to have more than one
shadow price correspond to a constraint?
Problem N: It is a piecewise linear concave graph Problem O: Yes it is. When an LP has multiple optimal solutions multiple shadow prices are possible. This occurred at the breakpoints of our graph
Degenerate solutionsUp until now we have assumed all BFS’s were non degenerate. What happens if a
basis is degenerate? Three Oddities Occur When a BFS is degenerate • Oddity 1: In the RANGE IN WHICH THE BASIS IS UNCHANGED at least one
constraint will have a 0 AI or AD. This means that for at least one constraint, the SHADOW PRICE can tell us about the new z-value for either an increase or decrease in the RHS, but not both.
• Oddity 2: For a nonbasic variable to become positive, a nonbasic variable’s objective function coefficient may have to be improved by more than its REDUCED COST.
• Oddity 3: Increasing a variable’s objective function coefficient by more than its AI or decreasing it by more than its AD may leave the optimal solution the same.
Remember when performing analysis, always ask first if the current BFS is degenerate. If so follow the rules on this slide
Lecture summary
• Using Excel to determine information • Shadow prices • Determining upper and lower bounds so that
the shadow price remains valid. • Changes in cost coefficients. • Key Idea: never go into business with Jessica
Simpson