swarm-support
[Top][All Lists]
Advanced

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

Re: EZBin


From: Sven N. Thommesen
Subject: Re: EZBin
Date: Fri, 18 Sep 1998 13:33:01 -0500

Zafar,

some comments on your question:

a) yes, the Y axis is the frequency (#agents in each bin)

b) the X axis is the distance limits for each bin

c) EZBin adjusts itself to whatever return value your probedSelector
supplies (int, float, double).

d) Have you put a line in your observer swarm (ExperSwarm)'s -buildActions
for displayActions to make the EZBin update itself?

e) There IS a bug in EZBin when it calculates the sizes of the bins -- as
you can see, in Graph2 the first division is 22.857 which is 160/7 (max
distance = 160, number of bins = 6). It divides by (numBins+1). I have
supplied a patch for this to Marcus, who will include it in the upcoming
1.3.1.

f) Looking at your code, I see that 'distance' for a plot agent is
calculated as the Euclidean distance sqrt(x^2 + y^2). Don't know why you
made it an integer -- I'd suggest keeping distance a double all the way
through.

Also: with an 80x80 world, upperBound should be sqrt(80^2 + 80^2) ~ 112,
rather than 80+80=160, given the way distance is calculated.

g) On the other hand, if you keep distance an integer which can take on
values from A to B inclusive, you should set:
        setLowerBound: A
        setUpperBound: (double) (B+1);
        setBinNum: (whatever you want).

Cheers,
--Sven




At 05:48 PM 9/18/1998 +0100, Zafar Iqbal wrote:
>Hi,
>
>I'm not sure if my EZBin graph is working properly. In the 
>output there are no solid bars, the numbers on the x-axis 
>get 'mixed up' if BinNum is set any higher than 6. The 
>enclosed pictures are snapshots of the EZBin graph, with 
>BinNum set to 6 & 8 respectively.
>
>My code is as follows. From my understanding the Y axis is 
>the frequency...
>Also the getDistance function returns an integer.
>
>
>  // Build the graph widget to display distance to plots
>  distGraph = [EZBin createBegin: globalZone];
>  SET_WINDOW_GEOMETRY_RECORD_NAME (distGraph);
>  [distGraph setGraphics: 1];
>  [distGraph setFileOutput: 0];
>  [distGraph setTitle: "Distance to plots"];
>  [distGraph setAxisLabelsX: "Distance" Y: "Number"]; 
>  [distGraph setBinNum: 6];
>  [distGraph setLowerBound: 0.0];
>  [distGraph setUpperBound: (double)([[modelSwarm getWorld] getSizeY] +
>                                       [[modelSwarm getWorld] getSizeX])];
>  [distGraph setCollection: [modelSwarm getAgentList]];
>  [distGraph setProbedSelector: M(getDistance)];
>  distGraph = [distGraph createEnd];
>  
>
>  [displayActions createActionTo: distGraph           message: M(reset)];
>  [displayActions createActionTo: distGraph           message: M(update)];
>  [displayActions createActionTo: distGraph           message: M(output)];
>
>----------------------
>Zafar Iqbal


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