Swarm: contributed code
This page describes code contributed for re-use by Swarm users. Much of the code is on the Swarm contrib download site, but some is maintained separately on the users' own sites.
Contents |
Swarm contrib download site
Part of the Swarm download site is set aside for user-contributed code. Swarm users are encouraged to look for useful stuff here, and when they develop something useful or interesting, to put it here. (Unfortunately, there is no clear separation on the contrib site between full applications and code intended as re-usable tools.)
We abolished the old "eval" and "anarchy" distinction with contributed packages. We now split up package by language (java or objc), and within that by "contrib" packages (which now includes all the old packages that used to be in "eval" and "anarchy") and "sdg" packages (the core demonstration applications that the SDG maintains).
Contrib site for Java applications
Contrib site for Objective-C applications
How to contribute
How to contribute to the Swarm user community!
Note that the former incoming directory on the download site is no longer functional for security reasons.
Contributing is simple:
- make sure that your application follows the naming conventions for packages as described on the Swarm App Archive as maintained by Paul Johnson.
- create a tarred and gzipped file with extension tar.gz
- send an e-mail to swarm@swarm.org to arrange a way of transferring it to the site.
One of us will take a look at what you send us and move it to the contrib directory so others can download it.
License for contributions: Since Swarm is released under the GNU GPL, contributions must also be released under a GPL-compatible [http://www.gnu.org/licenses/license-list.html Free Software License] (many so-called "open source" licenses also qualify as GPL-compatible, but you should check the list at the Free Software Foundation given above).
Some contributed code
Here are examples of contributed code on the Swarm download site.
Most of the information on this page is out of date (there may be newer versions of packages), so please always also consult the download site directly: http://ftp.swarm.org/pub/swarm/apps
- Download: Breeder-2.1.tar.gz
- Description: genetic algorithm library
- Author: contributed by JJMerelo.
- Notes: Please read the documentation for this package
- Download: NeuroLib-2.1.tar.gz
- Description: neural network library
- Author: contributed by JJMerelo
- Notes: Please read the documentation for this package. link is broken
- Download: graph-2.1.tar.gz, Bank-2.1.tar.gz, DynamicGraph-2.1.tar.gz
- Description: limited graph library and two demos
- Author: This was contributed by Manor Askenazi and modified and extended for Swarm 1.0.5/1.2 by Alex Lancaster.
- Notes: Docs are provided in HTML and postscript and Microsoft Word. Comments & suggestions are more than welcome. This package is currently unmaintained, and should probably be replaced by a Java graph library. 1 links is broken
- Download: shuffler.tar.gz
- Description: The Shuffler object takes a list pointer and a number of elements as an input and rearranges the elements of the list.
- Author: Shuffler object donated by Ted Belding.
- Download: Grid1d.tar.gz
- Description:
- Author: Grid1d object donated by Ted Belding.
- Download: Strattice.tar.gz
- Description: A 2d discrete stratified lattice.
- Author: Donated by Jim Clark clark@cim.mcgill.ca
- Download: Vision.tar.gz, VisionDemo.tar.gz
- Description: An implementation of rudimentary agent "vision" where each seeing agent carries a camera. *Author: Donated by Fabrice Chantemargue.
- Download: 3dLib-0.1.tar.gz
- Description: A simple class that implements discrete 3 dimensional space.
- Author: Donated by Glen Ropella.
- Download: Tipsy Bugs 0.05
- Description and author: This is Barry's "whipping boy" application upon which he inflicts all his new ideas. It displays a number of variations on the "heatbugs" theme, like on-the-fly lattice tiling and neighborhood switching, coordinate objects, and the distinction of model-specific vs. display-specific behavior of agents.
- Download: dispersion.tar.gz
- Description and author: This is Bruno Cuvelier's "proof-of-principle" demo application that was inspired by dispersion in fish shoals. Among the intersting parts of this demo is a way to model different types of agents that move at different frequencies.
- Download: DataFile.1.0.tar.gz
- Description: This is a set of classes that are designed as simple measurement devices that take data from objects and send that data to a file.
- Author: Contributed by Benedikt Stefansson.
- Download: Heatbugs Block Diagrams
- Description and author: generously donated by Nelson Minar who was one of the original developers of Swarm. These are also available [heatbug-block/ online].
- Download: BoolLib-2.1.tar.gz, boolNet-2.1.tar.gz (currently unmaintained).
- Description and author: Alex Lancaster has donated a Kauffman boolean network library and a demo to show how it works (a number of new features that involve a more sophisticated use of random numbers has been added). The latest version, 2.0 has been updated to work with Swarm 2.0 and higher and may work with earlier versions, but this is not guaranteed. Note that this also requires graph-2.1.tar.gz to run (may run with earlier versions, but this is not guaranteed).
- Download: zoomraster-movies.tar.gz
- Description and author: Nelson Minar worked up new ZoomRaster and XColormap objects to take snapshots of the Raster.
- Download: batchraster-movies.tar.gz
- Description and author: Benedikt Stefansson massaged Nelson's ZoomRaster so that one can take Raster snapshots while running in batchmode.
- Download: Player-1.6.tar.gz
- Description and author: Patrick McNeill has created a Simulation Playback program that will play prerecorded 3D images from a simulation. It uses either OpenGL on an SGI or Mesa on Solaris and Linux.
- Download: potential.tar.gz
- Description and author: This is Artan Simeqi's implementation of the potential field around fixed point charges. It might serve as a good background on which to place charge-sensitive interacting objects.
- Download: No longer available.
- Description and author: This is Nelson Minar's implementation of SugarScape in Swarm.
- Download: SvenSpaces-970805.tar.gz
- Description and author: Here are some classes contributed by Sven Thommesen that allow multiple occupancy in a Grid2d space.
- Download: Multi2d.tar.gz
- Description and author: And here's some code developed by Erik Nelson in parallel to Sven's that does the same thing in a different way.
- Download: Script.tar.gz
- Description and author: Benedikt Stefansson has contributed a "Script" utility. This is a number of classes that reads and executes messages to objects in a Swarm simulation at runtime. It allows the user to alter a Swarm model's behavior in a deterministic fashion without recompiling the application.
- Download: bp-ct-1.2.tar.gz
- Description and author: Pietro Terna has implemented this library that handles simple artificial neural networks, trained using the error backpropagation (BP) technique. The code applies the Environment-Rules-Agents (ERA) scheme and can generate neural network inputs to target the Cross Target (CT) technique. More information about these terms is avaialble here
- Download: ct-hayek-1.2.tar.gz
- Description and author: A companion package to bpct.
- Download: CW-0.1.tar.gz
- Description and author: Gianluigi Ferraris has implemented this learning classifier system which includes a workbench for running experiments.
- Download: GM-0.1.tar.gz
- Description and author: Gianluigi Ferraris gianluigi.ferraris@STUDENTI.TORINO.IT has implemented this library that manages the genetic evolution of a set of chromosomes, with their agent associations.
- Download: majority-2.1.tar.gz
- Description and author: Paul Johnson has implemented this simulation model of the spatial theory of voting from political science. The "agenda setter" offers alternatives to voters and if the majority support a change from one point to another, then the policy is changed. This is presented as a simple model useful for pedagogical purposes and it has plenty of comments throughout.
- Download: bell-0005.tar.gz
- Description and author: Ralf Stephan developed this self-documenting literate program describing the development of a toy Swarm model. Also available as HTML, DVI, and PostScript.
- Download: NewBoids.tar.gz
- Description and author: A cleaned-up version of Eric Werk's Swarm implementation of Craig Reynolds' Boids model. Contributed by Steve Railsback, coding by Steve Jackson. Includes a powerful vector arithmetic class.
- Download: ClupeoidsV1.tar.gz
- Description and author: A modification of Eric Werk's Swarm implementation of Craig Reynolds' Boids model, for simulating fish schooling. Contributed by Steve Railsback, coding by Steve Jackson. The parameters that control movement (relative importance of matching school velocity vs. school centering; maximum velocity and acceleration; the field of view over which other fish are detected) can be modified during a run, often causing interesting changes in behavior. A selected number of fish can be forced to move to a specific spot, to see how many of the other fish follow them.
- Download: ClupeoidsV2.tar.gz
- Description and author: Like ClupeoidsV1, but a more significant modification of Eric Werk's Boids code. Contributed by Steve Railsback, coding by Steve Jackson. The movement algorithm is much more conventional and understandable. Fish move only to match the velocity of, and direct themselves toward, other detected fish.
1Paul Girard from SAIC has brought to our attention a problem with the algorithm used to position the nodes on the Canvas graph in GraphLib (of the two demos - this feature is only used in DynamicGraph, and only affects the position on the Canvas and not the underlying data structure). We are currently working on merging this change into GraphLib itself. Paul Girard has also kindly provided us with a corrected version that fixes the incorrectly formulated algorithm available at: boingGraph.tar.gz.Note that this library was previously "bundled" with the demo apps. Earlier versions are still available on the ftp site.
Contributed code maintained elsewhere
Some very useful Swarm tools are maintained and provided by their developers.
Drone and other packages at U. Michigan Center for Study of Complex Systems
Our wiki hosts at the University of Michigan Center for the Study of Complex Systems maintain a collection of Swarm-related software at: http://www.cscs.umich.edu/Software/Contents.html. Their software includes several example applications and:
Drone, "a tool for automatically running batch jobs of a simulation program. It allows sweeps over arbitrary sets of parameters, as well as multiple runs for each parameter set, with a separate random seed for each run. The runs may be executed either on a single computer or over the Internet on a set of remote hosts. Drone is written in Expect (an extension to the Tcl scripting language) and runs under Unix. It was originally designed for use with the Swarm agent-based simulation framework, but Drone can be used with any simulation program that reads parameters from the command line or from an input file."
EcoSwarm at Humboldt State University
EcoSwarm is a collection of Objective-C Swarm tools for ecological modeling, but many of them will be useful for non-ecologists. It is available from the Individual-based modeling at Humboldt State University web site. The following tools can be downloaded (along with complete documentation!!):
- BreakoutReporter: This set of classes provides a data collection device for model populations. It allows easy file output of statistical summaries of selected agent characteristics, broken out by agent traits. With one statement, the programmer provides the name of an output file and a Swarm list containing the population of objects from which data are to be reported (e.g., the list of animals alive in the model). Additional simple statements specify what variables are to be reported (e.g., animal abundance, weight, growth rate, etc.), what categories are used to break out results (e.g., by species, age, sex), and whether the output should be the count, total, mean, maximum, or minimum. Columns of additional data (e.g., date, temperature) are easily added to the file. Statistics are re-calculated and a line of output written whenever the "update" message is executed.
- TimeManager: The Time Manager class has two main functions: keeping track of model time in simulators using daily, hourly, or other time step sizes; and providing a number of handy time-related calculations. The class uses the operating system's "time_t" format (number of seconds since 1/1/1970) and date-time functions. The user can, for example, set the simulation's start time, end time, and time step size, and the Time Manager keeps track of current time. The time-related calculations include (for example) determining whether the current model time falls within a specified date window and determining the number of days between two time values.
- ParameterManager: The Parameter Manager class creates objects that contain the parameters for some other component of a model (e.g., for the animals in a population model). Parameters are added to the model simply by including them in the ParameterManager.h file. The first purpose of the Parameter Manager is to easily allow model agents of various subclasses to have parameter values that vary among subclasses, even if the equations using the parameters are coded in the superclass. For example, a trout model has a superclass "Trout" and subclasses for various species of trout ("Rainbow", "Cutthroat") that may be in the same model. Creating one Parameter Manager object for each species allows every fish to have species-specific parameter values even though most of the code for trout behavior is in the Trout superclass. The Parameter Manager has a second important function: it verifies that all parameters have been initialized. Parameter values are read from an ASCII file using Swarm's "Object Loader". The Parameter Manager uses Swarm's probe facilities to automatically identify any parameters that were left out of the ASCII file.
- InterpolationTable: This class performs simple linear and logarithmic interpolation, using pairs of X, Y points provided as input. It also can be used as a lookup table from which values are interpolated.
- TimeSeriesInputManager: Most simulation models use time-series input for driving variables- for example, ecological models typically use hourly or daily input for weather, river flow, etc. The Time Series Input Manager class reads an input file of time series data, creates an array of the data needed for the current model run, and provides the correct input to the model for the current time. The Time Series Input Manager can be used with daily, hourly, or other (user-defined) time steps.
- SurvivalProbabilityManager: Ecological IBMs typically model survival (mortality) of individuals using stochastic functions: A random draw is used to determine whether each individual survives each time step, but the survival probability is a function of the individual's state and its habitat. A number of different survival probability functions are usually defined, each representing one potential source of mortality (starvation, predation, extreme weather, etc.). The Survival Probability Manager is a group of classes that (a) allow the programmer to quickly define the survival probabilities and (b) manage the survival simulations. A primary benefit of the Survival Probability Manager is minimizing the code needed to add, delete, or modify mortality models. The Survival Probability Manager is also potentially useful for other kinds of model in which events are modeled as stochastic functions of one or several inputs.
- YearShuffler: Often in long ecological simulations, the modeler is concerned that results can be partly an artifact of the sequence of annual habitat conditions. For example, the habitat input for a model might include some years with unusually good conditions and some years with unusually bad conditions; results of the model might be affected by how many good and bad years are simulated and the order in which they occur. One way to deal with this potential problem is to re-run the simulations with the years in different orders. YearShuffler is designed to support such analyses. It modifies time series input data to randomize the sequence of years, either without replacement (each year is used only once) or with replacement (years may be used more than once or not at all).
- SolarManager: Solar Manager provides functions related to day length and solar energy modeling. The user provides a site latitude and date, and Solar Manager can calculate such variables as day length (hours of sunlight), sunrise and sunset time, and an estimate of daily mean solar radiation. The class also includes a tool for estimating hourly temperatures from daily minimum and maximum temperatures (often, the only available data).
- WaterTemperatureModel: WaterTemperatureModel is a class calculating heat fluxes and temperature changes for waterbodies. It is designed especially for shallow, still waterbodies such as ponds or river backwaters. Heat fluxes due to solar radiation, atmospheric radiation, water back-radiation, evaporative cooling, and convection are modeled simply, using inputs such as air temperature and humidity, wind speed, and surface area.

![[Main Page]](/stylesheets/images/wiki.png)