0% found this document useful (0 votes)
16 views54 pages

Hcsci432 Slides

The document provides an introduction to the course HCSCI432 - Simulation & Modelling, outlining its objectives, content, and assessment methods. It discusses the importance of simulation and modelling in various fields, including career opportunities, applications, and methodologies such as Monte Carlo and agent-based modelling. Additionally, it highlights the benefits and limitations of simulation, as well as practical applications in industries like agriculture, finance, and education.

Uploaded by

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

Hcsci432 Slides

The document provides an introduction to the course HCSCI432 - Simulation & Modelling, outlining its objectives, content, and assessment methods. It discusses the importance of simulation and modelling in various fields, including career opportunities, applications, and methodologies such as Monte Carlo and agent-based modelling. Additionally, it highlights the benefits and limitations of simulation, as well as practical applications in industries like agriculture, finance, and education.

Uploaded by

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

Faculty of Science & Technology

Department of Computer Science

Simulation & Modelling


HCSCI432
Mr. D. Mpini
Introduction to Course

• What is Simulation all about?


• Student Expectations
• Course Contents
• Course Assessment
HCSCI432 – Simulation &

• Rules and Routines


Modelling
WHAT IS S&M ALL ABOUT

If I bet in favor of Manchester


United and Real Madrid tonight,
what are my chances of winning
the bet?
What are the chances of
harvesting a good yield from
sugar beans in 2027?
How much rainfall can we
expect in 2025?
What would be the most
effective deployment strategy
for a mixed-force unit in a
contested urban environment?
What's the best ratio number of
minutes in filtering traffic at
Corner Main Street and R.G
Mugabe way?
COMPUTER AIDED S&M

In answering these questions,


we make use of a model

Naturally as humans we can


make use of the mental model
and answer these questions.

But some questions get difficult


to answer using a mental model
COMPUTER AIDED S&M
• How much rainfall can we expect in 2024?
Mental Model • What are the chances of harvesting a good yield from sugar beans in 2024?

• If I invest $1000 on the ZSE today, desiring to gain $9000


next year, how should I invest it (assuming I only want to
Mathematical Model make transactions in one day and leave the stock exchange
(for complex scenarios) do its thing)?
• If I bet in favor of all teams playing at their home stadiums
today, what are my chances of winning the bet?

Computational • What is the best ratio number of minutes in


Modelling & filtering traffic at Corner Main Street and R.G
Simulation Mugabe way
(more processing • What would be the most effective deployment
power, allows strategy for a mixed-force unit in a contested
visualisation) urban environment?
Career Opportunities

Computer Scientist Simulation Engineer

Simulation Specialist Modelling Engineer


Course Contents

01 02 03
Introduction to Random Number Monte Carlo
Simulation & Generation & Simulation
Modelling Mathematical Modelling

04 05 06
Continuous Discrete Event Agent Based
Simulation Simulation Modelling
Unit 1 - Introduction to S&M

• Simulation
• Modelling
• S&M Experiment Guide
HCSCI432 – Simulation &

• S&M Development timelines


• S&M and other emerging tech
Modelling

• Tools for simulation


• Paradigms
SIMULATION

technique for studying real world dynamical systems by


imitating their behaviour using a mathematical model of the
system implemented on a computer.

• It is a powerful methodology for the design of complex


systems

• The idea is to represent dynamic characteristics of a real-


world system on a computer model.
MODELLING

application of methods to analyse complex, real world


problems in order to make predictions about what
might happen with various actions

Model: Representation of an actual system


Why build models

 to understand behaviour of an existing


system

 To predict effect of changes to a system

 To study new or imaginary systems


Key terms

Object: some entity in the real world

System: well defined objects in the real world


under specific conditions

System state variables: collection of all


information needed to define what is happening
within the system to a sufficient level
Model taxonomy

Description of the different


types of models
Benefits of Simulation

• Facilitates what if analysis

• Allows answering general questions about a system


(how, what, where)

• Helps with understanding a system

• Helps uncover complexity

• Identify problems / bottlenecks in a system

• Training

• Reduce risks
Limitations of Simulation

• Time consuming

• Needs resources

• Simulation may outweigh benefits

• Labour needs

• Experts need

• May be hard to interpret results

• May not produce all results


When to use Simulation

• Can’t use common sense

• Study complex systems eg. Biological systems

• System is dangerous

• There are limited resources to facilitate learning


/ training

• System parameters need to be adjusted


When to use Simulation

• Can’t use common sense

• Study complex systems eg. Biological systems

• System is dangerous

• There are limited resources to facilitate learning


/ training

• System parameters need to be adjusted


Applications

Manufacturing Agriculture
01  test manufacturing methods 02  Forecasting systems (weather )

 Test manufacturing procedures  Decision support systems

E-business Transport
03  Business process analysis 04  Car-crash model
 Planning. E.g. in Queue
management

 Test ideas
Applications

Military Gaming
05  Scenario military simulations 06  Video games
(gaming)
 Board games
 Digital deployments

Finance Telecommunication
07  Mapping investment decisions 08  Network simulation (traffic,
 Pricing of securities network performance, identify
 Planning corporate transactions potential problems)
such as mergers, acquisitions,
and divestitures
Applications

Education
09  learning
environments
in dangerous 10
 learning with limited resources.
E.g. training pilots

 virtual labs

11 12
Steps of Simulation Experiment
Problem
Formulation

Data
Collection

Model
Development

Model Testing

Run
Experiment

Results
Analysis
DISCUSSION
Explain the steps you are going to
carry out if you desire to run a
simulation experiment to determine
the number of tellers to employ for a
banking hall.
Agent Based Modelling
S&M  Focuses on modelling the behaviour of autonomous agents and their

Paradigms
interactions within a given environment.
 Each agent follows a set of rules or behaviours, and complex system-
level dynamics emerge from the interactions between agents.
 Traffic Simulation: Modelling the behaviour of individual vehicles and
drivers to simulate traffic flow, congestion patterns, and the effects of
• various approaches, methodologies, and philosophies various road infrastructure designs and traffic management strategies.
that guide the construction and analysis of
computational models.

• provide different lenses through which to Systems Dynamic


conceptualize, model, and simulate complex systems,
each with its strengths, limitations, and application
Modelling
domains.
 Emphasizes the study of feedback loops, stocks, and flows within a
• Choice depends on scenario system to understand its dynamic behavior over time.
 System dynamics models often represent complex systems using causal
loop diagrams and simulate the accumulation and flow of resources or
quantities.
 Epidemiological Modelling: Simulating the spread of infectious
diseases within a population to understand factors influencing
transmission rates, control measures' effectiveness, and the impact of
interventions like vaccination campaigns or social distancing measures.
Discrete Event Simulation

S&M 


Models systems as sequences of discrete events that occur at specific
points in time.
DES is well-suited for modelling systems with discrete, asynchronous
Paradigms events, such as manufacturing processes, transportation systems, and
computer networks.
 Supply Chain Management: Modelling the flow of goods, resources,
and information through a supply chain network to optimize inventory
levels, production schedules, and logistics operations while minimizing
• various approaches, methodologies, and philosophies
costs and lead times.
that guide the construction and analysis of
computational models.

• provide different lenses through which to Continuous Simulation


conceptualize, model, and simulate complex systems,
each with its strengths, limitations, and application
domains.
 Utilizes mathematical equations to represent the continuous change of
• Choice depends on scenario system states over time.
 Continuous simulation is commonly employed in physics, engineering,
and economics to model phenomena like fluid flow, electrical circuits,
population dynamics, and economic trends.
 Climate Modelling: Simulating the Earth's climate system using
mathematical equations to predict temperature patterns, precipitation
levels, and the effects of factors like greenhouse gas emissions and land
use changes over time scales ranging from decades to centuries.
Monte Carlo Simulation

S&M 


Involves generating numerous random samples from probability
distributions to estimate the behaviour of complex systems.
Monte Carlo simulation is particularly useful for assessing the
Paradigms 
uncertainty and variability associated with model inputs and parameters.
Financial Risk Analysis: Estimating the risk associated with
investment portfolios, insurance policies, or financial derivatives by
generating numerous random scenarios of market fluctuations, interest
rate changes, and other relevant variables to assess the likelihood of
• various approaches, methodologies, and philosophies
different outcomes.
that guide the construction and analysis of
computational models.

• provide different lenses through which to Game Theory


conceptualize, model, and simulate complex systems,
each with its strengths, limitations, and application
domains.
 Analyses strategic interactions among rational decision-makers to
• Choice depends on scenario predict their behaviour and outcomes.
 Game theory models are used in various fields, including economics,
political science, biology, and sociology, to study competitive and
cooperative dynamics.
 Market Competition Analysis: Using game theory models to analyse
strategic interactions among firms in an industry to predict pricing
decisions, market entry or exit strategies, and the emergence of
competitive or cooperative behaviours in oligopolistic markets.
S&M Agent Monte
Based Carlo
Pa r a d i g m s Modelling Simulation

Which ones are we going to focus on?


Discrete
Continuous
Event
Simulation
Simulation
Key
3 notable events were very instrumental in the rise
and establishment of Simulation and Modelling as a
field. These are
Events • Buffon Needle Experiment,
• Monte Carlo Simulation and
• Winter Simulation Conference.
Buff on Needle Experiment
• 1777 experiment by a French philosopher Georges-Louis Leclerc, Comte de Buffon

• For approximating the value of pi by dropping needles on a grid of parallel lines (whose spacing is
greater than the value of a needle) and calculating probability that needles will cross the line

• The probability is directly related to pi

• PI = (2*needle_length*number_of_needles_tossed) /
(distance_between_lines*number_of_needles_crossing_line)

• You can find the demonstration on ogden.eu/pi


Monte Carlo
S I M U L AT I O N
• Computational/mathematical technique used to approximate the behaviour of complex systems or processes by using random
sampling

• Initiated by John von Neumann and Stanislaw Ulam during World War 2 as an atomic bomb effects simulator

• Named after a casino town, Monaco – since the element of chance (in a game of roulette) is core to the modelling approach

• To improve decision making under uncertain conditions

• The goal is to estimate the possible outcomes of an uncertain event

• Applied in sales forecasting, pricing, project management, modelling risk in AI


Winter Simulation
CONFERENCE
• In addition to simulation tools developments rush, a new conference where researchers collaborated on
simulations was started in 1967

• It is one of the premier international conferences in the field of simulation modeling and analysis.

• Usually takes place in December.

• provides a platform for researchers, practitioners, and educators from various disciplines to exchange ideas,
present their latest research findings, and discuss emerging trends and challenges in the field of simulation.
Simulation Tools

R is a programming language and software


environment for statistical analysis, graphics
representation and reporting. Has some
packages for simulation

AnyLogic is a multimethod simulation


modelling tool developed by The AnyLogic
Company. It supports agent-based, discrete
event, and system dynamics simulation
methodologies.
DISCUSSION

How can you make use of Simulation and


Modelling in the following
industries/fields/areas/environments?

1.Agriculture

2.Judiciary

3.Learning institutions
DISCUSSION

In your opinion should you conduct Simulation


experiments or not in the following simulation
scenarios

1. Deciding how many tellers to employ for a banking


hall
2. Deciding best opening time for a local supermarket
3. Deciding how many cars to use if you own 6 high
income generating companies
4. Deciding on how many customer service agents to
employ at a call centre
5. Figuring out the salary to pay each employee at a
shoe manufacturing company
DISCUSSION

Emerging technologies refer to technologies whose development, practical application


or both are still largely unrealised. They include but not limited to:

1. Artificial Intelligence
2. Robotics & Automation
3. Cloud Computing
4. Edge Computing
5. Immersive Communication Technologies
6. Educational Technology (EdTech)
7. Internet of Things
8. Nanotechnology
9. Biotechnology
10.Blockchain and Cryptocurrency

Discuss how AI contributes to the development of each of these emerging technologie


and how each emerging technology contributes to the development of S&M.
Practical 1

Installing R and basic R programming


See practical guide.
Practical 2

Installing AnyLogic
Setting up an AnyLogic problem

See practicals guide.


Unit II – Mathematical Foundations

• Random Numbers
• Generation (Traditional
methods / everyday
HCSCI432 – Simulation &

examples)
• Generation – RD Table
Modelling

• RNG Algorithms
• Probability Distributions
• Stochastic Processes
Part A – Random Numbers

• Random Numbers
• Generation (Traditional
methods / everyday
HCSCI432 – Simulation &

examples)
• Generation – RD Table
Modelling

• RNG Algorithms
WHY DO WE NEED THEM?

1. Framework for building


models, representing variables,
etc.
Analysis
Accuracy
2. Generate numbers.
Simulation thrives on numbers

3. Validation and Verification


RANDOM NUMBER GENERATION

• Use of random numbers lies at the foundation of modelling a

• S&M experiments need the ability to generate random numb

Def: numbers that show no consistent pattern with each other in


Quality of random number is dependent on its period
Period: number that random numbers can produce before a repe
sets in
RANDOM NUMBER PROPERTIES

• One number is not affected by the preceding


number

• Preceding number cannot be predicted from


previous number
GOOD RANDOM NUMBER GENERATOR

• Has as nearly possible a uniform


distribution
• Should be fast
• Should not require too much memory
• Has a long period
• Does not repeat same numbers
RANDOM NUMBERS IN REAL LIFE

• Playing dice
• Dealing cards from a deck
• Draw numbers from a tin randomly
• Tables for random number
• Computer programs
RANDOM NUMBERS TABLE

• Assume you have the test scores for a


population of 200 students. Each
student has been assigned a number
from 1 to 200. We want to randomly
sample only 5 of the students for this
exercise. Assume your first point on
Random Digits table was on 3rd column
2nd entry.
ALGORITHMS FOR
GENERATION
• We can also generate using pre-
set algorithms, or generate own
algorithms
1. General Congruential Method
2. Mid product Method
3. Mid square Method
4. Fibonacci Method
5. Quadratic Congruential Method
General Congruential Method

1. Start with an arbitrary number with a


specified number of digits, X
2. Pick an random constant, which should have
same number of digits as c
3. Multiply seed with constant and only take
the last 4 digits of the product
4. Repeat step 3 until you have reached the
required number of samples
Mid Product Method

1. Start with an arbitrary number with a


specified number of digits, X
2. Pick an random constant, which should have
same number of digits as c
3. Multiply seed with constant and only take
the last 4 digits of the product
4. Repeat step 3 until you have reached the
required number of samples
Mid Square Method

1. Start with an arbitrary number with a


specified number of digits, X
2. Pick an random constant, which should have
same number of digits as c
3. Multiply seed with constant and only take
the last 4 digits of the product
4. Repeat step 3 until you have reached the
required number of samples
Fibonacci Method

1. Start with an arbitrary number with a


specified number of digits, X
2. Pick an random constant, which should have
same number of digits as c
3. Multiply seed with constant and only take
the last 4 digits of the product
4. Repeat step 3 until you have reached the
required number of samples
Linear Congruential Method

1. Start with an arbitrary number with a


specified number of digits, X
2. Pick an random constant, which should have
same number of digits as c
3. Multiply seed with constant and only take
the last 4 digits of the product
4. Repeat step 3 until you have reached the
required number of samples
Quadratic Congruential Method

1. Start with an arbitrary number with a


specified number of digits, X
2. Pick a random constant, which should have
same number of digits as c
3. Multiply seed with constant and only take
the last 4 digits of the product
4. Repeat step 3 until you have reached the
required number of samples
Practical

• See practical
guide.
• Random number
generation using R
Part B – Mathematical Foundations

• Probability Distributions
• Stochastic Processes
HCSCI432 – Simulation &

• Integration
• Differentiation
Modelling

You might also like