Hands-On Simulation Modeling with Python

Book description

Enhance your simulation modeling skills by creating and analyzing digital prototypes of a physical model using Python programming with this comprehensive guide

Key Features

  • Learn to create a digital prototype of a real model using hands-on examples
  • Evaluate the performance and output of your prototype using simulation modeling techniques
  • Understand various statistical and physical simulations to improve systems using Python

Book Description

Simulation modeling helps you to create digital prototypes of physical models to analyze how they work and predict their performance in the real world. With this comprehensive guide, you'll understand various computational statistical simulations using Python.

Starting with the fundamentals of simulation modeling, you'll understand concepts such as randomness and explore data generating processes, resampling methods, and bootstrapping techniques. You'll then cover key algorithms such as Monte Carlo simulations and Markov decision processes, which are used to develop numerical simulation models, and discover how they can be used to solve real-world problems. As you advance, you'll develop simulation models to help you get accurate results and enhance decision-making processes. Using optimization techniques, you'll learn to modify the performance of a model to improve results and make optimal use of resources. The book will guide you in creating a digital prototype using practical use cases for financial engineering, prototyping project management to improve planning, and simulating physical phenomena using neural networks.

By the end of this book, you'll have learned how to construct and deploy simulation models of your own to overcome real-world challenges.

What you will learn

  • Gain an overview of the different types of simulation models
  • Get to grips with the concepts of randomness and data generation process
  • Understand how to work with discrete and continuous distributions
  • Work with Monte Carlo simulations to calculate a definite integral
  • Find out how to simulate random walks using Markov chains
  • Obtain robust estimates of confidence intervals and standard errors of population parameters
  • Discover how to use optimization methods in real-life applications
  • Run efficient simulations to analyze real-world systems

Who this book is for

Hands-On Simulation Modeling with Python is for simulation developers and engineers, model designers, and anyone already familiar with the basic computational methods that are used to study the behavior of systems. This book will help you explore advanced simulation techniques such as Monte Carlo methods, statistical simulations, and much more using Python. Working knowledge of Python programming language is required.

Table of contents

  1. Hands-On Simulation Modeling with Python
  2. Why subscribe?
  3. Contributors
  4. About the author
  5. About the reviewers
  6. Packt is searching for authors like you
  7. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
    4. Download the example code files
    5. Download the color images
    6. Conventions used
    7. Get in touch
    8. Reviews
  8. Section 1: Getting Started with Numerical Simulation
  9. Chapter 1: Introducing Simulation Models
    1. Introducing simulation models
      1. Decision-making workflow
      2. Comparing modeling and simulation
      3. Pros and cons of simulation modeling
      4. Simulation modeling terminology
    2. Classifying simulation models
      1. Comparing static and dynamic models
      2. Comparing deterministic and stochastic models
      3. Comparing continuous and discrete models
    3. Approaching a simulation-based problem
      1. Problem analysis
      2. Data collection
      3. Setting up the simulation model
      4. Simulation software selection
      5. Verification of the software solution
      6. Validation of the simulation model
      7. Simulation and analysis of results
    4. Dynamical systems modeling
      1. Managing workshop machinery
      2. Simple harmonic oscillator
      3. Predator-prey model
    5. Summary
  10. Chapter 2: Understanding Randomness and Random Numbers
    1. Technical requirements
    2. Stochastic processes
      1. Types of stochastic process
      2. Examples of stochastic processes
      3. The Bernoulli process
      4. Random walk
      5. The Poisson process
    3. Random number simulation
      1. Probability distribution
      2. Properties of random numbers
    4. The pseudorandom number generator
      1. The pros and cons of a random number generator
      2. Random number generation algorithms
      3. Linear congruential generator
      4. Random numbers with uniform distribution
      5. Lagged Fibonacci generator
    5. Testing uniform distribution
      1. The chi-squared test
      2. Uniformity test
    6. Exploring generic methods for random distributions
      1. The inverse transform sampling method
      2. The acceptance-rejection method
    7. Random number generation using Python
      1. Introducing the random module
      2. The random.random() function
      3. The random.seed() function
      4. The random.uniform() function
      5. The random.randint() function
      6. The random.choice() function
      7. The random.sample() function
      8. Generating real-valued distributions
    8. Summary
  11. Chapter 3: Probability and Data Generation Processes
    1. Technical requirements
    2. Explaining probability concepts
      1. Types of events
      2. Calculating probability
      3. Probability definition with an example
    3. Understanding Bayes' theorem
      1. Compound probability
      2. Bayes' theorem
    4. Exploring probability distributions
      1. Probability density function
      2. Mean and variance
      3. Uniform distribution
      4. Binomial distribution
      5. Normal distribution
    5. Summary
  12. Section 2: Simulation Modeling Algorithms and Techniques
  13. Chapter 4: Exploring Monte Carlo Simulations
    1. Technical requirements
    2. Introducing Monte Carlo simulation
      1. Monte Carlo components
      2. First Monte Carlo application
      3. Monte Carlo applications
      4. Applying the Monte Carlo method for Pi estimation
    3. Understanding the central limit theorem
      1. Law of large numbers
      2. Central limit theorem
    4. Applying Monte Carlo simulation
      1. Generating probability distributions
      2. Numerical optimization
      3. Project management
    5. Performing numerical integration using Monte Carlo
      1. Defining the problem
      2. Numerical solution
      3. Min-max detection
      4. Monte Carlo method
      5. Visual representation
    6. Summary
  14. Chapter 5: Simulation-Based Markov Decision Processes
    1. Technical requirements
    2. Overview of Markov processes
      1. The agent-environment interface
      2. Exploring MDPs
      3. Understanding the discounted cumulative reward
      4. Comparing exploration and exploitation concepts
    3. Introducing Markov chains
      1. Transition matrix
      2. Transition diagram
    4. Markov chain applications
      1. Introducing random walks
      2. Simulating a one-dimensional random walk
      3. Simulating a weather forecast
    5. The Bellman equation explained
      1. Dynamic programming concepts
      2. Principle of optimality
      3. The Bellman equation
    6. Multi-agent simulation
    7. Summary
  15. Chapter 6: Resampling Methods
    1. Technical requirements
    2. Introducing resampling methods
      1. Sampling concepts overview
      2. Reasoning about sampling
      3. Pros and cons of sampling
      4. Probability sampling
      5. How sampling works
    3. Exploring the Jackknife technique
      1. Defining the Jackknife method
      2. Estimating the coefficient of variation
      3. Applying Jackknife resampling using Python
    4. Demystifying bootstrapping
      1. Introducing bootstrapping
      2. Bootstrap definition problem
      3. Bootstrap resampling using Python
      4. Comparing Jackknife and bootstrap
    5. Explaining permutation tests
    6. Approaching cross-validation techniques
      1. The validation set approach
      2. Leave-one-out cross validation
      3. K-fold cross validation
      4. Cross-validation using Python
    7. Summary
  16. Chapter 7: Using Simulation to Improve and Optimize Systems
    1. Technical requirements
    2. Introducing numerical optimization techniques
      1. Defining an optimization problem
      2. Explaining local optimality
      3. Defining the descent methods
      4. Approaching the gradient descent algorithm
      5. Understanding the learning rate
      6. Explaining the trial and error method
      7. Implementing gradient descent in Python
    3. Facing the Newton-Raphson method
      1. Using the Newton-Raphson algorithm for root-finding
      2. Approaching Newton-Raphson for numerical optimization
      3. Applying the Newton-Raphson technique
    4. Deepening our knowledge of stochastic gradient descent
    5. Discovering the multivariate optimization methods in Python
      1. The Nelder–Mead method
      2. Powell's conjugate direction algorithm
      3. Summarizing other optimization methodologies
    6. Summary
  17. Section 3: Real-World Applications
  18. Chapter 8: Using Simulation Models for Financial Engineering
    1. Technical requirements
    2. Understanding the geometric Brownian motion model
      1. Defining a standard Brownian motion
      2. Addressing the Wiener process as random walk
      3. Implementing a standard Brownian motion
    3. Using Monte Carlo methods for stock price prediction
      1. Exploring the Amazon stock price trend
      2. Handling the stock price trend as time series
      3. Introducing the Black-Scholes model
      4. Applying Monte Carlo simulation
    4. Studying risk models for portfolio management
      1. Using variance as a risk measure
      2. Introducing the value-at-risk metric
      3. Estimating the VaR for some NASDAQ assets
    5. Summary
  19. Chapter 9: Simulating Physical Phenomena Using Neural Networks
    1. Technical requirements
    2. Introducing the basics of neural networks
      1. Understanding biological neural networks
      2. Exploring ANNs
    3. Understanding feedforward neural networks
      1. Exploring neural network training
    4. Simulating airfoil self-noise using ANNs
      1. Importing data using pandas
      2. Scaling the data using sklearn
      3. Viewing the data using matplotlib
      4. Splitting the data
      5. Explaining multiple linear regression
      6. Understanding a multilayer perceptron regressor model
    5. Exploring deep neural networks
      1. Getting familiar with convolutional neural networks
      2. Examining recurrent neural networks
      3. Analyzing LSTM networks
    6. Summary
  20. Chapter 10: Modeling and Simulation for Project Management
    1. Technical requirements
    2. Introducing project management
      1. Understanding what-if analysis
    3. Managing a tiny forest problem
      1. Summarizing the Markov decision process
      2. Exploring the optimization process
      3. Introducing MDPtoolbox
      4. Defining the tiny forest management example
      5. Addressing management problems using MDPtoolbox
      6. Changing the probability of fire
    4. Scheduling project time using Monte Carlo simulation
      1. Defining the scheduling grid
      2. Estimating the task's time
      3. Developing an algorithm for project scheduling
      4. Exploring triangular distribution
    5. Summary
  21. Chapter 11: What's Next?
    1. Summarizing simulation modeling concepts
      1. Generating random numbers
      2. Applying Monte Carlo methods
      3. Addressing the Markov decision process
      4. Analyzing resampling methods
      5. Exploring numerical optimization techniques
      6. Using artificial neural networks for simulation
    2. Applying simulation model to real life
      1. Modeling in healthcare
      2. Modeling in financial applications
      3. Modeling physical phenomenon
      4. Modeling public transportation
      5. Modeling human behavior
    3. Next steps for simulation modeling
      1. Increasing the computational power
      2. Machine learning-based models
      3. Automated generation of simulation models
    4. Summary
  22. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product information

  • Title: Hands-On Simulation Modeling with Python
  • Author(s): Giuseppe Ciaburro
  • Release date: July 2020
  • Publisher(s): Packt Publishing
  • ISBN: 9781838985097