Discrete event/agent based simulation

Matej Kosik kosik at decef.elf.stuba.sk
Wed Oct 1 13:26:31 UTC 2003


On Tue, Sep 30, 2003 at 12:24:52PM -0700, Simon Frost wrote:
> Dear Squeak list,
> 
> I'm new to Squeak/SmallTalk, and I've found the best way (for me) to learn 
> about an OO language is to implement a discrete event simulation. I've been 
> looking for resources in this vein, and I wonder whether anyone has any 
> other pointers.

Hi

I was having some fun this winter and implemented this:

http://altair.dcs.elf.stuba.sk/wiki/Main/Eveline

I am not sure if you want to invest your time to looking at someone
else code. I think that it partially covers the area you are
interested in.

Eveline was not created without any plan.

- it provides you with the engine for event driven simulations
  (the basic things are implemented very simply).
- it provides you with the random number generator which can give
  you various (discrete/continuous) random number distributions.

I have spent some time with creating of some documentation (the
link mentioned above). I do not feel that it is good. It is only
as good as I was able to make it. I am planning to add some more
elaborate/persuading/interesting tutorials before the summer semester.

(a couple of student decided to Squeakify our school (or at least some
interesting part of it) and this tool is one of the ways how to enable our
students to work in Smalltalk on "Modelling and Simulation" subject -- I am
really keen on how this will end up (and do my best to let it end up
successfully :)

If you look at Eveline, you may let me know what do you think about it.
If you find it interesting/usable/... I will accept any reasonable improvements.

The things which I feel that should/might be added/improved are:

- some nice tutorials (I have a lot of ideas but not as much time to
  realize them)
- some decent documentation
- perhaps reworking the random number generator (look at the class
  RandomGenerator in package Eveline-Core) in a way that:
  - it still will provided you with those fancy random number distributions
  - it will use some more backend (<0,1> rnd. gen) of a better quolity
    than the one I use know (I was lazy thus I use instances of Random
    class). Everything is prepared for this step and once anybody
    implements it and provides in some way - it can be used by Eveline
    easily.
- As you state below, it would be reasonable to make the chronological
  insertion of events into the event calendar more effective. My prototype
  (look at the class EventList in the Eveline-Core package) maintains
  a simple cronological list of the scheduled events. The operation
  of the insertion to it is certainly not effective. You have mentioned
  some more sophisticated methods (red-black tree, ...). It would be
  quite easy to modify my EventList class.
- Transform my simple textual reports dumped on Transcript
  into some Morphic reports (where it is appropriate).
- Make some simple generator of a skeleton of the simulation
  (the user will be able to easily generate the "boring part"
  of the code and then just end the things which are really
  interesting ("handlers" of the simulation events xor defining the
  behaviours of the coprocesses which form the world to be simulated).

I will certainly develop Eveline further. Any help is certainly appreciated.
Although Eveline is no radical step to anywhere. It is only a clean
implementation of some usefull concepts in Squeak.

>
> For a basic DES, one needs the following:
> 
> 1. A random number generator
> 
> I've found a Smalltalk version of the TT800 RNG 
> (http://www.dnsmith.com/squeak/#TT800), and a mailing of a Mersenne Twister 
> (from Makoto Matsumoto, Takuji Nishimura, and Hideo Fukumori). Are there 
> any other implementations I should know about, and have they been tested?
> 
> 2. A scheduler
> 
> My other implementations of DES (in Python and in Eiffel, incidentally), 
> keep sorted timestamps in a balanced binary tree (either an AVL tree or a 
> Red-Black tree). Are there Collections that implement such data structures?
> 
> It's also nice to have some GUI input/output. Specifically, is there a 
> standard plotting library that people use?
> 
> My simulations often involve networks. Are there any nice packages for 
> storing, displaying, and analyzing graph structures? (I've seen some on 
> SqueakMap, but I haven't tried them out yet). Some nice vector graphics 
> routines for animating graphs would be nice too.
> 
> I've also had a look at Microcosms (http://www.agro.uba.ar/microcosms/), 
> which is very interesting, and I wonder how much of my models could be 
> built into this.
> 
> Thanks for any feedback
> Simon
> 

-- 
Matej Kosik <http://altair.dcs.elf.stuba.sk/wiki/Main/MatejKosik>



More information about the Squeak-dev mailing list