swarm-support
[Top][All Lists]
Advanced

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

createFActionForEachHomogeneous$call question


From: William T. Stockhausen
Subject: createFActionForEachHomogeneous$call question
Date: Tue, 29 Jan 2002 10:38:35 -0500

Hi all,

Got a question as to how "createFActionForEachHomogeneous$call" works on a
list of agents. (At this point, my question is more theoretical than
code-specific, so I haven't appended my code.)

My agents are in one of 2 states (e.g., state1 or state2). In adition, I've
got 2 lists of agents in my model, list1 and list2.  Agents in state1 are
assigned to list1, those in state2 are assigned to list2.  During a
timestep, agents can change state from 1 to 2 based on a random draw; those
that do are switched from list1 to list2.  Initially all agents are in
state1 and are thus on list1. The key thing here is that agent behavior is
completely different in each state, so I would like to use different methods
to update each agent, the method depending on the agent's state.

I thought I could implement this behavior by using an ActionGroup's
"createFActionForEachHomogeneous$call" method to "assign" a different
FActionForEach for each list.  My assumption was that (and please excuse my
lame terminology here) the FActionForEach was being "sent" to the list
members at each schedule timestep, so that as agents changed states and
moved from list1 to list2 their behavior would change--the key thing
determing agent behavior being which list it was on, and what the
FActioForEach assigned to the list had been.

It appears, however, that the FActionForEach is "assigned" to each agent
only once (at the start of the simulation), so that even though agents are
moved from list1 to list2, they continue to act (in my case) as if they were
on list1. Should this be the case, or have I missed something?

Obviously, changing agent behavior (i.e., methods called) with state could
be implemented in the agent class (via a call to an agent-based method which
just calls the correct method based on the agent's state).  However, this
hardwires (to some extent) agent behavior.  In some cases, it may be more
flexible to assign behavior at the ModelSwarm level via lists of agents with
different behavior assigned to members of different lists, rather than at
the agent level.  If the list members change between time steps, is it
possible to change the FAction assigned to them?

Thanks in advance for any and all help,

Buck Stockhausen
***********************************************************************
*William T. Stockhausen                     e-mail: address@hidden     *
*Senior Marine Scientist                    voice : 804-684-7643      *
*Virginia Institute of Marine Science       fax   : 804-684-7250      *
*College of William and Mary                http://www.vims.edu/~buck *
*Greate Road                                                          *
*Gloucester Point, VA 23062-1346                                      *
***********************************************************************

-----Original Message-----
From: address@hidden
[mailto:address@hidden Behalf Of Rick Riolo
Sent: Tuesday, January 29, 2002 6:25 AM
To: address@hidden
Subject: Re: How does the agent know other's information?



if i understand your question, then
building on the codes below, one could just do this:

  id otherBug;
  ...

  if ( (otherBug = [world getObjectAtX: newX Y: newY]) != nil ) ) {
      [otherBug getHaveEaten];
      ...
  }

assuming the Bug's have a getHaveEaten method, of course.

In general, the approach is to
   = get the address of the other object, by whatever
     is the approapriate/convenient scheme
   = send it a getXXX message to access its value for XXX

  - r

--
Rick Riolo                           address@hidden
Center for Study of Complex Systems (CSCS)
4477 Randall Lab
University of Michigan         Ann Arbor MI 48109-1120
Phone: 734 763 3323                  Fax: 734 763 9267
http://www.pscs.umich.edu/PEOPLE/rlr-home.html

On Tue, 29 Jan 2002, Makoto Igarashi wrote:

> Date: Tue, 29 Jan 2002 17:42:04 +0900
> From: Makoto Igarashi <address@hidden>
> Reply-To: address@hidden
> To: address@hidden
> Subject: How does the agent know other's information?
>
> Hi all,
>
>
> In Bug.m of simpleSwarmBug3, the agent can check whether other agent is
> at (newX, newY) or not using below code,
>
> [world getObjectAtX: newX Y: newY]
>
> Using similar way, does the agent know other's information (for example,
> the value of haveEaten)? Could anyone tell me the way or show me some
> sample codes?
>
> Any help would be greatly appreciated.
>
>
> Thanks,
>
>
>
> --
>
> _ Makoto Igarashi _____________________________________________________
> _ mailto:address@hidden
> _ http://urban.tutrp.tut.ac.jp/~igarashi/
>
>                   ==================================
>    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.
>


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


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