Document: SCL: An Artificial Chemistry in Swarm

next 6.8 Agent Graphics
up 6 SCL Design Notes
gif 6.6 Persistent Storage

6.7 Access to Random State?

Swarm provides a random number library, including a variety of underlying generators. The PMMLCG1 generator is made available (via the globally visible uniformRandom object) by default. A problem with this arrangement is that the underlying PMMLCG object does not provide access to its internal state. This makes it impossible to stop a simulation and save it to disk in such a way that, when restarted, it will continue along exactly the same, deterministic, trajectory. One may query whether this is necessary or not: in a stochastic simulation such as SCL, any phenomena of real interest ought to be robust and statistically repeatable anyway. Nonetheless, for debugging and demonstration purposes, it is often convenient to be able to reproduce a model trajectory exactly, and I considered that an essential feature in SCL. I worked around this deficiency simply by creating a new object class, SCLRandomBit, subclassed from PMMLCG1, which provided methods to save and load the exact state of the generator to or from a disk file. Methods are also provided to access and/or set the state, for good measure; in SCL these are used to allow the worldManager (and thus the user) to monitor or alter the state if desired.



next 6.8 Agent Graphics
up 6 SCL Design Notes
gif 6.6 Persistent Storage

Document: SCL: An Artificial Chemistry in Swarm

Copyright © 1997 All Rights Reserved.
Timestamp: Tue Dec 31 19:40:38 GMT 1996

mcmullin@eeng.dcu.ie