IE 312 Optimization Siggi Olafsson 3018 Black olafsson@iastate.edu 1 Optimization In this class you will learn to solve industrial engineering problems by modeling them as optimization problems You will understand common optimization algorithms for solving such problems You will learn the use of software for solving complex problems, and you will work as part of a team to address complex ill-structured problems with multiple solutions 2 3 Optimization Formulation Decision variables: xi Number of appetizer i Integer programming problem: 6 max x i 1 s.t. i 2.15 x1 2.75 x2 3.35 x3 3.55 x4 4.20 x5 5.80 x6 15.05 xi integer This is a variant of what is called the knapsack problem 4 How about the traveling salesman? What is the shortest route that visits each city exactly once? 5 The Process Problem Problem Formulation Model Analysis Conclusions 6 Problem Formulation What is the objective function? What are the decision variables? Maximize profit, Minimize inventory, ... Capacity, routing, production and stock levels What are the constraints? Capacity is limited by capital Production is limited by capacity 7 Mathematical Programs Objective/constraints Linear Non-linear Continuous Linear Non-linear Programming (LP) Programming (NLP) Discrete Integer Programming (IP), Mixed IP (MIP) NLIP, NLMIP 8 Analysis Optimization Algorithm Computer Implementation Excel (or other spreadsheet) Optimization software (e.g., LINDO) Modeling software (e.g., LINGO) Increasing Complexity 9 Optimization Algorithms Find an initial solution Loop: Look at “neighbors” of current solution Select one of those neighbors Decide if to move to selected solution Check stopping criterion 10 In This Class You Will … Learn problem formulation (modeling) Learn selecting appropriate algorithms Learn using those algorithms 11 Academic Honesty You are expected to be honest in all of your actions and communications in this class. Students suspected of committing academic dishonesty will be referred to the Dean of Students Office as per University policy. For more information regarding Academic Misconduct see http://www.dso.iastate.edu/ja/academic/misconduct.html 12 Professionalism You are expected to behave in a professional manner during this class. 13 The OR Process Problem (System) Problem Formulation Model Analysis Conclusions 14 Problem Formulation Capture the essence of the system Variables Relationships Ask ourselves: What is the objective? What are the decision variables? What are the constraints? 15 Mortimer Middleman Wholesale diamond business sale price $900/carat average order 55 carats/week International market purchase price $700/carat minimum order 100 carats/trip trip takes one week and costs $2000 16 Inventory Problem Cost of keeping inventory insurance tied up capital 0.5% of wholesale value/week Cost of not keeping inventory lost sales (no backordering) 17 The Current Situation Holding cost of $38,409 in past year Unrealized profits of $31,600 Resupply travel cost $24,000 Total of $94,009 Can we do better? How do we start answering that question? 18 Problem Formulation What are the decision variables? When should we order? How much should we order? Reorder point r (quantity that trigger order) Order quantity q Note that this grossly simplifies the reality of Mortimer’s life! 19 Problem Formulation What are the constraints? q 100 r0 What is the objective? Minimize cost Holding cost Replenishment cost Lost-sales cost 20 Relationships (System Dynamics) Assumptions Constant-rate demand Is this a strong or weak assumption? Is this assumption realistic? 21 System Dynamics With safety stock No safety stock or lost sales With lost sales r r 1 week r 1 week 1 week Why might we get lost sales despite our planning? Can we ignore this? 22 Assuming No Lost Sales No lost sales implies r 55 Cycle length order quantity q demand rate 55 Average inventory (r 55) (r 55) q q (r 55) 2 2 23 Optimization Model Holdingcost/week Minimize Subject to ent cost/week Replenishm q 2000 3.50 (r 55) 2 q / 55 q 100 r 55 24 Solving the Problem (Analysis) Feasible solution Optimal solution Any set of values that satisfies the constraints A feasible solution that has the best possible objective function value Algorithms: Find a feasible solution Try to improve on it 25 A Solution for Mortimer What are some feasible solutions? The smallest feasible value of r is 55 What happens if we change it to 56? Increased holding cost! ‘Clearly’ the optimal replenishment point is r * 55 26 New Optimization Problem Holdingcost/week Minimize Subject to ent cost/week Replenishm 55 q 3.50 2000 q 2 q 100 Differentiate the objective function and set equal to zero: 3.50 2000 55 0 2 2 q 27 Optimal Solution 3.50 2000 55 2 q2 2 2000 55 2 q 3.50 2 2000 55 250.7 * q 3.50 250.7 Optimum 28 Economic Order Quantity (EOQ) Cost of replenishment Classical result in inventory theory: q * 2 fd h Holding cost r * ld Lead time (replenishment) Weekly demand 29 Discussion Sensitivity Analysis Exploring how the results change if parameters change Why is this important? Closed-Form Solutions Final result a simple formula in terms of the input variables Very fast computationally Makes sensitivity analysis very easy 30 Evaluating the Model Tractability of Model Validity Ease by which we can analyze the model The degree by which inferences drawn from model also hold for actual system Trade-Off! A “Good” Model is Tractable and Valid 31 Model Validity A model is valid for a specific purpose It only has to answer the questions we ask correctly! Recipe for a Good Model Start with a simple model Evaluate assumptions Does adding complexity change the outcome? Relax assumption/add constraint 32 Validity of Our Model Customer demand (average 55) 120 100 60 40 20 51 49 47 45 43 41 39 37 35 33 31 29 27 25 23 21 19 17 15 13 11 9 7 5 3 0 1 Demand 80 Week 33 Simulation Analysis Using the same conceptual model, we can simulate the performance using the historical data Check if Mortimer is due with a shipment Check if a new trip is warranted Reduce inventory by actual demand Simulation of our policy q=251, r=55 implies a cost of $108,621 34 Evaluation of Cost Our predicted cost is Holdingcost/week Replenishment cost/week 55 251 3.50 $45,630 2000 251 2 Mortimer’s current cost is $94,009 The simulated cost is $108,621 35 Simulation Validity Which model should we trust: Examine the assumptions made: The simulation model that predicts a performance of $108,621, or the EOQ model that predicts a performance of $45,630? EOQ model: constant demand Simulation: future identical to past In general, simulation models have a high degree of validity 36 Descriptive vs Prescriptive How about tractability? What does the simulation tell us? How easy is it to do sensitivity analysis? Descriptive models Only evaluate an alternative or solution Prescriptive models Suggest a good (or optimal) alternative 37 Numerical Search We can use our descriptive simulation model to look for a better solution Algorithm: Start with an initial (good) solution Check ‘similar’ solution (neighbors) Select one of the neighbors Repeat until a stopping criterion is satisfied 38 Search for Reorder Point 100 $64,242 r 90 80 70 60 50 40 30 20 10 0 $63,054 $63,254 $108,421 $108,621 0 50 100 150 q 200 250 300 39 Search for Order Quantity 100 90 $72,781 80 70 60 r 50 40 30 20 10 0 240 245 $63,054 $95,193 Best Point Found 250 255 260 265 q 40 Evaluation We have found a solution q=251, r=85 with cost $63,054 Better than current ($94,009) and previously obtained solution ($108,621) Is this the best solution? We don’t know! What if we started with a different initial solution? 41 A New Search Initial Solution 155 59,539 135 56,904 56,900 59,732 58,467 54,193 115 r Best Point Found 95 75 55 250 255 260 265 270 275 q 42 Heuristic vs Optimal Optimal Solution Heuristic Solution Solution that is gives the best objective function value A ‘good’ feasible solution Should we demand optimality? Inaccurate search vs approximation in model 43 Deterministic vs Stochastic Models Our deterministic simulation model assumed future identical to past Not true! Demand is random Stochastic simulation fits a random distribution to the historical data The world is stochastic Why not always use stochastic models? Tractability versus validity 44 Mathematical Programming Deterministic models Assume all data known with certainty Validity Tractability Often produce valid results Easier than stochastic models Known as mathematical programming 45 Problem Formulation Decision variables Constraints Variable-type constraints Main constraints Objective function 46 Two Crude Petroleum $20 9000 barrels/day Gasoline 2000 barrels Jet Fuel 1500 barrels Lubricants 500 barrels Saudi Arabia Refinery Venezuela $15 6000 barrels/day 47 Oil Processing Data Barrel of Saudi Crude 0.3 barrels of gasoline 0.4 barrels of jet fuel 0.2 barrels of lubricant Barrel of Venezuela Crude 0.4 barrels of gasoline 0.2 barrels of jet fuel 0.3 barrels of lubricant 48 Decision Variables What can we control or decide upon? How much of each crude Thus, define x1 barrels of Saudi crude/day (in thousa nds) x2 barrels of Venezuelan crude/day (in thousa nds) Clearly define what you mean! 49 Constraints Variable-type constraints Domain of decision variables (most often a range) Very simple here: x1 , x2 0 50 Main Constraints (Dynamics) Must meet our volume for each type yield/barrel barrels required 0.3x1 0.4 x2 2.0 (gasoline) 0.4 x1 0.2 x2 1.5 (jet fuel) 0.2 x1 0.3x2 0.5 (lubricant s) Availability x1 9 x2 6 51 Objective Function What are we going to use to evaluate a pair of values for the decision variables? Minimize total cost min 20 x1 15x2 Note that since sales and production are fixed this maximizes profit 52 Standard Model min 20 x1 15x2 s.t. 0.3 x1 0.4 x2 2.0 (gasoline) 0.4 x1 0.2 x2 1.5 (jet fuel) 0.2 x1 0.3 x2 0.5 (lubricant s) x1 9 x2 6 x1 , x2 2 53 Graphing Constraints x2 Variable-Type Constraints (must be positive) x1 54 Adding Main Constraints x2 0.3 x1 0.4 x2 2 2 6.67 0.3 2 x1 0, x2 5.00 0.4 x2 0, x1 x1 55 Next Constraint x2 0.4 x1 0.2 x2 1.5 1.5 3.75 0.4 1.5 x1 0, x2 7.50 0.2 0.2 x1 0.3x2 0.5 x2 0, x1 x1 0.5 x2 0, x1 2.50 0.2 0.5 x1 0, x2 1.67 0.3 56 Final Constraints x2 Feasible Region x2 6 x1 6 x1 57 Objective Function x2 20 x1 15x2 x1 150 60 105 58 Optimal Solution x2 20 x1 15x2 20 2 15 3.5 92.5 x1 3.5 x1 2 x1 59 Variant x2 Many Optimal Solutions! x1 3.5 x1 2 x1 60 Types of Solutions Unique Optimum Multiple Optima No Optimum No feasible solution (empty feasible set) Unbounded feasible set 61 Exercise max 3w1 w2 max 3w1 w2 s.t. w1 w2 1 s.t. w1 w2 1 w1 , w2 0 w1 , w2 0 Q. Which of the above has and optimal solution and which is unbounded? 62 Last Time Formulated Two Crude Petroleum Problem Solved (Analyzed) the Model Graphed the constraints Found the most desirable extreme point Can this approach be generalized to realistic problem? 63 Pi Hybrids Actual application Manufacturer of Corn Seed l=20 production facilities m=25 hybrid varieties n=30 sales regions Want to look at the production and distribution operations 64 Constants Cost per bag of each hybrid at each facility Processing capacity of each facility (bushels) Bushels of corns needed for a bag of hybrid Bags of hybrid demanded by each region Cost per bag of shipping each hybrid from each facility to each customer region 65 Indexing Variables Initial ‘structure’ x f ,h number of bags of hybrid h produced at facility f f 1,2,..., l ; h 1,2,..., m y f ,h ,r number of bags of h shipped from f to region r f 1,2,..., l ; h 1,2,..., m; r 1,2,..., m. Have lm =500 x-variables and lmn =1500 y-variables 66 Defining Cost Define p f ,h cost per bag of producing hybrid h at facility f Then the total production cost is l m p f 1 h 1 Summing over all facilities f ,h x f ,h Summing over all hybrids 67 More Definitions u f capacity of facility f in bushels ah number of bushels needed for a bag of hybrid h d h ,r number of bags of h demanded in region r s f ,h ,r cost per bag of shipping h from f to r 68 Objective Function Have Total Cost = Production Cost + Shipping Cost which implies an objective function l min m p f 1 h 1 l f ,h m n x f ,h s f ,h,r y f ,h,r f 1 h 1 r 1 69 Constraints Capacity constraints m h 1 f 1,2,..., l. ah bushels/bag x f ,h u f bags Demands must be met Balance between production and distribution 70 Complete Model l min m p f 1 h 1 s.t. l f ,h a x h 1 f 1 h 1 r 1 f ,h l y f 1 r 1 u f , f f ,h ,r d h ,r , h, r f ,h ,r x f ,h , f , h n y n x f ,h s f ,h,r y f ,h,r m h m x f ,h 0; y f ,h ,r 0 71 Model Size Variables 500 x-variables 1500 y-variables Constraints l =20 capacity constraints mn =750 demand constraints lm = 500 balance constraints lm + lmn = 15500 non-negativity constraints 72 Tractability and Validity Is this a tractable model? Yes, it is actually not very big at all! Is this a valid model? Constant production cost Deterministic demand Reasonable for certain range of production Reasonable for known products/markets Constant shipping cost Reasonable for certain range of shipped items 73 Mathematical Programming General Model min/ max f ( x1 ,..., xn ) g ( x1 ,..., xn )bi Constants Right Hand Side (RHS) 74 Linear versus Nonlinear A function is linear if it is a weighted sum of the decision variables, otherwise nonlinear A linear program (LP) has a linear objective function f and constraint functions g1,…,gm A nonlinear program has at least one nonlinear function 75 Exercise (a) min (3y1 11 y4 ) 5 s.t. d j 1 j yj y j 1, j (c) (b) min (3y1 11 y4 ) 2 5 s.t. d j 1 j yj y j 1, j 5 min y j 1 s.t. j y1 y2 100 y j 1, j Linear or nonlinear? 76 Integer Programs A variable is discrete if it can only take a limited or countable number of values A variable is continuous if it can take values in a specific interval Mathematical programs can be continuous discrete (integer/combinatorial) mixed 77 Classification Summary Integer Program (IP) Linear Program (LP) ILP Nonlinear Program (NLP) INLP Increased difficulty 78 Exercise Should these variables be discrete or continuous? Operating temperature of a chemical process Warehouse slot assigned to a particular product Whether a capital project is selected for investment Amount of money converted from yen to dollars Number of aircraft produced on a defense contract 79