Transcription

Developing Optimization Algorithmsfor Real-World ApplicationsGautam Ponnappa PC – Training EngineerViju Ravichandran, PhD – Education Technical Evangelist 2015 The MathWorks, Inc.1

2

“For a given system, it is the selection of a best element, with regard tosome criteria, to achieve best results”3

Optimization“For a given system, it is the selection of a best element, with regard tosome criteria, to achieve optimal results”4

Agenda Why Optimization? Optimization Workflow Problem Formulation using MATLAB– Multiperiod Production Planning– Need for Discrete Event Simulation– Batch Production Process5

Why use optimization?Manually (trial-and-error or iteratively)InitialGuess6

Why use optimization?Automatically (using optimization techniques)InitialGuess7

Why use optimization? Finding better (optimal) designs Faster Design Evaluations Useful for trade-off analysisAntenna Design Using Genetic rch/antenna.htm Non-intuitive designs may be found8

Optimization WorkflowSystem9

Optimization WorkflowInitialDesignVariablesSystem10

Optimization 1

Optimization t?YesOptimalDesign12

Optimization lesSystemObjectivesmet?YesOptimalDesign13

Traveling Salesman ProblemProblem How to find the shortest path through a series of points?Solution Calculate distances between all combinations of pointsSolve an optimization problem where variables correspond to trips between twopoints101000111014

Optimization Solution for Traveling Salesman ProblemDecision variables: Binary vector based on whether the trip exists or notObjective: Minimize the distance traveledConstraints: Each stop on only two tripsSolver: Integer Linear Programming Algorithmopts costopt,exitflag,output] 5

Optimization Solution for Traveling Salesman ProblemDecision variables: Binary vector based on whether the trip exists or notObjective: Minimize the distance traveledConstraints: Each stop on only two tripsSolver: Integer Linear Programming Algorithmopts costopt,exitflag,output] 6

Optimization Solution for Traveling Salesman ProblemDecision variables: Binary vector based on whether the trip exists or notObjective: Minimize the distance traveledConstraints: Each stop on only two tripsSolver: Integer Linear Programming Algorithmopts costopt,exitflag,output] 7

Data Analytics WorkflowPreprocess lsFilesWorking withMessy DataModel Creation e.g.Machine LearningOptimal DecisionsDesktop AppsDatabasesData ConstraintsEnterprise nWhat-if AnalysisEmbedded Devicesand HardwareAccess andExplore DataIntegrateAnalytics withSystems18

Steps in Optimization ModelingGet overall idea of the systemWhat is the goal? What are you trying to achieve?Identify variablesIdentify constraintsIdentify the inputs and outputs you can controlSpecify all quantities mathematicallyCheck the model for completeness and correctness19

Adaptive building energy management20

actualtemperatureTemperatureComfort boundstemperaturesetpoint24 C25% costreduction21 temperaturesetpointComfort bounds24 C21 CTIME0:008:0018:000:0021

Production Plant Case Study22

Objective: To maximize profits while meeting demand23

Decision Variables Two decision variables– Quantities of fertilizer blends that you make and sell each month– Raw ingredients that we use to make those blends Additionally, create a variable that represents the inventory at each time.24

Objective Function Objective function for this problem is profit, which we want to maximize To calculate the objective function in terms of the problem variables,calculate the revenue and costs.25

Constraints Connection among production, sales, and inventory– Final inventory is fixed– Total inventory at each time is bounded– Produce a limited amount in each time period26

Solution27

Any other approach? Initialise/Tune decision variables Simulate dynamic systemsIterate Collect Simulation output Check if optimal criterion is met28

Batch Production Process Need to produce 2 types of chemical compounds in batches to meetincoming demand Production environment uses 4 shared resources(Reactors, water pumps,heaters and drains)29

Batch Production Process Huge backlog of orders with current resources, not able to meet demand30

Optimization Problem?How many batch reactors, water pumps, heaters and drains do I need topurchase so that backlog is minimized, without spending a lot on myproduction environment?31

Process cycleACustomerOrderBQueueBatchReactorsHeat, cooland drainCompletedOrders32

Simulation environmentTime-Based Simulation: Simulink Integrators, Filters, Mathematical computation blocks Modeling environment based on a set of solvers for solving differential and/ordifference equationsEvent-Based Simulation: SimEvents Generators, Queues, Servers, and Router blocks Producing and processing entities (e.g. packets, planes, raw material)33

Discrete Event Simulation Simulation of real-world processes wherein there might be a series ofinstantaneous occurrences(events), or discrete events to model behavior ofprocessesFocus on service and transit time, utilization and throughput34

Discrete-event modeling in SimulinkSimEventsProduction lineOrderSequenceEntitiesAttributesOrder queueProcessing unitQueueServerWait timeOrders completedOrders not on timeAverage wait statisticEntities departedEntities timed outMaximize fulfillmentMinimize wait timeMaximize throughputMinimize latency35

SimEvents Model for Batch Production Process36

Order (Entities)37

Order (Entities)38

Order queue (Queue)39

Processing Unit (Server)40

Statistics41

Optimization ModelDecision variables: Number of each type of resource:––––batch reactorswater tanksheatersdrainsObjective: Minimize weighted sum of the backlog as computedby the simulation model and the cost of the resourcesConstraints: Resources are integral; upper and lower limitsSolver: Genetic Algorithm42

Optimization Model Group the decision variables into an array Specify upper and lower bounds on thedecision variables Specify that the decision variables musthave integer values43

Optimization Model Write a function that callsthe simulation in order tocompute the objectivefunction value44

Optimization Model Solve45

Conclusion46

Steps in Optimization ModelingGet overall idea of the systemWhat is the goal? What are you trying to achieve?Identify variablesIdentify constraintsIdentify the inputs and outputs you can controlSpecify all quantities mathematicallyCheck the model for completeness and correctness47

Getting started with Optimization using MATLAB Optimization examples:– im/examples.html Optimization Decision table:– im/ug/optimization-decisiontable.html Discrete Event Simulation examples:– events/examples.html48

MathWorks Training OfferingsMATLAB FundamentalsThis three-day course provides a comprehensive introduction to the MATLAB technical computingenvironment. No prior programming experience or knowledge of MATLAB is assumed. Themes of dataanalysis, visualization, modeling, and programming are explored throughout the course. Topics include: Working with the MATLAB user interface Entering commands and creating variables Analyzing vectors and matrices Visualizing vector and matrix data Working with data files Working with data types Automating commands with scripts Writing programs with branching and loops Writing functions49

MathWorks Training OfferingsOptimization Techniques using MATLABThis one-day course introduces applied optimization in the MATLAB environment, focusing on usingOptimization Toolbox and Global Optimization Toolbox . Topics include: Running optimization problems in MATLAB Specifying objective functions Specifying constraints Choosing solvers and algorithms Evaluating results and improving performance Using global optimization methods50

MathWorks Training OfferingsSimEvents for Discrete-Event System ModelingThis one-day course focuses on modeling event-driven systems in Simulink using SimEvents . Topicsinclude: Creating discrete-event models Defining attributes and event actions Controlling queue and server behavior Developing variable model topologies using routing and resources Integrating discrete-event and time-domain systems Determining optimal system parameters51

Contact usSpeakers’ DetailsContact MathWorks IndiaEmail:Products/Training Enquiry [email protected]: [email protected]: handran Share your session feedback:Please fill in your feedback for this session in the feedback form52

Simulation environment Time-Based Simulation: Simulink Integrators, Filters, Mathematical computation blocks Modeling environment based on a set of solvers for solving differential and/or difference equations Event-Based Simulation: SimEvents Generators, Queues, Servers, and Router blocks