swarm-support
[Top][All Lists]
Advanced

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

OO consideration


From: Benoit Desrosiers
Subject: OO consideration
Date: Thu, 22 May 1997 23:04:50 -0400

Hi, I have a philosophical question about Mousetrap.

In Mousetrap, if you follow the logic, the model start the simulation 
by throwing a ball on a trap then this trap sends its 2 balls to two
other traps and on and on...

My question is: How does a trap knows about the other traps?

I explain: from an OO point of view, the trap knows only that it is
in a given system, so all it should do is to send the balls to this
system and this one would do what it wants with the balls. Suppose
that we would like to simulate the effect of putting something that
slows down the reaction (an iron (or carbon) pipe for real reactor)
then the effect would be to catch some of the ping pong ball that 
went on. But with this simulation, we cannot do that.

I know, this is just a toy application, but the reason why I got to 
this reflection is because in my simulation, my model have to start
2 different randomly selected agents on the grid at every simulation.
If I take the mousetrap simulation, then the trap (or for my simulation
the agent) have to select another trap every time it is called. I 
don't like this approach because of the above reason (the iron pipe). 

What would be the best way to do my application? Here is some solutions
that I thought of:

1) the model have a schedule with a setRepeatInterval:1. On this 
schedule I put an action at 0 [createActionTo:self message: M(step)]. 
And in model>>step I call the 2 agent directly [anAgent attack]. 

2) the model have a schedule with no repeatInterval. Here again, I put
a step event at 0. In model>>step, I put an event for agent>>attack at
getCurrentTime().  This time, since there is no repeatInterval, I put
another model>>step event at getCurrentTime() +1 at the end of step. 

3) I use the same technique used in mousetrap: the agent put an event
for another agent.


Here are the pros and cons of every solution:

1) con: by calling the agent directly in model>>step, I broke the event
paradigm used in swarm
   pro: it work, and it is flexible (iron pipe)

2) con: I have to put back manually a call to step
   pro: it work, and it is flexible too

3) con: not flexible, the agent knows too much about it environment
   pro: it work



Any suggestions?

thanks
Benoit

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