Name

DataFile - collects data from a collection of agents and prints to ASCII file


Synopsis

CREATING
-(void)	       addFullDataSet: (char *) t withFeedFrom: d andSelector: (SEL) s;

-(void)        addSimpleDataSet: (char *) t withFeedFrom: d andSelector: (SEL) s;

-(void)        addSimpleDataSet: (char *) t withFeedFrom: d andSelectorA: (SEL) sA andSelectorB: (SEL) sB;

-(void)        addCountSequence: (char *) t withFeedFrom: d andSelector: (SEL) s;

-(void)        addAverageSequence: (char *) t withFeedFrom: d andSelector: (SEL) s;

-(void)        addTotalSequence: (char *) t withFeedFrom: d andSelector: (SEL) s;

-(void)        setAlwaysActive;

USING
-(void)         step;

Description

DataFile allows the user to create simple datasets, which probe a collection of agents and print the results out to an ASCII file on disk. The emphasis here is on simplicity. Although DataFile creates various objects and probes to keep track of the information, this functionality is transparent to the user. He simply specifies, by calling the appropriate method, which type of data set he would like to save; a full data set that prints out the data for each agent in addition to period statistics, such as the mean, variance, minimum and maximum or a simple dataset which only prints out the agent level data and no statistics. In addition the simple data set can probe an agent for two different bits of data for the same period, and prints them out as as (x,y) - this is designed to represent data on the spatial coordinates of an agent or object in a given period. DataFile assumes that the underlying collection is dynamic, but agents can only be added to the collection and should not vanish from it, nor should their relative position within the collection be changed. To handle the "death" or inactivity of the agents, DataFile as a default will probe an agent for the method checkDeath. If the agent returns 0 (i.e. false - or "I'm alive") the datapoint will be printed. If the checkDeath probe returns 1, or true, a period " . " will be printed instead of the datapoint. You can switch of the death probe, for example for a collection where no agents will become inactive over time. You can also substitute a different method for default method "checkDeath", if you prefer to use a different method to inquire on the health of the agent.

Create time options

-(void)	       addFullDataSet: (char *) t withFeedFrom: d andSelector: (SEL) s;
-(void)        addSimpleDataSet: (char *) t withFeedFrom: d andSelector: (SEL) s;
-(void)        addSimpleDataSet: (char *) t withFeedFrom: d andSelectorA: (SEL) sA andSelectorB: (SEL) sB;
-(void)        addCountSequence: (char *) t withFeedFrom: d andSelector: (SEL) s;
-(void)        addAverageSequence: (char *) t withFeedFrom: d andSelector: (SEL) s;
-(void)        addTotalSequence: (char *) t withFeedFrom: d andSelector: (SEL) s;
-(void)        setAlwaysActive;
-(void)	       substituteCheckDeathWith: (SEL) s;
Each of the add functions take as arguments the name of the file that should be saved on disk, the agent collection that should be called and the method selector on the respective agents that will return the data.

addFullDataSet:withFeedFrom:andSelector

will calculate the mean, variance, minimum and maximum of the data returned by all active agents (agents that do not return "1" or true when called with checkDeath).

addSimpleDataSet:withFeedFrom:andSelector

method simply gathers the data from each agent and prints to the file without any extra statistics.

addSimpleDataSet:withFeedFrom:andSelectorA:andSelectorB:

takes an extra argument, the second method that should be called to gather data of the form (x,y). The printout also assumes that the data returned in each case is an integer.

addCountSequence:withFeedFrom:andSelector

and

addAverageSequence:withFeedFrom:andSelector

or

addTotalSequence:withFeedFrom:andSelector:

all create simple data files which only represent data for the aggregate collection of active agents. The

setAlwaysActive

and

substituteCheckDeathWith:

give the user the option of turning the death probe off altogether or substituting the -checkDeath method call with a different method. The

step

method has to be called every time that the data is output. The DataFile has an internal clock which is uptated by one click every time the step function is called and this data will be output in the first column of each line.
mailto:benedikt@ucla.edu