ebook img

Hands-On Simulation Modeling with Python: Develop simulation models for improved efficiency and precision in the decision-making process, 2nd Edition PDF

460 Pages·2022·15.727 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Hands-On Simulation Modeling with Python: Develop simulation models for improved efficiency and precision in the decision-making process, 2nd Edition

Hands-On Simulation Modeling with Python Develop simulation models for improved efficiency and precision in the decision-making process Giuseppe Ciaburro BIRMINGHAM—MUMBAI Hands-On Simulation Modeling with Python Copyright © 2022 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. Publishing Product Manager: Ali Abidi Content Development Editor: Joseph Sunil Technical Editor: Rahul Limbachiya Copy Editor: Safis Editing Project Coordinator: Farheen Fathima Proofreader: Safis Editing Indexer: Tejal Soni Production Designer: Prashant Ghare Marketing Coordinator: Shifa Ansari First published: July 2020 Second edition: November 2022 Production reference: 1251122 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-80461-688-8 www.packt.com Dedicated to my family, to my sons Luigi and Simone, to my wife Tiziana and to the memory of my parents. Contributors About the author Giuseppe Ciaburro holds a Ph.D. in environmental technical physics and two master’s degrees in chemical engineering and acoustic and noise control. He works at the Built Environment Control Laboratory – Università degli Studi della Campania “Luigi Vanvitelli.” He has over 20 years of work experience in programming, first in the field of combustion and then in acoustics and noise control. His core programming knowledge is in Python and R, and he has extensive experience working with MATLAB. An expert in acoustics and noise control, Giuseppe has wide experience in teaching professional ITC courses (about 20 years), dealing with e-learning as an author. He has several publications to his credit: monographs, scientific journals, and thematic conferences. He is currently researching machine learning applications in acoustics and noise control. He was recently included in the world’s top 2% scientists list by Stanford University. I would like to thank the Packt publishing staff who have been very helpful throughout the preparation of the book. About the reviewer Srikanth Sivaramakrishnan is a simulation engineer specializing in the automotive industry with more than a decade of experience in dynamic simulations, control systems, data analysis, statistical techniques, and machine learning for use in vehicle dynamics, tire modeling, and control systems. He has published and has been a technical reviewer for research papers in multiple automotive journals and for multiple conferences. He currently works as a lead motorsports simulation engineer for General Motors. He holds an MSc in mechanical engineering from Virginia Polytechnic Institute and State University, Blacksburg, and a bachelor’s degree in technology from the National Institute of Technology, Tiruchirappalli, India. Table of Contents Preface xv Part 1:Getting Started with Numerical Simulation 1 Introducing Simulation Models 3 Technical requirements 3 Validation of the simulation model 13 Introducing simulation models 4 Simulation and analysis of results 13 Decision-making workflow 4 Exploring Discrete Event Simulation Comparing modeling and simulation 5 (DES) 14 Pros and cons of simulation modeling 5 Finite-state machine (FSM) 16 Simulation modeling terminology 6 State transition table (STT) 17 Classifying simulation models 8 State transition graph (STG) 17 Comparing static and dynamic models 8 Dynamic systems modeling 17 Comparing deterministic and stochastic models 8 Managing workshop machinery 17 Comparing continuous and discrete models 9 Simple harmonic oscillator 19 Approaching a simulation-based The predator-prey model 21 problem 9 How to run efficient simulations to Problem analysis 10 analyze real-world systems 22 Data collection 10 Summary 24 Setting up the simulation model 10 Simulation software selection 11 Verification of the software solution 12 viii Table of Contents 2 Understanding Randomness and Random Numbers 25 Technical requirements 25 Uniformity test 46 Stochastic processes 26 Exploring generic methods for Types of stochastic processes 27 random distributions 51 Examples of stochastic processes 27 The inverse transform sampling method 52 The Bernoulli process 28 The acceptance-rejection method 53 Random walk 28 Random number generation using The Poisson process 30 Python 54 Random number simulation 31 Introducing the random module 54 Probability distribution 31 Generating real-value distributions 58 Properties of random numbers 33 Randomness requirements The pseudorandom number generator 34 for security 59 The pros and cons of a random number Password-based authentication systems 59 generator 34 Random password generator 60 Random number generation algorithms 34 Cryptographic random number Linear congruential generator 35 generator 62 Random numbers with uniform distribution 37 Introducing cryptography 62 Lagged Fibonacci generator 39 Randomness and cryptography 63 Testing uniform distribution 42 Encrypted/decrypted message generator 64 Chi-squared test 43 Summary 68 3 Probability and Data Generation Processes 69 Technical requirements 69 Exploring probability distributions 76 Explaining probability concepts 70 The probability density function 77 Types of events 70 Mean and variance 78 Calculating probability 71 Uniform distribution 79 Probability definition with an example 71 Binomial distribution 83 Normal distribution 86 Understanding Bayes’ theorem 73 Generating synthetic data 90 Compound probability 74 Bayes’ theorem 75 Real data versus artificial data 90 Table of Contents ix Synthetic data generation methods 91 Simulation of power analysis 98 The power of a statistical test 98 Data generation with Keras 93 Power analysis 99 Data augmentation 93 Summary 103 Part 2: Simulation Modeling Algorithms and Techniques 4 Exploring Monte Carlo Simulations 107 Technical requirements 108 Performing numerical integration Introducing the Monte Carlo using Monte Carlo 122 simulation 108 Defining the problem 122 Monte Carlo components 108 Numerical solution 124 First Monte Carlo application 109 Min-max detection 126 Monte Carlo applications 110 The Monte Carlo method 127 Applying the Monte Carlo method for Pi Visual representation 129 estimation 110 Exploring sensitivity analysis Understanding the central limit concepts 131 theorem 115 Local and global approaches 132 Law of large numbers 115 Sensitivity analysis methods 133 The central limit theorem 116 Sensitivity analysis in action 133 Applying the Monte Carlo simulation 119 Explaining the cross-entropy method 136 Generating probability distributions 120 Introducing cross-entropy 137 Numerical optimization 120 Cross-entropy in Python 138 Project management 121 Binary cross-entropy as a loss function 140 Summary 142 5 Simulation-Based Markov Decision Processes 143 Technical requirements 144 Overview of Markov processes 146 Introducing agent-based models 144 The agent-environment interface 146

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.