swarm-support
[Top][All Lists]
Advanced

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

Concurrent Groups & Randomized Default Order for ActionGroups


From: Parviez HosseiniC
Subject: Concurrent Groups & Randomized Default Order for ActionGroups
Date: Mon, 11 May 1998 12:57:35 -0700 (PDT)

Hello all --

First I spotted an error on the web page on Schedules and Concurrent 
Groups it reads:

  concurrentGroupType = [ActionGroup customizeBegin: aZone];
  [concurrentGroupType setDefaultOrder: Random];
  concurrentGroupType = [concurrentGroupType customizeEnd];

it should read, as there is a specific ConcurrentGroup class:
  concurrentGroupType = [ConcurrentGroup customizeBegin: aZone];
  [concurrentGroupType setDefaultOrder: Randomized];
  concurrentGroupType = [concurrentGroupType customizeEnd];

And although setting random there doesn't work, I have implemented a basic
way to Randomize actions within an ActionGroup. It involved only editting 
ActionGroup.m and some ancillary edits of ActionGroup.h, 
CompoundAction.{m,h}, and Activity.h. 

I thought this might be useful to others, but I didn't know how best to 
spread the method, as it requires editting source code and recompiling 
swarm itself.

Mechanically it randomizes the nextAction call within the ActionGroup
setting. It doesn't randomize calls within a ForEach type call -- (that
would require making an analogous change, but I don't understand that
call's methodology as well). 

For autoDropping actionGroups it works as a without replacement 
randomization, but for non-autoDropping groups it is a with replacement 
call, meaning that several actions of one type may occur before the next 
occurance of another.

Essentially the only user difference is: 
-(void)setDefaultOrderRandomizedWithGenerator:(id)Generator;
message which sets the bit, and sets a new generator variable --
I had to add a new message, rather than use the old one to set the generator.
so the concurrentgrouping would look like:
   concurrentGroupType = [ConcurrentGroup customizeBegin: aZone];
  [concurrentGroupType setDefaultOrderRandomizedWithGenerator: ranNumGen];
  concurrentGroupType = [concurrentGroupType customizeEnd];
 ...
 [modelSchedule setConcurrentGroupType: concurrentGroupType];

Generator here is a random number generator, although it could be 
anything that responds to -getDoubleSample. (I think).

Would this be useful for others, and how do I make it available?
I've tested it as a Concurrent Group, and an ActionGroup, 
both autoDropping and non-autoDropping, but it is a hack, so I can't make 
any promises!

-Parviez Hosseini
address@hidden
Dept. of Ecology, Evolution and Marine Biology
University of California
Santa Barbara, CA 93106

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