19 fixed costs and variable bounds
play

19. Fixed costs and variable bounds Fixed cost example Logic and - PowerPoint PPT Presentation

CS/ECE/ISyE 524 Introduction to Optimization Spring 201718 19. Fixed costs and variable bounds Fixed cost example Logic and the Big M Method Example: facility location Variable lower bounds Laurent Lessard


  1. CS/ECE/ISyE 524 Introduction to Optimization Spring 2017–18 19. Fixed costs and variable bounds ❼ Fixed cost example ❼ Logic and the Big M Method ❼ Example: facility location ❼ Variable lower bounds Laurent Lessard (www.laurentlessard.com)

  2. Example: ClothCo ClothCo is capable of manufacturing three types of clothing: shirts, shorts, and pants. Each type of clothing requires that ClothCo have the appropriate type of machine available. The machines can be rented at a fixed weekly cost. The manufacture of each type of clothing also requires some amount of cloth and labor, and returns some profit, indicated below. Each week, 150 hours of labor and 160 sq yd of cloth are available. How should ClothCo tune its production to maximize profits? Note: If we don’t produce a particular item, we don’t pay the rental cost! Labor Cloth Profit Machine Clothing per item per item per item rental item 3 hours 4 ✩ 6 ✩ 200/wk. Shirt 2 hours 3 ✩ 4 ✩ 150/wk. Shorts 6 hours 4 ✩ 7 ✩ 100/wk. Pants 19-2

  3. Example: ClothCo Obvious decision variables: ❼ x 1 ≥ 0: number of shirts produced each week ❼ x 2 ≥ 0: number of shorts produced each week ❼ x 3 ≥ 0: number of pants produced each week ❼ Constraints: 3 x 1 + 2 x 2 + 6 x 3 ≤ 150 (labor budget) 4 x 1 + 3 x 2 + 4 x 3 ≤ 160 (cloth budget) ❼ Maximize weekly profit: 6 x 1 + 4 x 2 + 7 x 3 ❼ Still need to account for machine rental costs... 19-3

  4. Example: ClothCo Binary variables: � 1 if any shirts are manufactured ❼ z 1 = 0 otherwise � 1 if any shorts are manufactured ❼ z 2 = 0 otherwise � 1 if any pants are manufactured ❼ z 3 = 0 otherwise ❼ Maximize net weekly profit: 6 x 1 + 4 x 2 + 7 x 3 − 200 z 1 − 150 z 2 − 100 z 3 19-4

  5. Example: ClothCo Optimization model: maximize 6 x 1 + 4 x 2 + 7 x 3 − 200 z 1 − 150 z 2 − 100 z 3 x , z subject to: 3 x 1 + 2 x 2 + 6 x 3 ≤ 150 (labor budget) 4 x 1 + 3 x 2 + 4 x 3 ≤ 160 (cloth budget) x i ≥ 0 , z i ∈ { 0 , 1 } if x i > 0 then z i = 1 ❼ We need to find an algebraic representation for the relationship between x i and z i . 19-5

  6. Detour: logic! How do we represent: “if x > 0 then z = 1”? ❼ Statements of the form “if P then Q ” are written as: P = ⇒ Q ❼ This is equivalent to the contrapositive : ¬ Q = ⇒ ¬ P ❼ But this is not equivalent to the converse : Q = ⇒ P 19-6

  7. Detour: logic! P : I am on the swim team. Q : I know how to swim. ❼ Basic statement ( P = ⇒ Q ) true “if I’m on the swim team, then I know how to swim” ❼ Contrapositive ( ¬ Q = ⇒ ¬ P ) also true “if I don’t know how to swim, then I’m not on the swim team” ❼ Converse ( Q = ⇒ P ) not true “if I know how to swim, then I’m on the swim team” 19-7

  8. Detour: logic! How do we represent: “if x > 0 then z = 1”? ❼ Contrapositive: “if z = 0 then x ≤ 0” ❼ Since x ≥ 0, this is the same as: “if z = 0 then x = 0” ❼ Model this as: x ≤ Mz where M is any upper bound on the optimal x opt ≤ M . This is called the “Big M method”. 19-8

  9. Example: ClothCo Optimization model: maximize 6 x 1 + 4 x 2 + 7 x 3 − 200 z 1 − 150 z 2 − 100 z 3 x , z subject to: 3 x 1 + 2 x 2 + 6 x 3 ≤ 150 (labor budget) 4 x 1 + 3 x 2 + 4 x 3 ≤ 160 (cloth budget) x i ≥ 0 , z i ∈ { 0 , 1 } x i ≤ M i z i ❼ Where M i is an upper bound on x i . ❼ IJulia notebook: ClothCo.ipynb 19-9

  10. Example: ClothCo We can choose very large bounds, e.g. M i = 10 5 ... ...or we can choose M i using constraints! ❼ 3 x 1 + 2 x 2 + 6 x 3 ≤ 150 (labor budget) Since we have x i ≥ 0, we have the obvious bounds: x 1 ≤ 50, x 2 ≤ 75, x 3 ≤ 25 ❼ 4 x 1 + 3 x 2 + 4 x 3 ≤ 160 (cloth budget) Using a similar argument, we conclude that: x 1 ≤ 40, x 2 ≤ 54, x 3 ≤ 40 ❼ Combining these bounds, we obtain: x 1 ≤ 40, x 2 ≤ 54, x 3 ≤ 25 19-10

  11. Choosing an upper bound It’s generally desirable to pick the smallest possible M Simple example: � � � P = 0 ≤ x ≤ 5 , z ∈ { 0 , 1 } � if x > 0 then z = 1 � z 1 0 x 0 1 2 3 4 5 6 7 8 9 10 19-11

  12. Choosing an upper bound � � � upper bounding: P 1 = 0 ≤ x ≤ 5 , z ∈ { 0 , 1 } � x ≤ 10 z � z 1 0 x 0 1 2 3 4 5 6 7 8 9 10 � � � LP relaxation: P 2 = 0 ≤ x ≤ 5 , 0 ≤ z ≤ 1 � x ≤ 10 z � z 1 Bad! 0 x 0 1 2 3 4 5 6 7 8 9 10 19-12

  13. Choosing an upper bound � � � tightest bound: P 3 = 0 ≤ x ≤ 5 , 0 ≤ z ≤ 1 � x ≤ 5 z � z 1 Good! 0 x 0 1 2 3 4 5 6 7 8 9 10 Same as the convex hull of the original set! z 1 0 x 0 1 2 3 4 5 6 7 8 9 10 19-13

  14. Simple facility location problem ❼ Facilities : I = { 1 , 2 , . . . , I } ❼ Customers : J = { 1 , 2 , . . . , J } ❼ c ij is the cost for facility i to serve customer j . (e.g. transit cost) ❼ Each customer must be served and I there is no limit on how many J customers each facility can serve. Even easier than an assignment problem! Simply assign each customer to the cheapest facility for them: � � � minimum cost = min i ∈I c ij j ∈J 19-14

  15. Simple facility location problem LP formulation � � minimize c ij y ij y j ∈J i ∈I � subject to: y ij = 1 for all j ∈ J i ∈I y ij ≥ 0 for all i ∈ I and j ∈ J ❼ no reason to use the LP formulation for this problem, but we’ll use this formulation as a starting point for a modified version of the problem. 19-15

  16. Uncapacitated facility location ❼ Facilities : I = { 1 , 2 , . . . , I } ❼ Customers : J = { 1 , 2 , . . . , J } ❼ c ij is the cost for facility i to serve customer j . (e.g. transit cost) ❼ f i is the cost to build facility i . We can choose which ones to build. I ❼ No limit on how many customers J each facility can serve. Let S ⊆ I be the subset of the facilities we choose to build. This is a much more difficult (NP-complete) problem. �� �� � � minimum cost = min f i + min i ∈S c ij S i ∈S j ∈J 19-16

  17. Uncapacitated facility location MIP formulation � � � minimize f i z i + c ij y ij y , z i ∈I j ∈J i ∈I � subject to: y ij = 1 for all j ∈ J i ∈I y ij ∈ { 0 , 1 } for all i ∈ I and j ∈ J z i ∈ { 0 , 1 } for all i ∈ I if z i = 0 then y ij = 0 for all j ∈ J ❼ need to find an upper bound on y ij ≤ M so we can write the logical constraint as: y ij ≤ Mz i . 19-17

  18. Uncapacitated facility location MIP formulation � � � minimize f i z i + c ij y ij y , z i ∈I j ∈J i ∈I � subject to: y ij = 1 for all j ∈ J i ∈I y ij ∈ { 0 , 1 } for all i ∈ I and j ∈ J z i ∈ { 0 , 1 } for all i ∈ I if z i = 0 then y ij = 0 for all j ∈ J ❼ First option: y ij ≤ z i for all i ∈ I and j ∈ J . ❼ Clever simplification: � j ∈J y ij ≤ Jz i for all i ∈ I . ❼ (or is it?) Julia notebook: UFL.ipynb 19-18

  19. Uncapacitated facility location Random instance of the problem with I = J = 100, and f i , c ij uniform in [0 , 1]. Solved using JuMP+Cbc. ❼ clever constraint: � j ∈J y ij ≤ Jz i for all i ∈ I . ◮ Optimal solution found (all variables binary) in 4.2 sec. ◮ Same solution found if we let 0 ≤ y ij ≤ 1. Now 3.7 sec. ❼ tighter constraint: y ij ≤ z i for all i ∈ I and j ∈ J . ◮ Optimal solution found (all variables binary) in 0.65 sec. ◮ Same solution found if we let 0 ≤ y ij ≤ 1. Now 0.45 sec. ◮ Same solution if we also let 0 ≤ z i ≤ 1. Now 0.02 sec. ❼ about 15 facilities selected 19-19

  20. Uncapacitated facility location Random instance of the problem with I = J = 100, and f i = 0 . 5, c ij uniform in [0 , 1]. Solved using JuMP+Cbc. ❼ clever constraint: � j ∈J y ij ≤ Jz i for all i ∈ I . ◮ Optimal solution found (all variables binary) in 32 min. ◮ Same solution found if we let 0 ≤ y ij ≤ 1. Now 15 min. ❼ tighter constraint: y ij ≤ z i for all i ∈ I and j ∈ J . ◮ Optimal solution found (all variables binary) in 3.3 min. ◮ Same solution found if we let 0 ≤ y ij ≤ 1. Now 3.8 min. ◮ Non-integer if we also let 0 ≤ z i ≤ 1. Now 0.025 sec. ❼ about 10 facilities selected Be careful with integer programs! 19-20

  21. Solver comparison ❼ f i = 0 . 5 and c ij uniform in [0 , 1]. ❼ the z i are binary and 0 ≤ y ij ≤ 1. ❼ disaggregated constraint y ij ≤ z i . comparison of different solvers 10 3 GLPK 10 2 Cbc time to solve (seconds) Mosek 10 1 Gurobi 10 0 10 -1 10 -2 10 -3 10 20 30 40 50 60 70 80 90 100 number of facilities and customers ❼ Most solvers are substantially slower if we use the aggregated constraint instead. Gurobi is just as fast in both cases. 19-21

  22. Recap: fixed costs ❼ Producing x has a fixed cost if the cost has the form: � f + cx if x > 0 cost = 0 if x = 0 ❼ Define a binary variable z ∈ { 0 , 1 } where: � 1 if x > 0 z = 0 if x = 0 ❼ The constraint becomes: x ≤ Mz where M is any upper bound of x . ❼ The cost becomes: fz + cx ❼ Small M ’s are usually better! 19-22

  23. Variable lower bounds (lower bounds that vary, not lower bounds on variables!) We have a variable x ≥ 0, but we want to prevent solutions where x is small but not zero, for example x = 0 . 001. ❼ Model the constraint: “either x = 0 or 3 ≤ x ≤ 10”. ❼ Define a binary variable z ∈ { 0 , 1 } that characterizes whether we are dealing with the case x = 0 or the case 3 ≤ x ≤ 10. The set we’d like to model: z 1 0 x 0 1 2 3 4 5 6 7 8 9 10 19-23

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend