Simulation Techniques
Simulation Techniques
Lecture # 3
Agenda
Agent-Based Simulation
Monte carlo simulation
3
Agent-based simulation (ABS) is a computer model that simulates how individual agents
interact with each other and their environment. It's used to study how these
interactions affect the behavior of a system.
Or
A computational modeling approach that simulates the actions and interactions of
autonomous agents to understand system-level behavior.
4
1. Agents:
▪ Agents are the fundamental units in an ABS. They can represent individuals, groups,
organizations, or even entire systems.
▪ Each agent has attributes (e.g., age, wealth, location) and behaviors (e.g., decision-making rules,
movement patterns).
▪ Agents can be heterogeneous, meaning they can have different attributes and behaviors.
2. Environment:
▪ The environment is the space in which agents operate. It can be physical (e.g., a grid or network)
or abstract (e.g., a social network or market).
▪ The environment can influence agent behavior and vice versa.
3. Rules:
▪ Agents follow a set of rules that dictate how they interact with each other and with the
environment.
▪ These rules can be simple or complex, deterministic or stochastic.
4. Emergence:
▪ One of the key features of ABS is the emergence of system-level properties from the
interactions of individual agents.
▪ Emergent phenomena are often unpredictable and cannot be easily deduced from the
behavior of individual agents alone.
5. Adaptation:
▪ Agents can adapt their behavior based on their experiences and changes in the
environment.
▪ This can lead to dynamic and evolving systems.
7
1. Flexibility:
▪ ABS can model a wide variety of systems and behaviors, making it a versatile tool for many
disciplines.
2. Heterogeneity:
▪ Agents can have diverse attributes and behaviors, allowing for more realistic and nuanced models.
3. Emergence:
▪ ABS can capture emergent phenomena that are difficult to predict or model using traditional
methods.
4. Adaptability:
▪ Agents can adapt and learn, allowing for dynamic and evolving systems.
10
Challenges of ABS
1.Complexity:
▪ Designing and implementing ABS models can be challenging.
2.Computational Cost:
▪ Large-scale simulations require significant computational resources.
3.Validation:
▪ Difficult to validate models, especially with real-world data.
4. Interpretability:
▪ Emergent behaviors can be hard to interpret and explain.
11
Agent-based simulation (ABM) is used to model complex systems by simulating how individual
agents interact. Examples of ABM include:
• Disease spread: Simulating how diseases spread through a population, where each person is
an agent with their own attributes
• Traffic flow: Simulating how vehicles interact with each other and their environment,
including obeying traffic signals and keeping a safe distance
• Social networks: Simulating how opinions spread, and cultures evolve across social
networks
• Financial markets: Simulating how participants make decisions that affect price movements
13
1.Random Sampling: The simulation relies on generating random inputs (often based on
probability distributions) to model uncertainty in the system.
2.Iterative Process: The simulation runs thousands or millions of iterations, each time using
different random inputs to produce a range of possible outcomes.
3.Probability Distributions: Input variables are often modeled using probability distributions
(e.g., uniform, non-uniform etc.) to reflect their uncertainty.
4.Aggregation of Results: After running all iterations, the results are aggregated to analyze the
distribution of outcomes, calculate probabilities, and make informed decisions.
15
1. Define the Problem: Identify the system or process you want to model and the variables involved.
2. Specify Probability Distributions: Assign appropriate probability distributions to the input variables (e.g.,
uniform distribution for unknown quantities).
3. Generate Random Samples: Use random number generators to create samples from the specified
distributions.
4. Run Simulations: Perform the simulation by running the model repeatedly with the random inputs.
5. Analyze Results: Aggregate the results to determine the range of outcomes, probabilities, and key statistics
(e.g., mean, mode, median, standard deviation, confidence intervals).
16
1. Finance: Estimating the risk of investments, valuing options, and forecasting portfolio returns.
2. Engineering: Analyzing system reliability, failure rates, and performance under uncertainty.
3. Project Management: Predicting project completion times and costs under uncertain conditions.
4. Science and Research: Modeling complex physical systems, such as particle interactions or climate
change.
5. Gaming and AI: Used in game theory and reinforcement learning to simulate decision-making
processes.
17
Problem:
We want to estimate the probability of rolling a 6 on a fair die. The theoretical probability is 1661 (about 16.67%),
but we’ll use Monte Carlo simulation to approximate this.
Steps:
1. Define the Problem: We’re simulating rolling a die many times and counting how often a 6 appears.
2. Random Sampling: Each roll of the die is random, and each outcome (1, 2, 3, 4, 5, or 6) is equally likely.
3. Run Simulations: Roll the die (or simulate rolling it) thousands of times.
4. Analyze Results: Calculate the percentage of times a 6 appears.
18
Problem:
We want to estimate the probability of rolling a 6 on a fair die. The theoretical probability is 1661 (about 16.67%),
but we’ll use Monte Carlo simulation to approximate this.
Simulation in Action:
Let’s say we simulate rolling the die 1,000 times. Here’s how it works:
1.Use a random number generator to simulate each roll:
1. If the number is between 1 and 6, it represents the outcome of the die.
2. For example, if the random number is 4, the outcome is 4.
2.Count how many times a 6 appears.
3.Divide the number of 6s by the total number of rolls (1,000) to estimate the probability.
19
Problem:
We want to estimate the probability of rolling a 6 on a fair die. The theoretical probability is 1661 (about 16.67%),
but we’ll use Monte Carlo simulation to approximate this.
Example Results:
• Suppose in 1,000 rolls, a 6 appears 168 times.
• The estimated probability of rolling a 6 is:
Probability=168/1000=0.168 or 16.8%.
• This is close to the theoretical probability of 1/6 (16.67%).
1..
20
Advantages:
• Handles complex systems with many uncertain variables.
• Provides a range of possible outcomes and their probabilities.
• Flexible and applicable to a wide variety of problems.
Limitations:
• Computationally intensive, especially for high-precision results.
• Requires accurate probability distributions for input variables.
• Results are only as good as the model and assumptions used.
Monte Carlo simulations are a powerful tool for understanding and managing uncertainty in complex
systems.
Thank You