Java Reference
In-Depth Information
1 /**
2 * Quickie main for testing purposes.
3 */
4 public static void main( String [ ] args )
5 {
6 CallSim s = new CallSim( 3, 5.0, 1 );
7 s.runSim( 20 );
8 }
figure 13.11
A simple main to test
the simulation
(but the reasons for doing so are beyond the scope of this text). Additionally,
assuming a fixed time between dial-in attempts is also inaccurate. Again, a nega-
tive exponential distribution would be a better model. If we change the simula-
tion to use these distributions, the clock would be represented as a double . In
Exercise 13.13 you are asked to implement these changes.
summary
Simulation is an important area of computer science and involves many more
complexities than we could discuss here. A simulation is only as good as the
model of randomness, so a solid background in probability, statistics, and
queueing theory is required in order for the modeler to know what types of
probability distributions are reasonable to assume. Simulation is an important
application area for object-oriented techniques.
key concepts
discrete time-driven simulation A simulation in which each unit of time is pro-
cessed consecutively. It is inappropriate if the interval between successive
events is large. (513)
event-driven simulation A simulation in which the current time is advanced to
the next event. (514)
Josephus problem A game in which a hot potato is repeatedly passed; when
passing terminates, the player holding the potato is eliminated; the game
then continues, and the last remaining player wins. (508)
simulation An important use of computers, in which the computer is used to
emulate the operation of a real system and gather statistics. (507)
tick The quantum unit of time in a simulation. (513)
 
 
Search WWH ::




Custom Search