Presentation on theme: "DMOR Linear Programming 2. Solving LPs – general case Till now we talked about the standard form – Maximization – Constraints of the form – RHS of the."— Presentation transcript:
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 = 12x 1 + 5x 2 – 7x 3 – max (–Z) = –12x 1 – 5x 2 + 7x 3 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 a 1 [artificial variable] An artificial variable differs from a slack variable – we have to make it zero, because point (x 1,x 2,s 1,s 2,a 1 ) = (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: a 1 ); 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 = a 1 + a 2 + a 3 + … – max –W + a 1 + a 2 + a 3 + … = 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
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 3x 1 + 5x 2 20 3x 1 + 5x 2 s 1 = 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: 3x 1 + 5x 2 s 1 + a 1 = 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 maximization x1 2 x2 = 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 = 2 x2 + a1 = 3 x1 + x2 – s2 + a2 = 4
Variables that may be negative Two possibilities: 1.Lower bound E.g. production level can fall no more than L j from the present level x j L j Solution – change of variables x j = x j + L j 2.No bounds at all: next slide
No bounds on a variable Unbounded variable x j is replaced by the difference between two nonnegative variables x j = x j + – x j - 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 x j + > 0 then x j = x j + – If x j - > 0 then x j = - x j -, – If x j + =x j - = 0 then x j = 0. If we have a lot of unbounded variables we use for each of them one variable x j -. In the optimal solution x j - will be the absolute value of the most negative variable x j. Variables x j + 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 my cosmetic 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 PeachPineappleOrangeMango Raw material 2347 Hours of labor 3456 Sale price ($) 4678
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 0400150400 Objective function6650
Sensitivity report Should it look like this? Microsoft Excel 12.0 Raport wrażliwości Arkusz: [example.xlsx]Problem Raport utworzony: 2013-03-12 12:07:53 Komórki decyzyjne WartośćPrzyrost KomórkaNazwakońcowamarginalny $B$6Decision variables Peach0-1,000001907 $C$6Decision variables Pineapple4000 $D$6Decision variables Orange1500 $E$6Decision variables Mango4000 Warunki ograniczające WartośćMnożnik KomórkaNazwakońcowaLagrange'a $H$2Raw Material46001 $H$3Hours of labor47500 $H$4Quantity all9503 $H$5Qunatity mango400-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ści Arkusz: [example.xlsx]Problem Raport utworzony: 2013-03-12 12:07:18 Komórki decyzyjne WartośćPrzyrostWspółczynnikDopuszczalny KomórkaNazwakońcowakrańcowyfunkcji celuwzrostspadek $B$6Decision variables Peach0411E+30 $C$6Decision variables Pineapple400060,6666666670,5 $D$6Decision variables Orange150071,0000000010,5 $E$6Decision variables Mango4000821E+30 Warunki ograniczające WartośćCenaPrawa stronaDopuszczalny KomórkaNazwakońcowadualnaw. o.wzrostspadek $H$2Raw Material46001 250150 $H$3Hours of labor4750050001E+30250 $H$4Quantity all9503 50100 $H$5Qunatity mango400-240037,5125 Decision variables 0400150400 Objective function6650
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.
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 wasnt 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?
Exercise Problem 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 wont 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.
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.
Exercise Problem 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, its 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 dont reflect reality!!!
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 T The 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
PeachPineappleOrangeMangoLimonette Raw material 23478 Hours of labor 34567 Sale price ($) 46787 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ści Arkusz: [example.xlsx]Problem Raport utworzony: 2013-03-12 12:07:18 Komórki decyzyjne WartośćPrzyrostWspółczynnikDopuszczalny KomórkaNazwakońcowakrańcowyfunkcji celuwzrostspadek $B$6Decision variables Peach0411E+30 $C$6Decision variables Pineapple400060,6666666670,5 $D$6Decision variables Orange150071,0000000010,5 $E$6Decision variables Mango4000821E+30 Warunki ograniczające WartośćCenaPrawa stronaDopuszczalny KomórkaNazwakońcowadualnaw. o.wzrostspadek $H$2Raw Material46001 250150 $H$3Hours of labor4750050001E+30250 $H$4Quantity all9503 50100 $H$5Qunatity mango400-240037,5125
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.
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 solutions Up until now we have assumed all BFSs 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 variables objective function coefficient may have to be improved by more than its REDUCED COST. Oddity 3: Increasing a variables 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