swarm-modeling
[Top][All Lists]
Advanced

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

Do you see any problem with this Scheduling idea?


From: Paul E Johnson
Subject: Do you see any problem with this Scheduling idea?
Date: Fri, 26 Oct 2001 16:32:41 -0500

Hi everybody!

I was considering a model in which a "phony history" is created before
the model actually runs.  An example like that is found in the
Artificial Stock Market (ASM: http://ArtStkMkt.sourceforge.net) through
an apparently complicated approach.  A repeating warmup schedule is
created, then another startup schedule is created, and the startup
schedule at time 0 executes a method that causes the warmup schedule to
run in a nil environment, and after 500 steps it exits. That leaves the
rest of the model at time 0 and the regular course of history resumes.

If you look at ASM, maybe you will agree that is complicated.  I find
that almost unbelievably hard to comprehend, and after looking at it a
long time, I've found what I think is a much simpler approach and I am
trying to figure out what the downside might be.   If there is something
blatantly wrong, tell me. (I'm also interested in subtle wrongness :> )
So,is this the simplest possible way to make some action occur 500 times
before time 0?

Here is the idea.
Write a buildActions like so:

- buildActions
{
  int i;
  [super buildActions];
  id <ActionGroup> periodActions = /blah.. an action group for things
that happen every time in the model

  periodSchedule = [Schedule createBegin: [self getZone]];
  [periodSchedule setRepeatInterval: 1];
  periodSchedule = [periodSchedule createEnd];

  startupSchedule = [Schedule create: [self getZone] setAutoDrop: YES];

  //bomb the doWarmupStep 500 times at time 0 in the StartupSchedule
  for (i=0; i<501; i++)
        [startupSchedule at: 0 createActionTo: self message:
M(doWarmupStep)];

  [periodSchedule at: 0 createAction: periodActions];
}
 
-activateIn: (id)swarmContext
{
  [super activateIn: swarmContext];
  [startupSchedule activateIn: self];
  [periodSchedule activateIn: self];
  return [self getSwarmActivity];
}

I've tested this redesign on the ASM code and the simulation runs of the
two approaches appear to be identical for a long time, but slight
differences emerge, I don't know why.  visually, the conditions observed
are identical in the model for the first 100 steps, and then slight
blips start to appear.  I wondered if perhaps a slight change in the
order in which random numbers are drawn might account for this, but have
not yet isolated the cause.

One thing that does surprise me is that the precise time path followed
by a simulation is affected by whether the prehistory lasts 500, or 501
periods, say. 
-- 
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]