swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Instantiating multiple ModelSwarms


From: Fred Wan
Subject: Instantiating multiple ModelSwarms
Date: Wed, 18 Jul 2001 16:49:06 +0200

Hi,

In the swarm tutorial the last example is ExperSwarm. In it is shown how
multiple ModelSwarms can be instantiated and deleted after they have run.
This example is, of course, very instructive and useful when trying to run a
series of experiments with slightly different parameter settings. However,
there are some differences with the schemes of running the ModelSwarms
compared to the previous examples (SimpleObserverSwarm, etc.). These
differences have raised some questions which I am unable to resolve using
the online documentation.

In SimpleObserverBug2 ObserverBug.java (follows the same structure as the
ObjC version), in buildObjects a modelSwarm and display objects (ZoomRaster,
Value2dDisplayImpl and Object2dDisplayImpl) are created and are used to show
the bugs' activities. In buildActions an ActionGroupImpl is created to send
scheduled messages to these objects for which a ScheduleImpl object is
created. In activateIn the schedules of modelSwarm and of the display
objects is created:

        modelSwarm.activateIn(this);
        displaySchedule.activateIn(this);

Now, in ExperSwarm the display objects are left out because we're going to
run several models and we need to look at what's happening at a higher leve.
One control panel is created together with one probe for the different
modelSwarms. In ExperSwarm.buildActions an actiongroup is created that lists
the different messages that are sent out to the objects in one run of a
modelSwarm (buildModel, runModel, ..., dropModel).

In activateIn, only this schedule gets activated (and not a displaySchedule,
because it is left out).

In buildModel, the modelSwarm is activated with:

        modelSwarm.activateIn(null);

My first question is: what difference in effect have the arguments "this"
(SimpleObserverBug2) and "null" (SimpleExperSwarm)?

In runModel the modelSwarm is activated with:

        modelSwarm.getActivity().run();

This is somehow needed to activate the modelSwarm but again it is different
with the way in which it is done in SimpleObserverBug2. What exactly is the
difference?

I want to parameterize my code in a way that I am able to run batches, but
also to see what is happening using the ZoomRaster etc. machinery. I tried
to do this in several ways, but I have not been successful.

My first idea was to create two actionGroups, one for the modelSwarm and
another for the display objects (in buildObjects), and then to activate them
in runModel with:

  displaySchedule.activateIn(this);
  modelSwarm.activateIn(this);

This doesn't work, however, because when the ExperSwarm (or ObserverSwarm)
gets activated, the ActionGroup in buildActions (with buildModel, runModel,
..., dropModel) somehow accesses the procedures in dropModel in which the
.drop() of the display objects is also listed:

        Globals.env.probeDisplayManager.dropProbeDisplaysFor(modelSwarm);
        worldRaster.drop();
        foodDisplay.drop();
        bugDisplay.drop();
        targetDisplay.drop();
        modelSwarm.getActivity().drop();
        modelZone.drop();

The general question is now how to do this, i.e., how to add the display
objects (of SimpleObserverSwarm etc.) to ExperSwarm. Is there an extra Swarm
in between necessary perhaps? The control scheme would then become:
ExperSwarm -> ObserverSwarm -> ModelSwarm

Thanks,
Fred Wan.


                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]