swarm-support
[Top][All Lists]
Advanced

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

Re: Real Space


From: Paul E Johnson
Subject: Re: Real Space
Date: Wed, 11 Apr 2001 13:10:46 -0500

"Marcus G. Daniels" wrote:
> One way to avoid having agents reason in absolute space is to have all
> agents inherit from an abstract base class that does these collection
> procedures in one place, e.g. a getNeighbor (radius), method.  That
> way you can hide the coordinate system of the space from the derived
> classes.

"Darren Schreiber" wrote:
"While I illustrate that with the canvas and graph, the search of the
space is 
done by parsing through the lists of agents and is independent of the 
display issues."

Suppose I wanted to create a Grid2dContinous class, with basically the
same interface as Grid2d, except inside there I want to use a "better
faster" collection object into which the objects are placed.  I want to
more quickly find all agents within r units of (x,y). 
getNeighbor(radius) is terribly slow if it has to cycle through a whole
list of agents (as Darren can probably testify).  
At least, we want to take some subset of the agents before checking if
they are within r units.

What do you think would be a good kind of collection to use in a
Grid2dContinous?  Maybe a hash table that depended on (x,y) coordinates.
I'm looking at Sedgewick's Algorthims in C, 3rd edition, p. 580, where
he discusses the usage of floating point key values in hashes.  Clearly,
you just have to round a floating point key  over to a nonnegative
integer, but the objects could be stored, and then when we need objects
within a cetain area, maybe we could calculate the hash keys and grab
agents that way.

I'm willing to look into this, if one or more of you will give me some
pointers.  I've used the pre-manufactured Java Hash classes, but have
not written one of my own. 

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