Page 194 - DCAP601_SIMULATION_AND_MODELING
P. 194

Simulation and Modelling



                      Notes         By default, all probability distribution functions in AnyLogic, the Enterprise Library objects, the
                                    random transitions and events, the random layouts and networks and the AnyLogic simulation
                                    engine itself – in other words, all randomness in AnyLogic, is based on the default random
                                    number generator. The default random number generator is an instance of the Java class Random,
                                    which is a Linear Congruental Generator (LCG).

                                    If for any reason you are not satisfied with the quality of Random, you can:
                                    1.   Substitute AnyLogic default RNG with your own RNG.
                                    2.   Have multiple RNGs and explicitly specify which RNG should be used when calling a
                                         probability distribution function.

                                    To substitute the default RNG with your own RNG

                                    1.   Prepare your custom RNG. It should be a subclass of the Java class Random, e.g. MyRandom.
                                    2.   Select the experiment and open the General page of its properties.
                                    3.   Select the radio button Custom generator (subclass of Random) and in the field on the
                                         right  write  the  expression  returning  an  instance  of  your  RNG,  for  example:
                                         New MyRandom() or New MyRandom( 1234 )

                                    Setting a Custom Random Number Generator as default RNG

                                    The initialization  of the  default RNG (provided by  AnyLogic or  by you) occurs during  the
                                    initialization of the experiment and then before each simulation run.
                                    In addition you can substitute the default RNG at any time by calling:
                                    setDefaultRandomGenerator( Random r )
                                    However you should be aware that before each simulation run the generator will be set up
                                    again according to the settings on the General page of the experiment properties.

                                    To use a Custom RNG in a Particular Call of a Probability Distribution Function

                                    1.   Create and initialize  an instance of your  custom RNG. For example, it may be a plain
                                         variable myRNG of class Random or its subclass.

                                    2.   When calling a probability distribution function, provide myRNG as the last parameter,
                                         for example:
                                         uniform( myRNG ) or

                                         triangular( 5, 10, 25, myRNG )




                                       Notes  If a probability distribution function has several forms with different parameters,
                                       some of them may not have a variant with a custom RNG, but the one with the most
                                       complete parameter set always has it.

                                    11.1.1 Advanced Properties

                                    1.   Maximum available memory: [Application option, not applied when model runs as applet] The
                                         maximum size of Java heap allocated for the model.





            188                              LOVELY PROFESSIONAL UNIVERSITY
   189   190   191   192   193   194   195   196   197   198   199