From: Paul Box <address@hidden>
Date: April 17, 2004 5:33:46 PM MDT
To: address@hidden
Subject: Re: [Swarm-Support] Walk to a spot on a 2d grid? 'Sense' the
presence of another agent in the vicinity?
Hi Jurgen
I have placed an example of a simulation where agents do something
similar. It's placed at http://geohive.nr.usu.edu/~sanduku/swarm/
(get the example with shrimps). The things you ask about are
implemented through a cellSurface, with a number of Cell objects at
each XY location, and a CARunner object, which knows how to navigate
the cellSurface (CARunner, since the cellSurface is designed to
implement CA-type rules). Any agent that walks around on the
cellSurface is extended from a CARunner.
Everything I did is simply extended from the hello-world application
that comes with the swarmapps. See below for more specific comments.
On Apr 17, 2004, at 2:55 PM, Jurgen van der Pol wrote:
Ok, I'm going to ask a lot of dumb questions now and then for a
while, probably asking for beaten tracks, sorry.
Context for those interested: I'm putting swarm to use in the supply
chain management/logistics domain. Making a model (using
simpleObserverbug2 as a starter template) in which I want a number
of agents to live: trucks, cargo, depots. Trucks to go to a depot to
pick up cargo and deliver it at a given destination.
How do I
- tell an agent to 'walk' to a certain spot on a 2d grid? Is there a
method available? If not, any coding suggestions (quickest path from
A to B)? Like [truck walkToX: xDestination Y: yDestination]?
This is easy if you have a pre-determined "path" (ordered collection
of cells, or something else) that defines THE WAY to get from wherever
it's at to xDestination yDestination. If you're talking about
methods to navigate a surface and find the best way to a location,
you're asking a much bigger question than I'm willing to address at
this minute. I'm not completely happy with any of the solutions I've
come up with yet.
- have an agent 'sense' the presence of another agent fulfilling
certain conditions? Is there a method that looks/scans around for
something (i.e. if an empty truck happens to get near a depot, and
cargo is present there, it should 'sense' this and go pick it up)?
Like [truck getNearestAgentWith: conditionA andWith: conditionB]?
You can have an agent sense other agents by querying the cell which it
occupies. If a Cell object has a function like getCellAtNorth or
getCellInRadius, or however you wish to define the cell's
neighborhood, then the agent can 'sense' the agent in its neighborhood
with a call like:
if ( [[myCell getCellAtNorth] getAgent] != nil)
or
if ([[[myCell getCellInRadius: radius] getAgent] getOdor] == SMELLY)
Loops can query all the cells in a neighborhood, and random numbers
can select agents at random within a neighborhood. By querying all of
the agents in your neighborhood, you can find which ones satisfy the
conditions in question.
(Starlogo, which I used once in this regard, had methods for these
things)
What are the equivalent Starlogo methods?
Thanks again, more beginners Q's to follow I'm afraid...
Why be afraid??
Cheers,
Jurgen.
_______________________________________________
Support mailing list
address@hidden
http://www.swarm.org/mailman/listinfo/support
////////////////////////////////////////
// Paul Box
// Aquatic, Watershed, and Earth Resources
// Utah State University