One of the most interesting projects I have ever worked on was in college. I was taking a fascinating course called “The Philosophy of Science” in which we learned a lot about evolutionary game theory and other scientific/mathematic techniques of testing theories. (You can check out the current syllabus on the Rutgers Web site.)

My project was to use software to model a scientific theory in order to test it. I ended up using a package called StarLogo. StarLogo’s latest incarnation, StarLogo TNG 1.0, was just released, so I thought I would share my experiences with the older version.

The assignment: Test Gordon’s theory

I was assigned to read Ants at Work: How an Insect Society is Organized by Deborah Gordon. Then, I had to model the central hypothesis of the book as precisely as possible in software, and see if implementing the theory as described in software would result in a close approximation to what was being studied.

Gordon theorizes there is no centralized management of ant colonies and that ants release pheromones indicating what task they are performing. When an idle ant detects a “work pheromone,” they follow the chemical trail and try to perform the same type of work. It is an elegant theory that neatly fit the observed behavior.

As a result, the model that I followed was a cellular automaton system. In such a model, there is no “master program” that controls things, but a number of independent agents that all run the same code (or agents grouped by “species”). Each agent is essentially its own program, and you study the interactions of the agent with other agents and the environment.

StarLogo provided a framework for this project. It established the idea of a “world” composed of “patches” (think of pixels in a bitmap) that could be assigned properties. The “agents” were called “turtles” (due to its roots in Logo) and were given code to execute. It also provided UI elements, including sliders to adjust environmental factors, a pause/play button, output windows, and visual display of the patches. When running, it operated in iterations; the main routine of each turtle was run once per iteration, and any actions that were taken were executed simultaneous, so each turtle made their decisions in an identical environment.

The result: A flaw in the theory

Using StarLogo, I discovered that Gordon’s theory had a critical flaw. It was essentially a perpetual motion machine, but nothing was providing the initial energy. In other words, if all ants do what other ants are doing, they all remain idle unless one ant starts doing something for some reason external to the model. By modifying my code to simulate an artificial stimulus (having a random number of ants at start up automatically be assigned a task), I resolved the problem, and the model worked precisely as expected.

StarLogo was a great tool for this kind of work. It freed me from having to worry about any of the programming other than modeling the relationship between the ants and their world (the turtles and patches). It was also a snap to hook the UI elements to the model. Overall, the documentation was good enough to get me going.

Check out StarLogo TNG

I haven’t looked at StarLogo much since then, but I stayed on the mailing list. So, when I saw that version 1.0 of StarLogo TNG was released, it sparked this flood of good memories.

If you have a need for a modeling tool like this, go ahead and give StarLogo TNG a look.


Disclosure of Justin’s industry affiliations: Justin James has a working arrangement with Microsoft to write an article for MSDN Magazine. He also has a contract with Spiceworks to write product buying guides.


Get weekly development tips in your inbox
Keep your developer skills sharp by signing up for TechRepublic’s free Web Developer newsletter, delivered each Tuesday. Automatically subscribe today!