swarm-support
[Top][All Lists]
Advanced

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

Re: [Swarm-Support] Interrupting a Schedule in Swarm


From: Alex Lancaster
Subject: Re: [Swarm-Support] Interrupting a Schedule in Swarm
Date: 30 Sep 2004 02:54:29 -0700

>>>>> "MC" == Mervin Chan  writes:

[...]

MC> My problem/Question is this:
 
MC>  Is there a way to "interrupt" the action that I have inserted in
MC> the schedule. For instance, I have a FACTORY that does a "produce"
MC> action every 4 timesteps.  I want to create an "emergency" action
MC> that will interrupt the factory's schedule (at random), to make
MC> the factory service "interrupt" before continuing its normal
MC> schedule, like so:
 
MC> Time 1: Factory Produce (Every 4 time steps) Time 2: Factory Do
MC> nothing Time 3: Factory Do nothing Time 4: Factory Do nothing
 
MC> Time 5: Factory Produce Time 4: <-------- Emergency. Factory
MC> services interrupt (takes 2 timestamps) Time 5: Servicing
MC> interrupt Time 6: Factory Do nothing (Back to normal Schedule)
MC> Time 7: Factory Produce
 
MC> I understand that actions have to be predefined in the schedule,
MC> and it cannot be dynamically changed /interrupted when the
MC> simulation starts?  Is it true?  Thanks!
 
It is not true.  In fact, Swarm is explicitly designed for dynamic
scheduling.  Have a look at the "mousetrap" model for an example.  

What you are asking for is a bit trickier than the mousetrap model,
but can be done.  One possible way (others will have other
suggestions, I'm sure) is to create another schedule which triggers an
event at some random time in the future and activate both schedules
simultaneously.  This event could set a flag state in the factory
object so that when the regular event arrives it will "omit" whatever
action would normally take place.  The mousetrap model (which is a
model of a fission process like nuclear fission) should give you an
idea to start going about doing this, since it involves balls
"triggering" events randomly in the future.

Alex
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]