0% found this document useful (0 votes)
14 views18 pages

CSC 408

Simulation and modeling

Uploaded by

marynaty667
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views18 pages

CSC 408

Simulation and modeling

Uploaded by

marynaty667
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

Lecture Notes: MODELLING & SIMULATION by Dr Nwafor Godwin O

CSC 408-MODELLING & SIMULATION

CHAPTER A : Introduction to Simulation


1.1 What is Simulation?

Simulation is the process of designing a model of a real system and conducting experiments with
this model to understand its behavior and evaluate various strategies for its operation.

• It mimics real-world processes over time.

• Allows safe, cost-effective testing before implementation.

1.2 Importance of Simulation

• Real-world experimentation is expensive or impractical.

• Many systems are too complex for analytical solutions.

• Enables experimentation with “what-if” scenarios.

2. Characteristics of Simulation

• Represents dynamic behavior over time.

• Often involves random variables (e.g., arrival times, service times).

• Requires model validation and verification.

• Output is typically statistical in nature and requires analysis.

3. Types of Simulation

3.1 Based on Time Handling

Type Description Example

Static Simulation Represents a system at a single point in time Monte Carlo method

Dynamic Simulation Represents a system as it evolves over time Queuing system

3.2 Based on State Changes

Type Description Example

Continuous Simulation Changes occur continuously over time Chemical reactions

Discrete-Event Simulation (DES) State changes at discrete points Call center operations

3.3 Based on Determinism


Lecture Notes: MODELLING & SIMULATION by Dr Nwafor Godwin O

Type Description Example

Deterministic Simulation No randomness; results are predictable Fixed scheduling

Stochastic Simulation Includes randomness Customer arrival in a bank

4. Steps in a Simulation Study

1. Problem Formulation

o Define system, objectives, constraints.

2. Model Development

o Conceptual and logical representation of the system.

3. Data Collection and Input Modeling

o Gather data and fit appropriate probability distributions.

4. Model Implementation

o Using software like Arena, SimPy (Python), or Excel.

5. Verification

o Ensure model is correctly implemented.

6. Validation

o Ensure model represents real system behavior.

7. Experimentation

o Run simulations, vary parameters, test scenarios.

8. Output Analysis

o Use statistical methods to interpret results.

9. Documentation and Decision Making

5. Input and Output Analysis in Simulation

5.1 Input Analysis

• Use historical data to estimate distributions (e.g., exponential, normal).

• Goodness-of-fit tests: Chi-square, Kolmogorov-Smirnov, Anderson-Darling.

5.2 Output Analysis

• Summary statistics: Mean, variance, confidence intervals.

• Multiple replications to estimate variability.


Lecture Notes: MODELLING & SIMULATION by Dr Nwafor Godwin O

• Warm-up period and steady-state analysis for ongoing systems.

6. Monte Carlo Simulation

Definition:

A method using random sampling to obtain numerical results, typically for static systems.

Applications:

• Risk analysis in finance

• Estimating area under curves

• Reliability estimation

Steps:

1. Define the problem.

2. Generate random inputs.

3. Compute output using the model.

4. Repeat many times.

5. Analyze the distribution of the output.

7. Random Number Generation

• Pseudo-random numbers are generated using algorithms.

• Uniform [0,1] distribution is the base for generating other distributions.

• Use inverse transform, acceptance-rejection, or Box-Muller methods to generate specific


distributions.

8. Advantages of Simulation

• Allows testing of new policies, designs, and systems.

• Identifies bottlenecks and inefficiencies.

• Handles complex, non-linear, and stochastic systems.

• Safer and cheaper than real-world experimentation.

9. Limitations of Simulation

• May require significant time and resources.


Lecture Notes: MODELLING & SIMULATION by Dr Nwafor Godwin O

• Results are approximate, not exact.

• Requires expertise in modeling and statistics.

• Validation is often difficult.

10. Applications of Simulation

Sector Applications

Manufacturing Assembly line optimization, layout planning

Healthcare Emergency room staffing, patient flow

Finance Portfolio risk analysis, option pricing

Transportation Traffic systems, airport logistics

Supply Chain Inventory management, demand forecasting

11. Simulation Tools and Languages

Tool Description

Arena Graphical DES tool

Simul8 Business process simulation

AnyLogic Hybrid modeling (discrete + system dynamics + agent-based)

SimPy (Python) Process-based discrete-event simulation

Excel Basic Monte Carlo simulations

12. Summary

• Simulation is essential for studying systems that are complex, uncertain, or dynamic.

• Helps decision-makers make informed choices without disrupting real systems.

• Requires careful design, implementation, and interpretation.

13. Suggested Activities

• Build a simple queuing model (e.g., bank teller) in SimPy or Excel.

• Conduct a Monte Carlo simulation to estimate π or evaluate a risk.


Lecture Notes: MODELLING & SIMULATION by Dr Nwafor Godwin O

• Analyze simulation output using confidence intervals.

14. Recommended Reading

• Law, A. M., Simulation Modeling and Analysis

• Banks, J., Discrete-Event System Simulation

• Ross, S., Simulation


Lecture Notes: MODELLING & SIMULATION by Dr Nwafor Godwin O

CHAPTER B: Lecture Notes: Simulation and Modelling


1. Introduction

Simulation and modelling are powerful tools used to represent and analyze the behavior of real-
world systems. They are essential in situations where analytical solutions are impractical or
impossible.

2. Definitions

2.1 Modelling

A model is a simplified representation of a real system that captures the essential features relevant
to a specific analysis.

Types of models:

• Physical models (e.g., wind tunnel models)

• Mathematical models (e.g., equations, algorithms)

• Logical models (e.g., flowcharts)

• Simulation models (dynamic and probabilistic representations)

2.2 Simulation

Simulation is the imitation of the operation of a real-world process or system over time. It involves
running experiments on a model to understand system behavior and make decisions.

3. Types of Simulation Models

3.1 Deterministic vs. Stochastic

• Deterministic: No randomness (e.g., fixed processing times)

• Stochastic: Incorporates randomness (e.g., customer arrivals)

3.2 Static vs. Dynamic

• Static: Represents a system at a specific point in time (e.g., Monte Carlo simulation)

• Dynamic: Represents a system as it evolves over time (e.g., queuing simulation)

3.3 Discrete vs. Continuous

• Discrete-event simulation: Events occur at discrete points in time (e.g., bank teller system)

• Continuous simulation: Changes occur continuously (e.g., fluid dynamics)

4. Steps in Simulation Study


Lecture Notes: MODELLING & SIMULATION by Dr Nwafor Godwin O

1. Problem Definition: Understand the problem and determine objectives.

2. Model Formulation: Develop a conceptual and mathematical model.

3. Data Collection: Gather input data and estimate distributions.

4. Model Translation: Implement the model using simulation software (e.g., Arena, Simul8,
AnyLogic).

5. Verification: Ensure the model is implemented correctly.

6. Validation: Ensure the model accurately represents the real system.

7. Experimentation: Run simulations under different scenarios.

8. Analysis of Results: Use statistical tools to interpret output.

9. Documentation & Reporting: Prepare and present findings.

10. Implementation: Apply insights to the real-world system.

5. Advantages and Limitations

Advantages

• Allows testing without disturbing the real system

• Handles complex, stochastic systems

• Supports “what-if” analysis

• Visual representation enhances understanding

Limitations

• Can be time-consuming and costly

• Requires accurate data and validation

• Does not guarantee optimal solutions

6. Monte Carlo Simulation

Definition:

A technique that uses random sampling to estimate numerical results.

Applications:

• Risk analysis

• Financial forecasting

• Inventory management
Lecture Notes: MODELLING & SIMULATION by Dr Nwafor Godwin O

Steps:

1. Define the model

2. Identify input probability distributions

3. Generate random inputs

4. Run simulation and record outputs

5. Analyze output (e.g., confidence intervals)

7. Queuing Models and Simulation

Elements of a Queuing System:

• Arrival process (e.g., Poisson)

• Service mechanism (e.g., exponential)

• Number of servers

• Queue discipline (e.g., FIFO)

Performance Metrics:

• Average queue length

• Average waiting time

• Server utilization

Note: When analytical solutions are hard to obtain (e.g., for M/G/1 queues), simulation helps
approximate system behavior.

8. Tools and Software for Simulation

• General-purpose programming: Python (SimPy), R, MATLAB

• Simulation software: Arena, AnyLogic, Simul8, ExtendSim

• Spreadsheets: Excel with random number generation and data analysis

9. Applications of Simulation

• Manufacturing systems (e.g., production lines)

• Healthcare (e.g., emergency room staffing)

• Transportation (e.g., traffic flow)

• Supply chain and logistics


Lecture Notes: MODELLING & SIMULATION by Dr Nwafor Godwin O

• Finance and risk management

• Environmental modeling (e.g., climate change scenarios)

10. Conclusion

Simulation and modelling provide essential tools for analyzing and optimizing complex systems. They
offer insights where traditional analysis fails, support decision-making under uncertainty, and help
design more efficient and effective systems.

11. Suggested Readings

• Law, A. M., & Kelton, W. D. (2007). Simulation Modeling and Analysis. McGraw-Hill.

• Banks, J. et al. (2010). Discrete-Event System Simulation. Pearson.

• Ross, S. M. (2014). Simulation. Academic Press.


Lecture Notes: MODELLING & SIMULATION by Dr Nwafor Godwin O

CHAPTER C: Lecture: Statistics for Modelling and Simulation

1. Introduction

Simulation models often rely on real-world data and random inputs to produce realistic outputs.
Understanding and applying statistical techniques is essential for:

• Developing accurate models

• Estimating input parameters

• Analyzing and interpreting simulation output

• Verifying and validating models

2. Role of Statistics in Simulation

Purpose Statistical Method

Input Modeling Probability distributions, parameter estimation

Model Building Regression, time series

Output Analysis Confidence intervals, hypothesis testing

Verification/Validation Goodness-of-fit tests, statistical comparisons

3. Input Data Analysis

3.1 Data Collection

• Observe and record real-world data from the system.

• Must be reliable, relevant, and sufficient.

3.2 Exploratory Data Analysis (EDA)

• Descriptive statistics: mean, median, mode, variance, skewness, kurtosis.

• Graphical tools: histograms, boxplots, scatterplots.

3.3 Fitting Probability Distributions

Used to model random inputs like:

• Arrival times (Poisson, exponential)

• Service times (normal, lognormal)

• Demand (uniform, triangular)


Lecture Notes: MODELLING & SIMULATION by Dr Nwafor Godwin O

3.4 Goodness-of-Fit Tests

To assess how well a distribution fits the observed data:

• Chi-Square Test

• Kolmogorov-Smirnov (K-S) Test

• Anderson-Darling Test

4. Random Number Generation and Sampling

4.1 Pseudo-Random Numbers

• Generated using deterministic algorithms

• Should pass statistical tests for uniformity and independence

4.2 Transforming Uniform to Other Distributions

• Inverse Transform Method

• Box-Muller Method (for normal distribution)

• Acceptance-Rejection Method

5. Statistical Models for System Behaviour

5.1 Regression Analysis

• Model the relationship between a dependent variable and one or more independent
variables.

• Use in simulation for performance modeling, forecasting, or cost estimation.

5.2 Time Series Analysis

• Use historical data to model temporal systems (e.g., demand forecasting).

• Techniques: moving averages, ARIMA models.

6. Output Analysis in Simulation

6.1 Point Estimation

• Mean, variance, standard deviation of performance measures (e.g., average wait time).
Lecture Notes: MODELLING & SIMULATION by Dr Nwafor Godwin O

6.2 Confidence Intervals

• Used to express the uncertainty of simulation outputs.

6.3 Multiple Replications

• Run the simulation multiple times with different random seeds to estimate variability.

• More replications → more accurate estimates.

7. Comparing Simulation Scenarios

7.1 Hypothesis Testing

Used to compare alternative models or system configurations:

• t-test: compare means of two systems

• ANOVA: compare means of three or more systems

7.2 Paired Comparison

• Use when two models are simulated under identical random number streams.

8. Design of Experiments (DOE)

Purpose:

• Evaluate the effect of input factors on output performance.

• Optimize system performance.

Common DOE Methods:

• Full factorial design

• Fractional factorial design

• Taguchi methods

9. Verification and Validation

9.1 Verification

• Ensures the model works as intended (debugging)


Lecture Notes: MODELLING & SIMULATION by Dr Nwafor Godwin O

• Methods: walkthroughs, tracing, step-by-step execution

9.2 Validation

• Ensures the model accurately represents the real system

• Statistical validation techniques:

o Compare simulated vs. real data using:

▪ t-tests

▪ Confidence intervals

▪ Visual comparisons (boxplots, histograms)

10. Summary

Statistical techniques are vital at every stage of simulation:

• Input modeling uses distributions and estimation

• System behavior can be modeled using regression or time series

• Simulation output must be interpreted with proper statistical analysis

• Hypothesis testing and DOE aid in evaluating and improving system performance

11. Recommended Software Tools

Tool Statistical Capability

R Extensive statistical modeling and analysis

Python (SciPy, NumPy, pandas) Data manipulation, statistical testing

Excel Basic statistics, regression, simulations

Minitab / SPSS DOE, regression, ANOVA

Arena, Simul8 Integrated simulation with statistical output

12. Practice Questions

1. Fit a normal distribution to a sample of service times and test the fit.

2. Use regression to model system performance from simulation data.

3. Simulate two queuing systems and compare their mean wait times using a t-test.

4. Design a factorial experiment to evaluate the impact of staffing levels and arrival rates on
customer wait times.
Lecture Notes: MODELLING & SIMULATION by Dr Nwafor Godwin O

Chapter D: Lecture Notes: Monte Carlo Method

1. Introduction

1.1 What is the Monte Carlo Method?

The Monte Carlo Method refers to a broad class of computational algorithms that rely on random
sampling to obtain numerical results. It is particularly useful for:

• Solving complex mathematical problems

• Estimating integrals, probabilities, or system behavior

• Simulating stochastic processes

1.2 Why Use Monte Carlo Methods?

• When analytical solutions are intractable

• To model uncertainty and variability

• In high-dimensional spaces where other methods fail

2. Historical Background

• Named after Monte Carlo Casino due to its use of chance.

• Developed during the 1940s by scientists like Stanislaw Ulam and John von Neumann for
nuclear physics simulations during the Manhattan Project.

3. Key Concepts

3.1 Random Variables and Distributions

Monte Carlo methods use random sampling from probability distributions (e.g., uniform, normal,
exponential).

3.2 Law of Large Numbers

3.3 Convergence and Accuracy

• The accuracy improves as more samples are taken.


Lecture Notes: MODELLING & SIMULATION by Dr Nwafor Godwin O

4. Steps in Monte Carlo Simulation

1. Define the Problem

o Identify what needs to be estimated (e.g., an integral, expected value, system


performance).

2. Build a Probabilistic Model

o Describe the problem in terms of random variables and probability distributions.

3. Generate Random Inputs

o Use pseudo-random number generators.

4. Compute the Output

o Evaluate the function or model using the random inputs.

5. Repeat & Aggregate

o Perform the experiment many times to obtain an average result.

6. Analyze Results

o Use statistical techniques to estimate accuracy and confidence intervals.

5. Example Applications

5.1 Estimating π

• Generate random points in a unit square.

• Count how many fall inside the unit circle.

5.2 Integration
Lecture Notes: MODELLING & SIMULATION by Dr Nwafor Godwin O

5.3 Risk Analysis

In finance or project management, simulate scenarios (e.g., stock prices, costs) using assumed
distributions, and analyze variability and worst-case outcomes.

6. Techniques for Efficiency

6.1 Variance Reduction Techniques

Improve accuracy without increasing sample size:

• Antithetic Variates

• Control Variates

• Importance Sampling

• Stratified Sampling

6.2 Quasi-Monte Carlo Methods

Use low-discrepancy sequences (e.g., Sobol, Halton) instead of pseudo-random numbers for better
convergence.

7. Advantages and Limitations

Advantages

• Easy to implement

• Applicable to a wide range of problems

• Handles high-dimensional problems well

• Naturally incorporates randomness and uncertainty

Limitations
Lecture Notes: MODELLING & SIMULATION by Dr Nwafor Godwin O

• Slow convergence rate

• Can be computationally expensive

• Requires good random number generators

• Accuracy depends on number of samples

8. Monte Carlo in Practice

Common Application Areas

• Physics: Particle transport, statistical mechanics

• Finance: Option pricing (e.g., Black-Scholes), risk analysis

• Engineering: Reliability analysis, tolerance design

• Operations Research: Queue simulations, logistics

Tools and Programming Languages

• Python: NumPy, SciPy

• R: runif(), rnorm(), Monte Carlo integration packages

• MATLAB

• Excel: Random number generation, simulation add-ins

9. Sample Python Code: Estimating π

python

import random

N = 100000

inside_circle = 0

for _ in range(N):

x = random.uniform(0, 1)

y = random.uniform(0, 1)

if x**2 + y**2 <= 1:

inside_circle += 1
Lecture Notes: MODELLING & SIMULATION by Dr Nwafor Godwin O

pi_estimate = 4 * inside_circle / N

print(f"Estimated π = {pi_estimate}")

10. Summary

• Monte Carlo methods rely on random sampling to solve mathematical problems.

• Useful when exact methods are impractical.

• Accuracy improves with the number of simulations.

• Widely used in engineering, finance, statistics, and beyond.

11. Suggested Reading

• Rubinstein, R. Y., & Kroese, D. P. (2016). Simulation and the Monte Carlo Method.

• Fishman, G. S. (1996). Monte Carlo: Concepts, Algorithms, and Applications.

• Glasserman, P. (2004). Monte Carlo Methods in Financial Engineering.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy