swarm-support
[Top][All Lists]
Advanced

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

Scheduling One Time Events


From: Darren Schreiber
Subject: Scheduling One Time Events
Date: Thu, 18 Nov 1999 12:48:28 -0800

One part of Swarm that I've never felt 100% comfortable with is scheduling.
Now I'm trying to get a handle on it.  I want to draw the raster right
after the build objects phase is completed.  Then I want to have the raster
update at the end of every step in the modelSwarm.

As the code is now,   

In ObserverSwarm:
-buildActions {
  [super buildActions];

  // Tell the model Swarm to build it's schedules
  [modelSwarm buildActions];

  // Then create a group of actions for the observer
  displayActions = [ActionGroup create: [self getZone]];

  [displayActions createActionTo: probeDisplayManager message: M(update)];
  [displayActions createActionTo: actionCache         message: M(doTkEvents)];
  [displayActions createActionTo: self                message:
M(eraseRaster)];
  [displayActions createActionTo: worldDisplay        message: M(display)];
  [displayActions createActionTo: worldRaster         message: M(drawSelf)];
  [displayActions createActionTo: moveGraph     message:M(step)];
  [displayActions createActionTo: dissGraph     message:M(step)];

  // Put these actions on a schedule to be repeated at a certain frequency
  displaySchedule = [Schedule createBegin: [self getZone]];
  [displaySchedule setRepeatInterval: displayFrequency]; 
  displaySchedule = [displaySchedule createEnd];
  [displaySchedule at: 0 createAction: displayActions];

  return self;
}

In ModelSwarm.m :
-buildActions {
  [super buildActions];
      
  modelSchedule = [Schedule createBegin: [self getZone]];
  [modelSchedule setRepeatInterval: 1];
  modelSchedule = [modelSchedule createEnd];

  [modelSchedule at: 0 createActionForEach: agentList message: M(step)];

  return self;
}

It seems to me that the current program does the following:

buildObjects
        create the Zones
        wait for the control panel      
        buildObjects in modelSwarm
        do the actual building in ObserverSwarm

*
ObserverSwarm-displayActions
ModelSwarm-modelSchedule
        agentList: M(step)
* repeat

This make sense since the initial display should be set before everything
runs, but the consequence seems to be that the raster shows only the result
of the previous turn and when I am clicking on squares, I am getting
non-sensical results ("emptysquares" report an agent and "agents" just beep
indicating they are really empty squares.)

If this problem is in the scheduling the new schedule should look like this: 

buildObjects
        create the Zones
        wait for the control panel      
        buildObjects in modelSwarm
        do the actual building in ObserverSwarm

ObserverSwarm-displayActions - One time to start

*
ModelSwarm-modelSchedule
        agentList: M(step)
ObserverSwarm-displayActions 
* repeat


How do I make this schedule change so that the display actions are done at
time zero and then only repeated at the end of every cycle?

Also, what other bugs might be causing the erroneous reports from the raster?

        Darren


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