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: Tue, 30 Aug 2005 09:15:36 -0400

Well this is very timely as I am having a problem with -putObject. That's it - I think it's time to make the switch to Paul's MultiGrid2d. As Paul has said it is MUCH better documented and de-kinked. ----- Original Message ----- From: "Ken Cline" <address@hidden>
To: "Swarm Support" <address@hidden>
Sent: Monday, August 29, 2005 10:58 PM
Subject: Re: [Swarm-Support] Multiple Agents in One Cell


I would be careful with that code.  The implementation of 'putObject'
and 'putValue' in MultiDiscrete2d class is flawed.  It assumes that
the only way a List object could be found at (x,y) is if it was
created by an earlier calls to those 'put' methods.  This is an
invalid assumption.  The user could have passed in a List as an
argument.

(In fact, when you first posted your problem I thought that maybe
you were using that code already.  But then I noticed that you said
you were using Paul Johnson implementation.)

Ken

--- Crile Doscher <address@hidden> wrote:

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?"


_________________________________________________________
Ken Cline                             W: (443) 287-2636
address@hidden
_______________________________________________
Support mailing list
address@hidden
http://www.swarm.org/mailman/listinfo/support



reply via email to

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