Palauan Jellyfish model

This is a model being developed by Mike Dawson and Russell Standish to model the behaviour of jellyfish in a number of lakes on the island of Palau. Jellyfish are photosynthetic animals, so have have a preference for the sun and avoiding shadows. In this model, the jellyfish are represented by agents that have a position and velocity. If the jellyfish moves into shadow, or bumps into the side of the lake, it will reverse its direction. From time to time, the jellyfish will change direction and speed. The random generators governing these are selectable at runtime through the experimental script. Also, jellyfish do bump into each other. In the model display, a jellyfish will flash green if it bumps into another one.

To run the jellyfish model, run the jellyfish.tcl script (located in the models directory), specifying the lake as an argument, eg:

jellyfish.tcl lakes/OTM

You can choose whether to compile the 2D version of the model or the 3D version, by (not) defining the preprocessor flag THREE_D (see Makefile).

The lake itself is represented by a Tk pixmap, with the blue component representing water. The lake shapes were scanned into a GIF file, and edited with a run-of-the-mill paint program to produce the lakes.

Visualising the lake involved creating a Tk canvas widget, displaying the lake image in it, then overlaying it with shadow lines extending from the pixels lying on the boundary, and finally representing the jellyfish with arrow symbols (to indicate position and velocity).

This model illustrates the use of probes. Mouse clicks in the canvas region are bound to a short method that determines which agent is closest to the mouse position. It then colours that agent red (for tracking purposes), creates a TCL_obj representing that agent, and returns the name back to TCL. TCL then calls the object browser (§6.5) on that TCL_obj. In all, 14 lines of C++ code, and 3 lines of TCL code. The result is very effective.

The jellyfish model is written to be run in parallel using Graphcode. The strategy is effectively a particle-in-cell method. The lake is subdivided into a Cartesion grid of cells, and each Jellyfish only needs to consult the cell that it is in, as well as neighbouring cells to determine if it will collide with any other jellyfish.