Computer Modelling and Simulation Fundamentals

Overview

Introduction to Simulation

  • Definition: Simulation is the process of creating a model of a real-world system and conducting experiments to understand and predict its behavior.
  • Types of Simulation:
    • Static Simulation: Models do not change over time (e.g., Monte Carlo methods).
    • Dynamic Simulation: Models evolve over time based on system rules.
    • Deterministic Simulation: No randomness, same inputs lead to the same outputs.
    • Stochastic Simulation: Includes randomness, outputs vary.
    • Continuous Simulation: System state changes continuously over time.
    • Discrete Simulation: State changes at distinct points in time.
  • Static Simulation Examples: Basic probability calculations, risk analysis.

Simulation Advantages, Disadvantages, and Steps

  • Advantages:
    • Allows experimentation without physical implementation.
    • Identifies potential system improvements.
    • Can analyze scenarios that are dangerous or impractical to test in real life.
  • Disadvantages:
    • Requires extensive data collection and validation.
    • Can be time-consuming and computationally expensive.
    • Results are model-dependent and may not perfectly reflect reality.
  • Steps in Simulation:
    1. Define the problem and objectives.
    2. Develop a conceptual model.
    3. Collect data and identify probability distributions.
    4. Implement the model in simulation software.
    5. Conduct simulation experiments and collect results.
    6. Analyze the results and refine the model.
    7. Validate and verify the model.
  • Dynamic Simulation Examples: Inventory control, climate modeling, traffic systems.

Discrete Event Simulation (DES)

  • Key Components:
    • Entities: Objects that flow through the system (e.g., customers, machines).
    • Attributes: Characteristics of entities (e.g., service time, arrival rate).
    • Events: Occurrences that change the system state (e.g., arrival, departure).
    • System State: Set of variables that define the system at a given time.
    • Statistical Collectors: Tools to measure and analyze performance (e.g., waiting times, throughput).
  • Collection of Statistics: Helps in evaluating the efficiency of different configurations.
  • Hand Simulation: Step-by-step manual simulation to verify model logic before software implementation.

Model Verification and Validation

  • Verification: Ensuring the simulation model is correctly implemented.
  • Validation: Ensuring the model accurately represents the real system.
  • Techniques for Validation:
    • Face validation (expert review)
    • Historical data comparison
    • Sensitivity analysis
  • Example: Simulating a Single-Server Queueing System:
    • Customers arrive at a service desk based on an interarrival distribution.
    • The server processes customers according to a service time distribution.
    • Performance metrics: Average queue length, server utilization, customer waiting time.

Input Distribution Fitting

  • Why it Matters: Real-world processes have inherent variability, requiring statistical distribution modeling.
  • Common Probability Distributions:
    • Exponential: Common for interarrival times.
    • Normal: Used for processes following a bell-curve pattern.
    • Uniform: Used for evenly distributed random variables.
    • Poisson: Used for modeling event occurrence rates.
  • Techniques for Distribution Fitting:
    • Histogram fitting
    • Goodness-of-fit tests (Chi-Square, Kolmogorov-Smirnov test)
    • Maximum likelihood estimation

Random Number Generators (RNG)

  • Purpose: Generates sequences of pseudo-random numbers for simulation experiments.
  • Common Methods:
    • Linear Congruential Generator (LCG): Uses modular arithmetic.
    • Mersenne Twister: High-quality random number generator used in modern simulations.
    • Inverse Transform Sampling: Converts uniform random numbers to desired distributions.
  • Random Number Generators in Simulation Software: Built-in functions in AnyLogic, SimPy, Arena, etc.

Output Analysis - Terminating Simulations

  • Terminating Simulations:
    • Have a natural stopping point (e.g., store closing, project duration).
    • Require replication to obtain reliable statistical measures.
  • Performance Measures: Mean, variance, confidence intervals.
  • Techniques for Output Analysis:
    • Replicated runs with different seeds.
    • Confidence interval estimation.
    • Analyzing run variability.

Output Analysis - Steady-State Simulations

  • Definition: Simulations that run indefinitely or until statistical stability is reached.
  • Key Metrics:
    • System equilibrium state.
    • Mean performance over time.
  • Techniques:
    • Removing transient (warm-up) period.
    • Using batch means method to estimate steady-state averages.
    • Analyzing autocorrelation in simulation results.

Agent-Based Simulation (ABS)

  • Definition: Uses autonomous agents that interact with each other and their environment.
  • Applications:
    • Social behavior modeling
    • Traffic congestion analysis
    • Market simulation
    • Epidemic spread analysis
  • Components:
    • Agents: Independent decision-making entities.
    • Environment: Space where agents interact.
    • Rules & Behaviors: Governs agent actions.

Using Agents for Complex Systems Evaluation

  • Why Use ABS?
    • Captures emergent behaviors.
    • Models decentralized decision-making.
    • Incorporates adaptive learning mechanisms.
  • Application Areas:
    • Smart city planning.
    • Ecological system analysis.
    • Economic modeling.

Multi-Agent Systems and Populations

  • Multi-Agent Systems (MAS): Simulations where multiple agents influence each other.
  • Key Principles:
    • Autonomy: Agents operate independently.
    • Communication: Agents share information.
    • Adaptation: Agents learn and evolve.
  • Examples:
    • Swarm intelligence (e.g., flocking birds, ant colony optimization).
    • Self-organizing traffic control.
    • Stock market trading models.

Quiz

Question 0x01

In order to provide realistic output, scientific models _________.

  1. Incorporate all known variables in the real world
  2. Must be accurate physical representations of a system
  3. Use equations to describe every process within a system
  4. Simplify the real world where appropriate

Answer 0x01

Question 0x02

Simulations in which one or more input variables are random are referred to as ______.

  1. Stochastic simulation
  2. Deterministic simulation
  3. Discrete-event simulation
  4. Dynamic simulation
  5. Agent-based simulation

Answer 0x02

Question 0x03

The ______ distribution is the only continuous distribution that has the memoryless property. The ______. Distribution is the only discrete distribution that possesses the memoryless property.

  1. Normal – Binomial
  2. Exponential – Geometric
  3. Poisson – Exponential
  4. Geometric – Poisson

Answer 0x03

Question 0x04

A bank is an example of ____________ system, since __________________ variables e.g., the number of customers in the bank-change only when a customer arrives or finishes being served and departs.

  1. continuous – flow
  2. agent-based – state
  3. discrete – flow
  4. discrete – state

Answer 0x04

Question 0x05

In the ______________________________ simulation model inputs to the simulation are known values, while in the _____________________________ simulation model, one or more random variables are used for input data.

Answer 0x05

Question 0x06

The future-event list (FEL) is typically represented by a ______________________________, which can be efficiently implemented using a _______________________________.

Answer 0x06

Question 0x07

The exponential distribution has the memoryless property, meaning that _________________________________________________________________________.

Answer 0x07

Question 0x08

Monte Carlo simulations calculate _________________________ probability, which can be used as an approximation of __________________________ probability when the number of trials is high enough.

Answer 0x08

Question 0x09

The multiplicative congruential generator $X_{i+1} = (3X_i) \mod 2^{32}$ will have a period of $2^{32}$. (T/F)

Answer 0x09

Question 0x0A

Match the Questions

  1. Building the right model
  2. Building the model right
  3. Time to reach initial transient
  4. Iterative correction procedure of model building
  5. Specification of probability distributions in model building
  6. If the arrival rate is not affected by the number of customers being served and waiting, the model is called

With the following answers

Infinite population model, input modeling, verification, calibration, validation, warm-up period.

Answer 0x0A

Question 0x0B

Explain the differences between discrete-event, agent-based, and continuous simulation paradigms.

Answer 0x0B

Question 0x0C

What are the differences between traditional programming and agent-based modeling approach? Give an example.

Answer 0x0C

Question 0x0D

What are the main characteristics of Agent-Based Modeling? Explain and give an example.

Answer 0x0D

Question 0x0E

Explain the differences between:

  1. Dynamic simulation and static (Monte Carlo) simulation,
  2. Deterministic simulation and stochastic simulation,
  3. Discrete simulation and continuous simulation.

Answer 0x0E

Question 0x0F

Give brief answers to the following questions:

  1. What is the difference between model verification and validation?
  2. Discuss why validating a model of a computer system might be easier than validating a military combat model. Assume that the computer system of interest is similar to an existing one.

Answer 0x0F

Question 0x10

In a given probability density function “a” is a constant.

diagram

  1. Find b in terms of a.
  2. Find cdf of the variable X.
  3. Find the expected value of the variable X.

Answer 0x10

Question 0x11

For each of the systems listed, sketch the logic of an event-oriented model. Develop the model in any language (or pseudocode):

  1. A central-server queuing model: when a job leaves the CPU queue, it joins the I/O queue with shortest length.

  2. A queuing model of database system that implements fork join: a job receives service in two parts. When it first enters the server it spends a small amount of simulation time generating a random number of requests to disks. It then suspends (freeing the server) until such time as all the requests it made have finished, and then enqueues for its second phase of service, where it spends a larger amount of simulation time, before finally exiting. Disks may serve requests from various jobs concurrently, but serve them using FCFS ordering. Your model should report on the statistics of a job in service – how long (on average) it waited for phase 1, how long it waits on average for its I/O requests to complete, and how long it waits on average for service after its I/O requests complete.

Answer 0x11

Question 0x12 to Question 0x14

MISSING

Question 0x15

Discuss why validating a model of a computer system might be easier than validating a military combat model. Assume that the computer system of interest is similar to an existing one.

Answer 0x15

Question 0x16

What are the differences between traditional programming and agent based modeling approach. Give an example.

Answer 0x16

Question 0x17

What are the main characteristics of Agent Based Modeling? Explain and give an example.

Answer 0x17


Recourses