SyncModel - RePast netstart

(Last update February 23, 2007)

 

This is a model of synchronization of agents . . .

It is an example of a stand-alone network accessible RePast model. It was built with RePast 3, using MacOSX XCode with the Java Ant-based Web Start application options. You can give it a try by clicking on the .jnlp file here. (Note: in order to run, it will download a 1.5 megabyte file . . .). (It will ask you if you want to trust me -- I guess that will be up to you :-)

SyncModel.jnlp

It is possible you will have to find the file and fire it up with a Java Web Start application . . .

If you're interested in the Java/RePast source code, drop me a line . . .



This is a basic "synchronization" model.

I put the model together after reading the book "Sync" by Steven Stogatz (a nice little book, and worth reading . . .)

It implements a model of how fireflies can synchronize their flashing. Each firefly gradually recharges itself ("matures" . . .) until it reaches a threshold, at which point it flashes its light. It then has a brief latency period, then recharges again, and flashes again. The fireflies interact by mutual stimulation -- when a firefly sees another firefly flash, it gets a little boost in its recharge cycle (i.e., gets a little closer to its flashing threshold . . .). Fireflies also have a "latency" period after the flash before they can start recharging again.

This is a (somewhat) possible model for firefly synchronization, but likely not a fully probable (or plausible) model -- the boost from seeing other fireflies flash is linear in the number of flashes seen, etc. . . . That may or may not matter . . .

There are various parameters (see below) . . .

With the default parameters, synchronization can happen in under 1000 timesteps, or take as many as 30,000 timesteps . . .



 // default and modifiable parameters of the model 

public static boolean Moving = false; // Do agents move private static int NumAgents = 1500; // Total number of agents // (must be <= 2500) public static double SyncStep = 0.03; // Rate at which agents "mature" // toward flashing public static double SyncBoost = 0.925; // Boost toward threshold from // seeing another agent flash public static double SyncLatency = 3.0; // Latency after flashing public static int SyncMax = 150; // Threshold for flashing public static boolean SyncRegion = true; // Do agents affect only nearbys // or everybody public static int RegionSize = 16; // Size of the local region for // local effects private static boolean ViewAvg = true; // Whether to show average maturity // of all agents


Colors of the agents:
if (maturity > 250)
      Color = magenta;
    else if (maturity > 200)
      Color = pink;
    else if (maturity > 150)
      Color = red);
    else if (maturity > 125)
      Color = orange;
    else if (maturity > 100)
      Color = yellow;
    else if (maturity > 75)
      Color = cyan;
    else if (maturity > 50)
      Color = blue;
    else if (maturity > 40)
      Color = green;
    else if (maturity > 30)
      Color = lightGray;
    else if (maturity > 20)
      Color = gray;
    else if (maturity > 10)
      Color = darkGray;
    else
      Color = black;