swarm-modeling
[Top][All Lists]
Advanced

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

ASM discussion topic: "tiny pools that time forgot"


From: Paul E. Johnson
Subject: ASM discussion topic: "tiny pools that time forgot"
Date: Mon, 03 Apr 2000 23:29:09 -0500

I'm intrigued by something I found while reading ASM.  And I wondered if
some of you could tell me what you think of it.

At issue is a schedule thingie. I have not seen anything like it. If I
understand it correctly, it can create tiny "pools" in which lots of
time steps can be carried out without affecting time in the larger
model.  In the MktModelSwarm.m's buildActions, there's an ActionGroup
"warmupActions" 
  warmupActions = [ActionGroup create: [self getZone]];
  [warmupActions createActionTo:     self
                 message: M(warmupStepDividend)];

//more actions are inserted into warmupActions, and then there is a
schedule:

  warmupSchedule = [Schedule createBegin: [self getZone]];
  [warmupSchedule setRepeatInterval: 1];
  warmupSchedule = [warmupSchedule createEnd];
  [warmupSchedule at: 0 createAction: warmupActions];

//so far, so good.  But then the plot thickens
//The warmupSchedule gets passed to a function by this "startupSchedule"
  startupSchedule = [Schedule create: [self getZone]];
  [startupSchedule at: 0 createActionCall:
                     (func_t)warmUp: warmupSchedule];

//The warmUp schedule is not in the main activateIn: method of that
file.
//The startupSchedule is activated in the activateIn: method, like
usual.
//But then look at this warmUp function.  

void warmUp (id warmupSchedule)
{
  id warmupSwarm;
  id warmupActivity;
  id terminateSchedule;
  warmupSwarm = [Swarm create: globalZone];
  [warmupSwarm activateIn: nil];
  warmupActivity = [warmupSchedule activateIn: warmupSwarm];
  terminateSchedule = [Schedule create: globalZone];
  [terminateSchedule activateIn: warmupSwarm];
  [terminateSchedule at: 501 createActionTo: warmupActivity
                     message: M(terminate)];
  while ([[warmupSwarm getSwarmActivity] run] != Completed);
}

The startupSchedule repeats every time period (right, if no
setRepeatInterval is set, it is assumed 1?). So the warmUp function is
called.  Now it spawns a subprocess that runs for 501 periods, but these
501 periods are in a "land time forgot", in the sense that the
subprocess goes 501 steps in its own time while the rest of the larger
swarm model is not going at all.   

I keep thinking there must be some more transparent way to schedule
this.  But this definitely is something worth looking at. I think there
have been some questions in swarm-support over the year from people who
wanted this kind of effect--a subprocess that goes without affecting
global time.  But I don't know if there are any dangers to it.

And what good does the while statetement do at the end of it?

-- 
Paul E. Johnson                         email: address@hidden
Dept. of Political Science              http://lark.cc.ukans.edu/~pauljohn
University of Kansas                    Office: (785) 864-9086
Lawrence, Kansas 66045                  FAX: (785) 864-5700


                  ==================================
   Swarm-Modelling is for discussion of Simulation and Modelling techniques
   esp. using 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]