What is Monte Carlo simulation?

Monte Carlo simulations are a way of obtaining accurate estimates when working with uncertainties. They use randomness to obtain meaningful information and are effective for calculating business risks and predicting failures such as cost or scheduling overruns.

The technique was developed by Stanislav Ulam and John von Neumann during their top-secret work on nuclear weapons in the 1940s as part of the Manhattan Project. The Monte Carlo name came from needing to assign a code word to the technique and, somewhat unlike the method’s results, the Monte Carlo name was not determined by chance.

Ulam’s colleague Nicholas Metropolis, possibly inspired by the story of Ulam’s gambling uncle who wagered relatives’ money in Monte Carlo, suggested naming the technique after the principality’s famous casino. The name stuck and the technique has been widely applied ever since.

The technique is a powerful way to improve decision making and can be used to make accurate long-term forecasts. It is also known as the Monte Carlo Method and multiple probability simulation.

Monte Carlo with Excel or simulation modeling?

For some challenges, such as those easily captured in formulas, Monte Carlo simulation can be carried out using a regular spreadsheet. Microsoft gives examples of the types of problems that can be tackled in their Introduction to Monte Carlo simulation in Excel, they include tasks such as finding the number of items to order with respect to demand probabilities.

Models created in Excel are driven by simple mathematical relationships and formulas. So, Monte Carlo experiments take the form of repeatedly plugging random numbers from distributions into a model’s formulas until a spectrum of probable results forms.

However, when the challenge at hand is very hard or impossible to satisfactorily represent with formulas, another way is needed. This is where simulation software such as AnyLogic comes in.

If the underlying model is a dynamic simulation, the model can be complex, non-linear, and vary over time. Additionally, the model can have internal randomness so that, irrespective of the inputs being either random or deterministic, the inner workings of the model can also have random elements. In this way, the input parameters of a call center model, for example, may include the number of personnel and callers while, internal to the model, call length varies randomly from run to run.

Andrei Borschsev and Ilya Grigoryev’s Big Book of Simulation Modeling covers in detail the topic of Randomness in AnyLogic models [PDF, Chapter 15 (updated 2020)].

When a system is captured in a simulation model, each part of the system and how it works is modeled so that when the simulation runs, the system’s behavior becomes apparent over time. Representing a system in this way means it is not necessary to describe all a system’s processes with formulas, such as with Excel, and this gives us the possibility to analyze very complex systems and scenarios.

Monte Carlo in the cloud

Part of the reason Ulam was able to develop the Monte Carlo technique was due to his work with von Neumann and access to newly advanced computing power.

Monte Carlo simulations need to iterate many times to produce useful results and consequently benefit from fast computer processing. When models are very complex and dynamic, processing requirements can become significant and run times very long. This reduces possibilities for what-if experimentation and may limit the usefulness of a model in decision making.

AnyLogic simulations automatically take advantage of multi-core processors and will run Monte Carlo iterations in parallel to reduce experiment times. For even more processing power, AnyLogic simulations can also access resources made available by cloud computing. Experiments with complex simulation models and the need for many iterations can benefit from a server farm’s many high-powered processing cores to scale the number of parallel iterations and replications.

The publicly accessible version of AnyLogic Cloud has several examples that demonstrate the functionality of Monte Carlo simulation and cloud computing.

The Interconnected Call Centers cloud model shown below features a Monte Carlo experiment.

AnyLogic Cloud also features a Monte Carlo 2nd Order experiment. This experiment enables multiple replications and iterations so that both an experiment’s input parameters and internal parameters are randomly set according to a probability distribution. For example, a consumer credit application model could vary the ratio of online and offline applications (an input parameter) as well as application processing times (internal parameters). A Monte Carlo 1st Order experiment would only randomize a model’s internal parameters.

If a consumer credit business only had limited data about the distribution of online and offline applications, the Monte Carlo 2nd Order experiment could help analyze staffing levels against a range of different application ratio scenarios. This would help the company plan and be more resilient to changes in application trends.

The Consumer Credit Application cloud simulation shown below features a Monte Carlo 2nd Order experiment.

The examples above are hosted in the public AnyLogic Cloud and accessed via a web browser for simplicity. However, the AnyLogic Cloud platform is highly adaptable and configurable. Companies can create and integrate their own cloud simulation solutions that can be hosted privately or in-house, use custom interfaces, and be accessed by RESTful API (see our blogs for JavaScript and Python). Learn more about how to run an AnyLogic Monte Carlo simulation in the online AnyLogic help and AnyLogic Cloud help .

Monte Carlo simulation applications in business

Monte Carlo simulation is useful for a wide range of challenges in business, such as the relatively simple determination of probable product demand or the calculation of complex business risks. These applications of Monte Carlo simulation are possible due to developments in modern computation. As companies gain greater access to more powerful multi-core processors and cloud computing, the challenges that can be met with simulation and Monte Carlo optimization will continue to expand.

AnyLogic enables Monte Carlo simulation for highly complex systems. With multimethod modeling, simulated systems can be complex, dynamic, and non-linear. The results from these simulation models can come from parallel processing and cloud computing and made available in a variety of ways, including via API and custom UI.