[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Synchronization problem
From: |
D. D. Donalson |
Subject: |
Re: Synchronization problem |
Date: |
Sat, 17 Mar 2001 13:30:56 -0800 |
Why don't you have a variable and a method in each agent so that once the
move starts, the moving agent gets the id 1st agent in the new cell and
sends it a message that sets a "freeze" flag. Then when the initiating
agent completes the move and associated actions it sends another message
"resetFreezeFlag". Or something like that?...
Cheers,
D4
----- Original Message -----
From: " Rob Leclerc" <address@hidden>
To: <address@hidden>
Sent: Saturday, March 17, 2001 12:52 PM
Subject: Re: Synchronization problem
> I am not having a problem with the notion of stacking agents. Its
more
> like. Given AgentA(34,53) and he is attempting to move to (35,53); that,
> what I want to happen is that if (35,53) is occupied, then I want the
agent
> to move on top of this agent, execute a method that will affect them both,
> and by doing so, suspend AgentB(35,53) from "concurently" attempting the
> same operation, given the symetry of their conditions. What seems to be
> happening is that AgentA moves to (35,53), and then AgentB(35,53), being
> that his conditions match those of AgentA, and *prior* to AgentA's move,
> also executes the same method; thus the method ends up being executed
twice.
> As I said, I attempted to have a static hashtable, so that each agent
would
> check to see if the other agent had already executed the method, or if it
> was the first one to do so, so to speak. Unfortunetly, although AgentA
> would change the value in the hashtable, AgentB would also be doing so
> "concurently" so they would both change the values in the hashtable
> simultaneously. And as I said, I even tried to keeo the method static and
> synchronized between the agents, but they would still act as if they were
> executing them concurrently.
>
> Thanks,
> Rob Leclerc
>
> ----- Original Message -----
> From: "Marcus G. Daniels" <address@hidden>
> To: <address@hidden>
> Sent: Saturday, March 17, 2001 9:53 AM
> Subject: Re: Synchronization problem
>
>
> > >>>>> "RL" == Rob Leclerc <Rob> writes:
> >
> > RL> that updating those values are suppose to occur concurrently.
> >
> > By default, updating will happen left-to-right.
> >
> > RL> I am in a situation where one agent moves on top of another agent
> > RL> -- although not on the grid, the agent on the bottom simply has a
> > RL> reference to the agent.
> >
> > So you want a notion of N items being at a certain grid site, but only
> > the one on top to run? If the notion is that the environment is
> > acting on the agents, e.g. sun shining, then you might want to have
> > the model iterate over the cells calling a method like `getTop'. You
> > could implement that with a stack on each cell (methods like push,
> > pop, getTop). Otherwise, you could have the self-scheduled agents
> > call getTop on the cell (which they would have a field for), and compare
> > it with themselves (`this'), and if there was a match, do the behavior.
> >
> > ==================================
> > 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.