swarm-support
[Top][All Lists]
Advanced

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

Re: Initializing Averager in Java?


From: Paul E Johnson
Subject: Re: Initializing Averager in Java?
Date: Fri, 27 Jul 2001 15:32:42 -0500

"Marcus G. Daniels" wrote:
> 
> >>>>> "TW" == Tom Wainwright <address@hidden> writes:
> 
> TW> I can't figure out how to set the collection for an Averager in Java.
> 
> Usually an Averager is created via an EZGraph, but it can be used
> directly, as well.  An Averager is just a special kind of MessageProbe.
> 
> The main thing is it requires the more-complicated phase switching idioms.
I'd like to add that there are changes in the source for Averager.m
which give it much more functionality, and if you build from source, you
can use them. I am not sure windows users who just update dlls can use
these things because there were additions in the Averager.h that make it
work.  Averager objects can be created for other purposes, not just
graph creations.  They can be created and used by the agents in a model.
The averager can be used by agents to keep records on their experiences.
I submitted a patch for this some time back, and Marcus worked it over
to integrate well with the existing library.  Averager objects don't
have to be created with a collection to average, instead, one can have
agents create an averager object and then add values to it when they
find them, and they can retrieve the numbers when they need to.  IT can
do moving averages as well as total averages, and it can give you back
the average, standard deviation, and variance.  If you look in
Averager.m, you can see the design.  Instead of the creating command
"setCollection" it is necessary to "setWidth", the width of the moving
average. If you don't set the width, there will be a runtime crash
saying the averager needs either a collection or a width.  So after
setting the width, the averager object has methods to
- (void)addValueToAverage: (double)v
- (double)getAverage
- (double)getMovingAverage
- (double)getVariance
- (double)getMovingVariance
- (double)getStdDev
- (double)getMovingStdDev

I thought the moving average part was especially handy!
 
-- 
Paul E. Johnson                       email: address@hidden
Dept. of Political Science            http://lark.cc.ukans.edu/~pauljohn
University of Kansas                  Office: (785) 864-9086
Lawrence, Kansas 66045                FAX: (785) 864-5700

                  ==================================
   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]