swarm-support
[Top][All Lists]
Advanced

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

Re: Event and Process [Was: Re: more help please]


From: Chimera
Subject: Re: Event and Process [Was: Re: more help please]
Date: Thu, 16 Jul 1998 22:42:50 -0700


Sven N. Thommesen wrote:

> I'll take a stab, too, from a different angle than Alex and Jan:
>
>
> You question about interrupting executing methods leads me to remark as
> follows: there's a difference between simulators or simulation languages
> that implement a pure event model (such as Swarm) and those that implement
> a mixed event/process model (such as ModSim-III from CACI, see
> <http://www.caciasl.com>). In Modsim, in addition to the usual methods
> which execute till completion before returning some value, there called
> 'ASK' methods, there are methods called 'TELL' methods which do not return
> any values, and which return control to the caller immediately. Then the
> called method executes (in principle, at least) in parallell, in the
> background.
>
> So, for example, an airplane object may be sent the message
> TELL myAirPlane TO FlyTo: NewYork.
> The object then calculates how long that will take, and it executes a
> 'WAIT' for the required amount of simulation time. During the wait, the
> state of the object is that it is executing the FlyTo: method. It can be
> interrupted during flight; TELL methods usually are written with a code
> section that deals with interruptions.
>
> ModSim is its own language, which is pre-processed down to C++ during
> compilation. So there are 'magic' calls to the scheduler etc. done behind
> the scenes.
>
> In Swarm, to achieve similar results, a FlyTo: method would have to
> calculate for how long to fly, then ask the scheduler to have an EndFlyTo:
> message sent to itself at the appropriate time, then return to the caller.
> In the mean time (until called with EndFlyTo:), it would just need to keep
> an internal record that its current status is 'flying somewhere'.
>
> (Hope this was relevant and/or interesting ...)
>
>

 This technique is called an asynchronous event driven simulation.  It goes on
the principle that, for most agents, there are relativly few actual events that
change their state.  In between, they do nothing.  So you calculate the time(s)
to the next event, which are in the future, and then let the agent just wait for
the state change to occur.

Of course, there is always the chance for for an unforseen event, like a severe
down draft.  Then a message is sent to the agent to process that event.

I use this technique in my predatior/prey simulations.  In this case for
instance, a juvenile red scale (a citrus pest) has a time until it molts to an
adult, which is placed "in the future" in the event schedule.  When that time is
reached, it gets a message to change to an adult.  It also has a handler routine
that a predator sends to it in the event that it becomes dinner prior to
molting.  Although this method can become very processor intensive, it has a 
real
advantage over synchrous (time step->time step) simulations because it removes
the difficulty of randomiziong the events within each time step.  In a
synchronous simulation, the order of events can be quite important.  For
instance, the dynamics of a predator/prey system change drastically if all
predation events are executed before birth events, or vice versa.

For what it's worth...

D3

--
*********************************************************************
* Doug Donalson                 Office: (805) 893-2962
* Ecology, Evolution,           Home:   (805) 961-4447
* and Marine Biology            email address@hidden
* UC Santa Barbara
* Santa Barbara Ca. 93106
*********************************************************************
*
*   The most exciting phrase to hear in science, the one that
*   heralds new discoveries, is not "EUREKA" (I have found it) but
*   "That's funny ...?"
*
*       Isaac Asimov
*
*********************************************************************



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