A short introduction to embedded optimization Tecnomatix Plant Simulation Worldwide User Conference June 22nd, 2016 Realize innovation. A short introduction to embedded optimization Table of content 1. Simulation and Optimization 2. Genetic Algorithms 3. Basic Objects for Genetic Algorithms 4. Sequence Optimization 5. Optimization as an Integrated Component 6. Approximation Solutions for Stochastic Models 19 3 6 9 11 16 Page 2
1. Simulation and Optimization Connections of Simulation and Optimization 1. The simulation is used as evaluation function of optimization We are looking for optimal parameters for a model. By systematic changes of parameters we can determine a satisfactory model configuration. Optimize r Modification Evaluation Model 2. The optimization is an integrated component of a simulation. A parent simulation is interrupted and an optimization of the current state is performed. Simulation time Optimize r A further structural connections is the use of simulation results as starting values for an optimization. See Chapter 11: L. Iitzsche, P. Schmidt, S, Völker in Lothar März, Winfried Krug, Oliver Rose, Gerald Weigert (Hrsg.) Simulation und Optimierung in Produktion und Such optimization is possibly based on pure calculations. Page 3 1. Simulation and Optimization Characteristic properties of Optimization Problems In most applications multiple targets are considered which have opposite nature and must be described in a single numerical evaluation value. Combination of several input parameter settings 1. Determination of sequences 2. Dimensioning of production resources. Solving of Trade-off 1. Reduce throughput times by prevention of waiting time 2. Just-in-time delivery 3. Reduction of the warehouse stock and associated costs We distinguish so called basic tasks 1. Sequence tasks (find a numbering of a finite set) 2. Allocation tasks (find a value of a finite range). Page 4
1. Simulation and Optimization Exact and Heuristic Methods for Optimization Problems Basic tasks are well examined in Operations Research. The algorithms Branch & Bound and Dynamic Programming for the Traveling Salesman Problem are described in the Example Collection (open via the Start Page). For basic tasks with practical important problem size and combined tasks there are no efficient algorithms, which find the optimal solution in reasonable computational time. Therefore heuristic methods are used, like Hill- Climbing, Simulated Annealing, Tabu Search and Genetic Page 5 Algorithms (shorted by GA). 2. Genetic Algorithms Genetic Algorithms are iterative stochastic search algorithms based on natural mechanisms of the biological evolution. GA operate on a set of solutions of a combined basic problems. The notions Generation, Individuals and Chromosomes All properties of living organisms are coded in the biologic material DNA in a sequential manner. All solutions, which are currently under consideration in a certain optimization step, form a Generation. A solution of the combined task is called an Individual. A solution of an basic task is considered as Chromosome. Page 6
2. Genetic Algorithms The Ideas and the Structure of Genetic Algorithms Genetic Algorithms model natural processes of the evolution. The Evolution Cycle Initialization The Fitness of the individuals describes, how well it is adapted to the environment. This evaluation is determined by the combination of their elementary properties. The Fitness can be determined by simulation or calculation. Evaluation Termination condition Parent selection Stop 1. Recombination: Use of properties of previous generation (Selection of 2 Parents according to the fitness) 2. Mutation: Generate 2 children per family by random application of Genetic Operations, like Crossover, Mutation, Inversion 3. Page Selection: 7 Select one offspring per family (child or Genetic Operators Evaluation Offspring selection 2. Genetic Algorithms The number of resulting evaluations Each new generated individual must be evaluated. The first generation has the Generation size individuals. All following generations have Generation size families. Each family has 2 children, which must be evaluated. Number of evaluations = Generation size * (2 * Number of Generations - 1) Please note, that in a stochastic simulation study an evaluations needs more than 1 simulation runs (observations). Page 8
3. Basic Objects for Genetic Algorithms Five Basic Objects for the Optimization by GA The controller GAOptimization Number and size of generations, Direction of the optimization (minimum or maximum) Termination condition Definition of the selection of parents and offspring Controls, such as for the fitness calculation Recording of generated individuals The other four objects are GA tables for basic tasks and its Genetic Operators. GASequence: Sequence task for a given number of items GASelection: Selection task of a certain number of elements a given number of items GARangeAllocation: Determine an item of a range between two bounds GASetAllocation: Determine an item of a set of elements Page 9 3. Basic Objects for Genetic Algorithms How do the Basic Objects work Determine the maximum of Rastigrin s Function: Fitness = 20 u*u - cos(2*pi*u) v*v - cos(2*pi*v) for GA -1 < are u,v well < 1suited for problems with multiple peaks with similar fitness. In our examples we have four maxima (± 0.5, ± 0.5) with the same value 21,5. The picture is generated by: www.wolframalpha.com Page 10
4. Sequence Optimization We will find the sequence of the Delivery table of the source, such that the throughput time for the given orders is minimal. The throughput time is determined by the setup matrix. The Plant Simulation model for a deterministic study in English class library is generated by executing a meth Start Plant Simulation with the shortcut opt /UILanguage:ENU. For this example the resulting throughput time is 8 + Siemens 1 + 6 AG + 2016 2 + 2 + 3 + 3 + 9 + 4 + 4 = 42. Page 11 The optimal solution is obvious. Create a model with model language Engli Select the Menu File > Preferences > Tab G 4. Sequence Optimization The evaluation of a sequence is done by simulation. For the optimization we apply the GAwizard. The fitness calculation can be defined as a weighted sum of multiple simulation results in the table Fitness. Drag & Drop the Eventcontroller onto the GAwizard. There are no general recommendations for the parameters of the Genetic Algorithm. For sequence tasks a generation size between 50 and 70 is suitable. Page 12
4. Sequence Optimization Press the Shift-Key and Drag & Drop the Delivery table of the source onto the GAwizard. The optimization is started on the second tab of the GAwizard. The results of the optimization can be displayed on the third tab. Page 13 4. Sequence Optimization After the optimization the best solution which was found is set in the model. You find the best different solutions on the third tab. Page 14
4. Sequence Optimization Visualization the Optimization Progress The Performance Graph shows a typical appearance of Genetic Algorithms. It is opened by the button Evolution. The worst individual in a generation also improves if a better individual is found. Page 15 5. Optimization as an Integrated Component Sequence Optimization during the simulation Scenario and Target In a line of two types of products are produced. The arrival process of the products is at random. To achieve an uniform utilization of following resources long partial sequences of single products type should not occur. During the production process the sequence is optimized. Idea In a buffer (modeled by the basic object Sorter) multiple products are collected. For this purpose the entrance and the exit of the buffer are controlled by an Observer method for the value Page 16numMU.
5. Optimization as an Integrated Component Online-Optimization If at the beginning of a simulation not all data are available then multiple sequencings are necessary. This leads to smaller number of items of the sequence compared to the full size of the problem. Evaluation by Rules Unwanted sequences are evaluated by a bad fitness. The evaluation of a sequence is done by one or more criteria and is performed by rules. The result of a rule describes the penalty for the forconsidered local j := 1 sequence: to sequence.ydim - 1 loop if sequence[1, j].name = sequence[1, j+1].name then result := result + 1 end; next; See Chapter 17: C. Heib, S. Nickel in Lothar März, Winfried Krug, Oliver Rose, Gerald Weigert (Hrsg.) Simulation und Optimierung in Produktion und Logistik, Sprin Page 17 5. Optimization as an Integrated Component Result: The Line which succeed the Buffer shows short partial sequences of single products. Page 18
6. Approximation Solutions for Stochastic Models By the model we consider a combination of a sequence and parameter optimization of a stochastic simulation study. It is impossible to solve an optimization problem for a stochastic model. But in practice approximation suboptimal solutions are frequently sufficient. Page 19 6. Approximation Solutions for Stochastic Models The definition of the combined optimization problem. Since we want to minimize the throughput time and the buffer capacity we weight their values. Since there are random components, we perform 5 observations per individual. Page 20
Thank you for your attention! Dr. Peter-Michael Schmidt QA Leader Group Plant Simulation / Germany/ R&D Weissacher Straße 11 70499 Stuttgart Phone: +49 711 13 89 266 Fax: +49 711 13 89 299 Mobile: +49 1577 1593699 E-mail: petermichael.schmidt@siemens.com siemens.com Page 21