# Simulation Tutorial - Introduction

## Simulation

**Simulation** is a flexible methodology we can use to analyze the behavior of a present or proposed business activity, new product, manufacturing line or plant expansion, and so on (analysts call this the 'system' under study). By **performing simulations** and **analyzing the results**, we can gain an understanding of how a present system operates, and what would happen if we changed it -- or we can estimate how a proposed *new* system would behave. Often -- but not always -- a simulation deals with **uncertainty**, in the system itself, or in the world around it.

#### Simulation Applications

Simulation is one of the most widely used quantitative methods -- because it is so flexible and can yield so many useful results. Here's just a sample of the applications where simulation is used:

- Choosing drilling projects for oil and natural gas
- Evaluating environmental impacts of a new highway or industrial plant
- Setting stock levels to meet fluctuating demand at retail stores
- Forecasting sales and production requirements for a new drug
- Planning aircraft sorties and ship movements in the military
- Planning for retirement, given expenses and investment performance
- Deciding on reservations and overbooking policies for an airline
- Selecting projects with uncertain payoffs in capital budgeting

#### Simulation Models

In a simulation, we perform experiments on a **model** of the real system, rather than the real system itself. We do this because it is faster, cheaper, or safer to perform experiments on the model. While simulations can be performed using physical models -- such as a scale model of an airplane -- our focus here is on simulations carried out on a computer.

Computer simulations use a **mathematical model** of the real system. In such a model we use **variables** to represent key numerical measures of the inputs and outputs of the system, and we use formulas, programming statements, or other means to express mathematical relationships between the inputs and outputs. When the simulation deals with uncertainty, the model will include **uncertain variables** -- whose values are not under our control -- as well as **decision variables** or parameters that we *can* control. The uncertain variables are represented by **random number generators** that return sample values from a representative distribution of possible values for each uncertain element in each experimental **trial** or **replication** of the model. A **simulation run** includes many hundreds or thousands of trials.

Our simulation model -- often called a **risk model** -- will calculate the impact of the uncertain variables and the decisions we make on outcomes that we care about, such as profit and loss, investment returns, environmental consequences, and the like. As part of our model design, we must choose how numerical values for the uncertain variables will be **sampled** on each trial.

#### Simulation Methods

Complex manufacturing and logistics systems often call for **discrete event simulation**, where there are "flows" of materials or parts, people, etc. through the system, and many steps or stages with complex interrelationships. Special simulation modeling languages are often used for these applications.

But a great many situations -- including almost all of the examples above -- have been successfully handled with **simulation models** created in a spreadsheet using Microsoft Excel. This minimizes the learning curve, since you can apply your spreadsheet skills to create the model. Simple steps or stages, such as inventory levels in different periods, are easy to represent in columns of a spreadsheet model. You can solve a wide range of problems with **Monte Carlo simulation** of models created in Excel, or in a programming language such as Visual Basic, C++ or C#.

Running a simulation generates a great deal of statistical data, that must be analyzed with appropriate tools. Professional simulation software, such as Frontline Systems' **Risk Solver**, allows you to easily create charts and graphs, a wide range of statistics and risk measures, perform sensitivity analysis and parameterized simulations, and use advanced methods for **simulation optimization**.

#### Monte Carlo Simulation

**Monte Carlo simulation** -- named after the city in Monaco famed for its casinos and games of chance -- is a powerful method for studying the behavior of a system, as expressed in a mathematical model on a computer. As the name implies, **Monte Carlo methods** rely on **random sampling** of values for uncertain variables, that are "plugged into" the simulation model and used to calculate outcomes of interest. With the aid of software, we can obtain statistics and view charts and graphs of the results. To learn more, consult our **Monte Carlo simulation** tutorial.

Monte Carlo simulation is especially helpful when there are several **different sources **of uncertainty that interact to produce an outcome. For example, if we're dealing with uncertain market demand, competitors' pricing, and variable production and raw materials costs **at the same time**, it can be very difficult to estimate the impacts of these factors -- in combination -- on Net Profit. Monte Carlo simulation can **quickly analyze thousands** of 'what-if' scenarios, often yielding surprising insights into what can go right, what can go wrong, and what we can do about it.