 Welcome to my lecture on simulation type. If you're ready to start building, implementing your simulation model, before you begin and look at any other issues, you really need to decide strategically, is the simulation of the terminating type or is it the non-terminating or steady state type? Let's take a look at what that means. This is a strategic consideration as we'll see throughout this brief lecture and also later in the semester as we look at the statistical design and analysis of simulation experiments. More or less we're talking about the design part then. And this decision, this strategic decision gives off a whole lot of other tactical decisions that follow. And those we will talk about here, primarily things having to do with how we initialize the simulation and how long we let it run and how many replications or even how we do replications. So yes, it's going to impact the statistical analysis, that's bullet point two here, but it's definitely critical to the modeling effort because if you change your mind midstream, you really can't use the model you were working with, you have to go back to the beginning. The terminating simulation is one that has a natural ending point and by extension it has a natural beginning point. We say that a terminating simulation knows when it terminates. It has an actual event, E, that when it's encountered, when this event is encountered, it stops the simulation run at whatever time the event occurs at time T sub E. So that's just the mathematical definition of what a terminating simulation is. Basically a terminating simulation, or we could even say at this point a terminating system which you probably want to simulate with a terminating simulation, are systems that have a definite organic start and stop. You'll have a retail shop and it opens at nine and ends at five. A bank may open at nine and end at three to close the doors. A hospital clinic would probably keep longer hours, but it'll depend on the system that you're studying. So the run length for a terminating simulation is very well defined before you even start. There are no decisions to make there. You're running the simulation to simulate the reality of the system in some way. And when we run a terminating simulation, if we're doing, let's say a shop that opens at nine and closes at five or six, right? We want to make sure that our accumulated statistics are accurate. If you open at time zero and you don't have any customer coming into service for 10, 15 minutes or so. So that's a lot of idle time that may not really represent reality. So one thing that needs to be done is to check the distribution of the people who are at the doors when they open and see each day perhaps keep count and see if you can fit it to a probability distribution. Sometimes maybe there are zero. I mean, it'll depend on the system and you want to look into that. But basically with terminating simulations, we have a way to proceed to go forward. We want to model reality. A steady state simulation, on the other hand, is non-terminating. There is no special event that when it occurs automatically stops the simulation. That's one of the decisions then that has to be made by the simulation researcher. How long do we let it run? When do we stop this simulation and collect the data? The system is presumably supposed to run until the system, the simulated system, is in a state of dynamic equilibrium. And you need to have some way of determining that. The measures of effectiveness are defined as limits as the simulation run length approaches infinity, much like the limits for the parameters in the analytic solutions, the steady state solutions, let's say in queuing theory. Some examples, well, if you're going to look at a system that's non-terminating and that you want to simulate, you might be looking at anything that's open 24-7, a machine shop, a call center, a hospital emergency room, and so on. So the computer run is considered infinite, although we all know it really isn't. There has to be some way artificially of deciding when to stop it. So a system may be non-terminating and a system may not have a beginning or an end, but if you're running a simulation, even if you're running a steady state non-terminating simulation, you need an artificial end and you also need an artificial beginning. When do we use a terminating simulation? When do we use a non-terminating simulation? Sometimes that's an easy decision to make, sometimes less so. If your system is terminating, it just makes sense to at least first look at a simulation that's terminating, match it, match it to reality. If your system is non-terminating, you also might want to do a non-terminating type of simulation. So those are the two cells labeled good because they match. On the other hand, if you have a system type that's terminating, might you want to run a simulation that's a steady state simulation model? You might actually. Let's say you know you have a cafeteria and most of the time it's very, very, very much not busy. Everything is available and people can walk in, go into service, do whatever they want. But how about lunchtime? Lunchtime might be terribly busy. So sometimes what you want to do is run your busy time, run a simulation with your busy time parameters and run it to see, not for any other reason, but to see how bad it is. You want to see how robust your system is. Can it get into steady state? Can it get into the state of dynamic equilibrium? How much can the system stretch to accommodate this busy time? And then the other not a match, where you have a system that's non-terminating and yet you're running a terminating simulation. We're going to see in a few slides that's done all the time for something called transient state analysis. When you have a non-terminating system, it's a 24-7 system. If it's in dynamic equilibrium, it's in dynamic equilibrium. So where do I start my simulation? If I'm starting my simulation at empty and idle, I have my first entity moving through the system. I have resource giving service or giving product. It's going to take a long time for that system to get into dynamic equilibrium. And so that's a waste. It doesn't reflect the real non-terminating system that you're studying. But sometimes that's actually what you want to study. How long does it take till I get into a piece of the model where I can recognize the real world? One of the important issues that will come up, and these are what we call tactical considerations, that will depend upon your decision of whether to use a terminating or non-terminating simulation, is what to do about the start, the starting conditions for your simulation model. Typically, if you're doing a terminating simulation, you will start out, at least initially, doing your simulation run, starting it in empty and idle. At time zero, your system is empty. Your entities are starting to come in to arrive, according to the inter-arrival time distribution specified. And so it's kind of a way, a slow start to a day, you might say. This may actually reflect the system that you're studying, but it might not. So once you have your simulation model built, and it seems to be running nicely, one of the enhancements that you typically do very quickly, right away, actually, is to add more realistic starting conditions. Are the servers busy with something before the day starts? Are there five customers waiting when you open the doors? Is there any leftover work? Perhaps the work doesn't only depend on a physical customer being in the system. What are people doing at time zero? The picture you see is a realization of what one run of a steady state or non-terminating simulation might look like. The x-axis is time, or in this case, number of observations, number of entities moving through the system. But basically that's proxy for time or vice versa. And the vertical axis is delay. And you could be talking about delay in queue or time spent total in the system. So you see what initialization bias looks like. At some point in a non-terminating simulation, the system is expected to get into steady state if you run it long enough. We don't always know what long enough is, and that's very often a trial and error kind of thing. But when you start at empty and idle, you have the running average of your delay, your statistic. It's going to be influenced by the early emptiness and idleness of the system. And it'll take a while to get rid of that from the statistics you're accumulating. That's why it's so important to look at how we start the simulation and what our starting conditions are. So there must be something we can do about initialization bias. It's not a recent finding. It's been with us ever since simulation researchers started. And simulation started when digital computers started, when they were still called digital computers. So what are the recommendations? What can we do to either get rid of or minimize the initialization bias, the initial conditions problem in a simulation? Well, the first thing we can do is get a better start. Work on starting the simulation with typical input parameters. If you can look at a system that's in steady state and capture the state variables, start your simulation, even though it's a non-terminating simulation, you can choose the values of your state variables at start. So that's one way to go. Secondly, you can always increase the run length. You see that as the run length increases, we get closer and closer to steady state, even if we had a huge degree of initialization bias. So if that's true, why don't we just run the simulation for an incredibly long time and overwhelm that initialization bias so that we don't have to worry about it? It's a very good idea, but of course the question always is, how do I know? And this is something that requires its own lesson. So it'll be worthwhile talking about later on. Finally, we can, you see the picture of initialization bias? We do that. That's called a warm-up. And then at some point, again, at some point which we have to determine, we throw the initial data away and then say, okay, fine. I know what my typical values are. It's around here. So I'm going to reset the simulation and start fresh. So somewhere about, oh, let's say 3,000 customers on the horizontal axis, we can cut things off, restart the simulation at that point. And we've thrown away the initial transient state of data. And so we're going to get into a steady state much faster and we'll be able to use the rest of the data. Now, just quickly, one way that's typically used to figure out when our initialization bias is over, when we can reset, when our model is reflecting something reasonable, is to do it graphically. You sometimes run a simulation, get an output like this, take a look at it. And then arbitrarily choose a point to reset. You can build it into your simulation program. It'll certainly be better than what you have here, starting with empty and idle. And you can also generate several runs, several realizations of the simulation. And just eyeball it and figure out when you think is a good time to restart. So this is a continuation of the warm up first then reset with the recommendations and questions. How long do we wait? How do we know when our initialization bias is over or is low enough so that we can reset and start the simulation fresh. We look at the plots as I said a few minutes ago, a few seconds ago. You can also, by the way, do a statistical test. You can do some time series analysis. You can test successive observations to see how large or small the differences. Even better than successive observations might be to collect the observations, let's say group them in groups of five and take the mean of the successive groups and see how far apart they are. As they move along the run, those values observed or those means will get closer and closer and closer. And so let's see. There apparently is a process here. One, two, three. We run the model until typical operating conditions have been met. That's what we were discussing. How do we do that? But let's say we can do it. We do it. Step two, we reset, which means we throw out everything that was collected up to that point. But we don't change the state of the model because we're going to start not from empty and idle and time zero. We're going to start from now, from wherever the reset point is. And then finally, we continue the simulation, gather the statistics. And then we just have to decide on the run length, which is a different question than initial conditions. And we'll get to that. Here we just have an image that shows what I talked about before. If you take a look at the empty, the initialization bias in this image and imagine the point that let's say about 3000 observations or 3000 customers or 3000 entities where you're going to reset the simulation. Instead of throwing all of that away and restarting the simulation, that's your simulation. And that's called transient state analysis. Sometimes we're particularly interested in studying the system until it gets into steady state. Once it's in dynamic equilibrium, we feel it's pretty stable. But how does the system look if we start at empty and idle and how long does it take to get stable? And this will be different for different systems. So sometimes it makes a very interesting piece of research. The other critical issue related to the simulation type, because it's treated differently for terminating simulation and a non-terminating simulation, is, believe it or not, the issue of sample size. It seems like a very simple issue because it always was simple in a typical statistical experiment that you used in your statistics classes. But with simulated data, it becomes a little bit more complicated. We know that simulation is just a statistical experiment. It's an experiment where we're collecting our data using a simulation model. We know that in a statistical experiment, we don't want a sample of size one. N equals one is not something that you can work with. You need a sample. You need a sample size. Sometimes you need a rather large sample size. But what do we do? How do we get our sample size? How do we collect data that's more than just one value? Well, the fact of the matter is it's going to be different if we're talking about a terminating simulation or a non-terminating simulation. Let's take a look at it. It's actually pretty easy to get a handle on sample size in a terminating simulation, a simulation that has a definite beginning and a definite end and a definite run length, and one value for each measure of effectiveness that you're studying that comes out of the run. Well, it's called replications. We use the different random number streams, so we're using randomness in order to model the variation in the real world. And we have as many replications as we want. Computer time is relatively cheap in these days, and that's a big benefit for simulation. We have as large a sample as you want. So replications, where you're repeating the simulation run and coming up with another value at the end of it, that's how we increase our sample size. Each replication of a simulation, if it's a terminating simulation, is independent and identically distributed, which is the requirement for the data points in your sample. How about in a non-terminating simulation? How do I get my sample data? Well, like I said, computer time and space is cheap. You could do a simulation run based the run length on some decision, some strategy somewhere. And for whatever it is, it's going to be different with different systems and different simulations. But then treat that as one replication and say, okay, fine, I'm going to do it again, and I'll do it again. I'll do it 50 times or 100 times or 1,000 times, and that's how I'm going to get my sample size. It might be considered a brute force way of doing things, but it's certainly statistically valid, and it's simple. It's easy to do and easy to explain to anybody. Then you've got the various time series methods where let's look at the time series one first. If you've had a course in time series, you know that you analyze a series of observations, the excess time, just like in a simulation. And you know that these are not independent, identically distributed values. You know they're auto-correlated. Every value has some relationship to what came before, right? So time series techniques takes advantage of that, and that's the way we analyze real time series data. So why not analyze simulation time series data the same way? The batch means method might be a little bit simpler mathematically, not really sure, but it might be. And it might also be a little easier to explain, especially for people who have not studied time series. The batch means method is where you say I'm going to take one long simulation run. That's how I'm collecting all my data, much like what we did when we talked about time series. However, once I'm finished with the simulation run, or even while it's going along the way, I'm going to partition the run into consecutive, non-overlapping batches of observations of equal size. So if I'm generating delay in queue, let's say, then instead of just treating my entire run as a way of averaging time average of delay in queue, I take my values as they come in batches of whatever decision we make, batches of 10, batches of 20. And for each batch, we get a mean and each of those means is our data point. Because one thing that you want to do and that this method does for you is it reduces the correlation, the autocorrelation in the data. Time series methods makes use of autocorrelation. We want IID data here. So if we take batches of data, get the mean of each batch, and use that mean as our observation, it's going to definitely reduce the autocorrelation. You know what else will reduce the autocorrelation even more? Finning, where we take, let's say, batches of 10, but in between the batches, we throw away three observations. And so that enhances, that helps even more and makes our, minimizes the autocorrelation even more. Thank you very much for attending this lecture. However, however brief it is, maybe brief is better. We looked at the two very, very different types of simulation models, terminating and non-terminating. And we looked at the issues that follow from that strategic decision of which type of simulation to use. One issue has to do with initial conditions, in other words, the starting point. And then you might say the other critical issue has to do with the ending point. When do we stop? How long is the run? And naturally, you're going to see some of this coming up again, because we can't get away from talking about these issues in the context of building the model. And then we also have to look at these issues in the context of designing the statistical experiment that's built around the simulation model and the simulation run. So we'll see it again in that section of the course.