swarm-support
[Top][All Lists]
Advanced

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

Re: [Swarm-Support] Multiple Agents in One Cell


From: Crile Doscher
Subject: Re: [Swarm-Support] Multiple Agents in One Cell
Date: Mon, 29 Aug 2005 22:00:46 -0400

Thanks for that Sven. I came across a folder on the Swarm ftp site a few months back called multi2d.tar.gz and promptly forgot about it. This contains MultiDiscrete2d.hm and MultiObject2dDisplay.hm. I'm not sure who wrote these but the comments indicate that it they were written to allow multiple agents in one cell with Discrete2d so I'm testing them out with my current model. I'll also have a look at your code - the more the merrier (right?). I found multi2d.tar.gz in:

ftp://www.swarm.org/pub/swarm/apps/objc/contrib/

for anyone else interested.
C
----- Original Message ----- From: "Sven N. Thommesen" <address@hidden>
To: "Swarm Support" <address@hidden>
Sent: Sunday, August 28, 2005 3:32 PM
Subject: Re: [Swarm-Support] Multiple Agents in One Cell



Crile,

I remember having similar problems myself a while back (in 1997!) and
I created some extensions to Grid2d for the purpose. These may be of
use to you. They are found in the 'contrib' directory for Swarm
contributions, but the file is so small I just appended it here. Hope
you find it useful. (You should be able to extend the procedures that
calculate neighborhoods to figure your slopes ...) Of course, the
code may need to be tweaked a little to work with the latest release of Swarm.

Cheers,
Sven Thommesen

At 11:23 AM 8/24/2005, you wrote:
Hi there SwarmList,
  I'm trying to work out multiple agents in a cell using lists, as
suggested by some previous posts (if that doesn't work, I'll try
using MultiGrid2D).  The primary agents are volumes of water
flowing over a riverbed (the cell surface, a Discrete2d which
contains the cells), so I need each cell to hold an elevation value
as well as a list of agents.  I have borrowed some methods from
MultiGrid2d (my thanks to Paul Johnson and Opinion2.0).  The
elevation values come from an ascii file originating as a GIS
raster grid and are read into each cell after the agent list has
been created  but before any agents are added (the collection is
created when the cell is created, well, during -createEnd a la
Opinion, to be exact).  During runtime, a method gets called from
the agent to the cell surface that determines which cell is the
best to move to by calculating local slopes from that particular
cell.  The problem is that where before I could easily read in the
elevations, calculate the slopes and move the agents around (until
two ended up in one cell, of course), I now get NaN returned when
the cell surface queries a cells for its elevation values (and a
subsequent crash).  A -getCellAtX: Y: method is used to access the
cell's elevation value - this worked fine prior to implementing the
list.  It seems like creating the list has either made the
elevation value inaccessible, or perhaps the list has overwritten them.
  So, have I been sloppy in creating my lists?  My gut feeling is
that my cells should be able to hold both elevations and lists and
I simply haven't implemented this well.  Could the order in which
the list is added and elevation values read in be causing a
problem?  Any thoughts?
Thanks -
Crile

Dr Crile Doscher
Natural Resources Engineering
Lincoln University
Canterbury
New Zealand

"What if the hokey pokey is what it's all about?"
_______________________________________________
Support mailing list
address@hidden
http://www.swarm.org/mailman/listinfo/support



--------------------------------------------------------------------------------


_______________________________________________
Support mailing list
address@hidden
http://www.swarm.org/mailman/listinfo/support




reply via email to

[Prev in Thread] Current Thread [Next in Thread]