basics of optimi z ation
play

Basics of optimi z ation SU P P LY C H AIN AN ALYTIC S IN P YTH ON - PowerPoint PPT Presentation

Basics of optimi z ation SU P P LY C H AIN AN ALYTIC S IN P YTH ON Aaren St u bber eld S u ppl y Chain Anal y tics Mgr . What is a s u ppl y chain A S u ppl y Chain consist of all parties in v ol v ed , directl y or indirectl y, in f u l


  1. Basics of optimi z ation SU P P LY C H AIN AN ALYTIC S IN P YTH ON Aaren St u bber � eld S u ppl y Chain Anal y tics Mgr .

  2. What is a s u ppl y chain A S u ppl y Chain consist of all parties in v ol v ed , directl y or indirectl y, in f u l � lling a c u stomer ’ s req u est . ¹ Incl u des : S u ppliers Internal Man u fact u ring O u tso u rced Logistics S u ppliers ( i . e . Third Part y S u ppliers ) 1 Chopra , S u nil , and Peter Meindl . _ S u ppl y Chain Management : Strateg y, Planning , and Operations ._ Pearson Prentice - Hall , 2007. SUPPLY CHAIN ANALYTICS IN PYTHON

  3. What is a s u ppl y chain optimi z ation In v ol v es � nding the best path to achie v e an objecti v e based on constraints SUPPLY CHAIN ANALYTICS IN PYTHON

  4. Crash co u rse in LP Linear Programing ( LP ) is a Po w erf u l Modeling Tool for Optimi z ation Optimi z ation method u sing a mathematical model w hose req u irements are linear relationships There are 3 Basic Components in LP : Decision Variables - w hat y o u can control Objecti v e F u nction - math e x pression that u ses v ariables to e x press goal Constraints - math e x pression that describe the limits of a sol u tions SUPPLY CHAIN ANALYTICS IN PYTHON

  5. Introd u ctor y e x ample Use LP to decide on an e x ercise ro u tine to b u rn as man y calories as possible . P u sh u p R u nning Min u tes 0.2 per p u sh u p 10 per mile Calories 3 per p u sh u p 130 per mile Constraint - onl y 10 min u tes to e x ercise SUPPLY CHAIN ANALYTICS IN PYTHON

  6. Basic components of an LP Decision Variables - What w e can control : N u mber of P u sh u ps & N u mber of Miles Ran Objecti v e F u nction - Math e x pression that u ses v ariables to e x press goal : Ma x (3 * N u mber of P u sh u ps + 130 * N u mber of Miles ) Constraints - Math e x pression that describe the limits of a sol u tions : 0.2 * N u mber of P u sh u ps + 10 * N u mber of Miles ≤ 10 N u mber of P u sh u ps ≥ 0 N u mber of Miles ≥ 0 SUPPLY CHAIN ANALYTICS IN PYTHON

  7. E x ample sol u tion Optimal Sol u tion : 50 P u sh u ps 0 Miles Ran Calories B u rned : 150 SUPPLY CHAIN ANALYTICS IN PYTHON

  8. LP v s IP v s MIP Terms Decision Variables Linear Programing ( LP ) Onl y Contin u o u s Integer Programing ( IP ) Onl y Discrete or Integers Mi x ed Integer Programing ( MIP ) Mi x of Contin u o u s and Discrete SUPPLY CHAIN ANALYTICS IN PYTHON

  9. S u mmar y De � ned S u ppl y Chain Optimi z ation De � ned Linear Programing and Basic Components Decision Variables Objecti v e F u nction Constraints De � ned LP v s IP v s MIP SUPPLY CHAIN ANALYTICS IN PYTHON

  10. Let ' s practice ! SU P P LY C H AIN AN ALYTIC S IN P YTH ON

  11. Basics of P u LP modeling SU P P LY C H AIN AN ALYTIC S IN P YTH ON Aaren St u bber � eld S u ppl y Chain Anal y tics Mgr .

  12. What is P u LP PuLP is a modeling frame w ork for Linear ( LP ) and Integer Programing ( IP ) problems w ri � en in P y thon Maintained b y COIN - OR Fo u ndation ( Comp u tational Infrastr u ct u re for Operations Research ) PuLP interfaces w ith Sol v ers CPLEX COIN Gurobi etc … SUPPLY CHAIN ANALYTICS IN PYTHON

  13. P u LP e x ample – reso u rce sched u ling Cons u ltant for bo u tiq u e cake baker y that sell 2 t y pes of cakes 30 da y month There is : 1 o v en 2 bakers 1 packaging packer – onl y w orks 22 da y s SUPPLY CHAIN ANALYTICS IN PYTHON

  14. P u LP e x ample – reso u rce sched u ling Di � erent reso u rce needs for the 2 t y pes of cakes : Cake A Cake B O v en 0.5 da y s 1 da y Bakers 1 da y 2.5 da y s Packers 1 da y 2 da y s . Cake A Cake B Pro � t $20.00 $40.00 SUPPLY CHAIN ANALYTICS IN PYTHON

  15. P u LP e x ample – reso u rce sched u ling Objecti v e is to Ma x imi z e Pro � t Pro � t = 20* A + 40* B S u bject to : A ≥ 0 B ≥ 0 0.5 A + 1 B ≤ 30 1 A + 2.5 B ≤ 60 1 A + 2 B ≤ 22 SUPPLY CHAIN ANALYTICS IN PYTHON

  16. Common modeling process for P u LP 1. Initiali z e Model 2. De � ne Decision Variables 3. De � ne the Objecti v e F u nction 4. De � ne the Constraints 5. Sol v e Model SUPPLY CHAIN ANALYTICS IN PYTHON

  17. Initiali z ing model - LpProblem () LpProblem(name='NoName', sense=LpMinimize) name = Name of the problem u sed in the o u tp u t . lp � le , i . e . " M y LP Problem " sense = Ma x imi z e or minimi z e the objecti v e f u nction Minimi z e = LpMinimize ( defa u lt ) Ma x imi z e = LpMaximize SUPPLY CHAIN ANALYTICS IN PYTHON

  18. P u LP e x ample – reso u rce sched u ling 1. Initiali z e Model from pulp import * # Initialize Class model = LpProblem("Maximize Bakery Profits", LpMaximize) SUPPLY CHAIN ANALYTICS IN PYTHON

  19. Define decision v ariables - LpVariable () LpVariable(name, lowBound=None, upBound=None, cat='Continuous', e=None) name = Name of the v ariable u sed in the o u tp u t . lp � le lowBound = Lo w er bo u nd upBound = Upper bo u nd cat = The t y pe of v ariable this is Integer Binar y Contin u o u s ( defa u lt ) e = Used for col u mn based modeling SUPPLY CHAIN ANALYTICS IN PYTHON

  20. P u LP e x ample – reso u rce sched u ling 1. Initiali z e Class 2. De � ne Variables # Define Decision Variables A = LpVariable('A', lowBound=0, cat='Integer') B = LpVariable('B', lowBound=0, cat='Integer') SUPPLY CHAIN ANALYTICS IN PYTHON

  21. P u LP e x ample – reso u rce sched u ling 1. Initiali z e Class 2. De � ne Variables 3. De � ne Objecti v e F u nction # Define Objective Function model += 20 * A + 40 * B SUPPLY CHAIN ANALYTICS IN PYTHON

  22. P u LP e x ample – reso u rce sched u ling 1. Initiali z e Class 2. De � ne Variables 3. De � ne Objecti v e F u nction 4. De � ne Constraints # Define Constraints model += 0.5 * A + 1 * B <= 30 model += 1 * A + 2.5 * B <= 60 model += 1 * A + 2 * B <= 22 SUPPLY CHAIN ANALYTICS IN PYTHON

  23. P u LP e x ample – reso u rce sched u ling 1. Initiali z e Class 2. De � ne Variables 3. De � ne Objecti v e F u nction 4. De � ne Constraints 5. Sol v e Model # Solve Model model.solve() print("Produce {} Cake A".format(A.varValue)) print("Produce {} Cake B".format(B.varValue)) SUPPLY CHAIN ANALYTICS IN PYTHON

  24. P u LP e x ample – reso u rce sched u ling from pulp import * # Define Constraints model += 0.5 * A + 1 * B <= 30 # Initialize Class model += 1 * A + 2.5 * B <= 60 model = LpProblem("Maximize Bakery Profits", model += 1 * A + 2 * B <= 22 LpMaximize) # Solve Model # Define Decision Variables model.solve() A = LpVariable('A', lowBound=0, print("Produce {} Cake A".format(A.varValue)) cat='Integer') print("Produce {} Cake B".format(B.varValue)) B = LpVariable('B', lowBound=0, cat='Integer') # Define Objective Function model += 20 * A + 40 * B SUPPLY CHAIN ANALYTICS IN PYTHON

  25. S u mmar y P u LP is a P y thon LP / IP modeler Re v ie w ed 5 Steps of P u LP modeling process 1. Initiali z e Model 2. De � ne Decision Variables 3. De � ne the Objecti v e F u nction 4. De � ne the Constraints 5. Sol v e Model Completed Reso u rce Sched u ling E x ample SUPPLY CHAIN ANALYTICS IN PYTHON

  26. Let ' s practice ! SU P P LY C H AIN AN ALYTIC S IN P YTH ON

  27. Using lpS u m SU P P LY C H AIN AN ALYTIC S IN P YTH ON Aaren St u bber � eld S u ppl y Chain Anal y tics Mgr .

  28. Mo v ing from simple to comple x Simple Baker y E x ample More Comple x Baker y E x ample # Define Decision Variables # Define Decision Variables A = LpVariable('A', lowBound=0, cat='Integer') A = LpVariable('A', lowBound=0, cat='Integer') B = LpVariable('B', lowBound=0, cat='Integer') B = LpVariable('B', lowBound=0, cat='Integer') C = LpVariable('C', lowBound=0, cat='Integer') D = LpVariable('D', lowBound=0, cat='Integer') E = LpVariable('E', lowBound=0, cat='Integer') F = LpVariable('F', lowBound=0, cat='Integer') SUPPLY CHAIN ANALYTICS IN PYTHON

  29. Mo v ing from simple to comple x Objecti v e F u nction of Comple x Baker y E x ample # Define Objective Function model += 20*A + 40*B + 33*C + 14*D + 6*E + 60*F Need method to scale SUPPLY CHAIN ANALYTICS IN PYTHON

  30. Using lpS u m () lpSum(vector) Therefore ... # Define Objective Function vector = A list of linear e x pressions model += 20*A + 40*B + 33*C + 14*D + 6*E + 60*F Eq u i v alent to ... # Define Objective Function var_list = [20*A, 40*B, 33*C, 14*D, 6*E, 60*F] model += lpSum(var_list) SUPPLY CHAIN ANALYTICS IN PYTHON

  31. lpS u m w ith list comprehension # Define Objective Function cake_types = ["A", "B", "C", "D", "E", "F"] profit_by_cake = {"A":20, "B":40, "C":33, "D":14, "E":6, "F":60} var_dict = {"A":A, "B":B, "C":C, "D":D, "E":E, "F":F} model += lpSum([profit_by_cake[type] * var_dict[type] for type in cake_types]) SUPPLY CHAIN ANALYTICS IN PYTHON

  32. S u mmar y Need w a y to s u m man y v ariables lpSum() Used in list comprehension SUPPLY CHAIN ANALYTICS IN PYTHON

  33. Practice time ! SU P P LY C H AIN AN ALYTIC S IN P YTH ON

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