Inherits From:
Declared In:

Class Description

The ASMObserverSwarm is a Swarm with a graphical user interface (GUI). It follows the prototype Swarm model, in that the Observer Swarm is thought of an entity that can describe or report on the state of a simulation, but not interact with it. The Observer causes the ASMModelSwarm to be created, and it monitors various variables by checking directly with the agents.

Note that the ASMObserverSwarm has a set of "standard" methods that Swarms have--buildObjects:, buildActions, activateIn:--and inside each one it makes sure that the next-lower level, the ASMModelSwarm, is sent the same message.

If you don't want to watch the GUI, run the model in batch mode, meaning you use the -b flag on the command line.

Instance Variables

int displayFrequency;
id <ActionGroup> displayActions;
id <Schedule> displaySchedule;
Output * output;
ASMModelSwarm *asmModelSwarm;
BOOL writeParams;
BOOL writeData;
id <EZGraph> priceGraph;
id <EZGraph> volumeGraph;
id <Histogram> positionHisto;
id <Histogram> relativeWealthHisto;
id <Graph> deviationGraph;
id <Averager> deviationAverager;
id <GraphElement> deviationData;
id <ActiveGraph> deviationGrapher;

displayFrequencyupdate frequency for graphs
displayActionsset of actions necessary to keep display up to date
displayScheduleSchedule that causes the displayActions to be carried out
outputAn output object
asmModelSwarmInstance of ASMModelSwarm, where agents and the world are created and scheduled
writeParamsIndicator that files including parameter values should be written
writeDataIndicator that files including output values should be written
priceGraphTime plot of risk neutral and observed market price
volumeGraphTime plot of market trading volume
positionHistoHistogram showing amount of stock held by each individual agent
relativeWealthHistoHistogram showing wealth of agents
deviationGraphAs of ASM-2.0, this was commented out in ASMObserverSwarm.m

Method Types

+ createBegin:
- printPriceGraph
- printVolumeGraph
- printDeviationGraph
- printRelWealthHisto
- createEnd
- _writeRawData_
- buildObjects
- priceGraphDeath_:
- volumeGraphDeath_:
- updateHistos
- writeSimulationParams
- ifParamWrite
- expostParamWrite
- toggleDataWrite
- buildActions
- activateIn:
- drop

Class Methods


+ createBegin:aZone

No method description.

Instance Methods


- _writeRawData_

If data logging is turned on, this cause data to be written whenever it is called


- activateIn:swarmContext

This method activates the model swarm within the context of this observer, and then it activated the observer's schedules. This makes sure that the actions inserted at time t inside the model are placed into the overall time sequence before the observer scheduled actions that update graphs which describe the results


- buildActions

Create actions and schedules onto which the actions are put. Since this is an observer, the actions are intended to make sure data is collected, displayed to the screen, and written to files where appropriate


- buildObjects

This creates the model swarm, and then creates a number of monitoring objects, such a graphs which show the price trends, volume of stock trade, and some excellent bar charts which show the holdings and wealth of the agents. These bar charts (histograms) are available in very few other Swarm programs and if you want to know how it can be done, feel free to take a look!


- createEnd

No method description.


- (void)drop

In order to make sure that the data is actually written to disk, it is necessary to pass a "drop" message down the hierarchy so that all data writers know it is time to finish up their work. This drop method is called at the end of the main.m file and it propogates down to all objects created in asmModelSwarm


- expostParamWrite

If the writeParams variable is set to YES, then this method cause the system to save a snapshot of the parameters after the system's run ends.


- (BOOL)ifParamWrite

Returns the condition of the writeParams variable, an indicator that parameters should be written to files


- priceGraphDeath_:caller

This method is needed to stop run-time hangs when users close graph windows by clicking on their system's window close button


- printDeviationGraph

This is a legacy method. We need to update Swarm if it is ever to work again


- printPriceGraph

This is a legacy method. We need to update Swarm if it is ever to work again


- printRelWealthHisto

This is a legacy method. We need to update Swarm if it is ever to work again


- printVolumeGraph

This is a legacy method. We need to update Swarm if it is ever to work again


- (BOOL)toggleDataWrite

This toggles data writing features. It can be accessed by punching a button in a probe display that is shown on the screen when the simulation begins


- updateHistos

This method gathers data about the agents, puts it into arrays, and then passes those arrays to the histogram objects. As soon as we tell the histograms to draw themselves, we will see the result


- volumeGraphDeath_:caller

This method is needed to stop run-time hangs when users close graph windows by clicking on their system's window close button


- writeSimulationParams

This causes the system to save a copy of the current parameter settings. It can be turned on by hitting a button in the probe display that shows at the outset of the model run, or any time thereafter.

Version 1.1 Copyright ©2001. All Rights Reserved.