Over the last years, I have worked on various research projects requiring the combination of simulation and optimization methods. It is a powerful tool to investigate complex setting with different input and influencing factors. I mostly use the simulation software package AnyLogic to accomplish this, which allows one to add optimization procedures coded in Java. This post provides an example of such a combination with AnyLogic.
Let’s refer again to the previously introduced disaster relief setting. It assumes random and dynamic demand to be served by relief forces. Each shipment originates north of the river and has to be brought to a store south of the river, denoted in green. Transshipment of goods can only be performed at one of the blue dots, however, due to operational constraints, only a limited number of transshipment points can be operated simultaneously. Consequently, the solution procedures have to find the best set of points considering various uncertainties in the system. To accomplish this, the system runs a Tabu Search, which uses an agent-based simulation to evaluate solutions and model randomness. Furthermore, routing and GIS integration is facilitated.
The following video gives a short examples. It contains of three steps: (i) running the simulation with all transshipments (blue) points open; (ii) running an optimization procedure to find the most promising ones; (iii) presenting the solution.
The implementation of this simulation optimization framework in AnyLogic was done in the following way:
- Create the simulation
As a first step, a simulation is created. Agents are identified and processes are modeled.
- Create a ‘Custom experiment’ in AnyLogic
To integrate the optimization procedure, a custom experiment is created. Therefore, the optimization procedure can be coded directly within the custom experiment or called externally. In our case, we use a metaheuristic solution procedure based on Tabu Search. It uses multiple simulation runs to evaluate a single setting. The custom experiments changes input parameter, runs the simulation multiple times and returns the solution value of a setting. To enable such computations efficiently, make sure to increase memory and run simulation replications in parallel. See the AnyLogic API reference on class ExperimentCustom for additional implementation guidance.
- Return the results of the optimization procedure to AnyLogic
In the presented case, open hubs are indicated with a binary variable, set and updated by the optmization procedure. At the start of a run, the simulation checks which points are active. With more recent versions of AnyLogic (starting from AnyLogic 7.2), this changes can be further directly implemented in the built-in database.
- Re-run the simulation with the adjusted input
The next run of the simulation automatically presents the optimization results to the user. Furthermore, you can output results and present statistics in multiple ways. One other interesting option is to start multiple optimization experiments to analyze the impact of varying parameters (e.g., the number of transshipment points to select or demand volume).
As shown, simulation optimization enables the investigation of various scenarios under uncertain conditions. Nevertheless, run times and the resulting trade-off between improving and evaluating solutions are common obstacles, which have to be closely considered when developing such procedures.
– Fikar, C, Gronalt, M, Hirsch, P (2016) A decision support system for coordinated disaster relief distribution. Expert Systems with Applications 57, 104-116. DOI: http://dx.doi.org/10.1016/j.eswa.2016.03.039; Kudos: http://goo.gl/wRwrC8
– AnyLogic – Multimethod Simulation Software: http://www.anylogic.com/