swarm-support
[Top][All Lists]
Advanced

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

Replicator script (was Re: run with random seed?


From: pauljohn
Subject: Replicator script (was Re: run with random seed?
Date: Sun, 17 Jun 2001 10:35:06 -0500

"Marcus G. Daniels" wrote:
> 
> KG> -s, --varyseed      Run with a random seed
> 
> KG> May I take this to mean that the time is used as the random seed?
> 
> The `seconds since 1970' * the current process id is used as the random seed.

Speaking of -s, I've recently started to wish there were two more
default command line flags in Swarm programs to ease the replication of
simulations.  I would like a standard -S to specify a seed value and -R
to indicate run number.  Here's why.

I've written a perl program that can repeat a simulation N times while
sweeping through a set of parameters.  

http://lark.cc.ukans.edu/~pauljohn/Swarm/MySwarmCode/replicator.pl

In the top of the script, it explains all about it.  The script assumes
the user's program can take a specific value for a random seed with the
-S (or --seed=) flag and the run number -R (or --run=).  Other flags are
program dependent.

Now, if a user has a program "myThing" and wants to sweep over
parameters, then this script makes it as easy as

perl replicator.pl --program=myThing --NRUNS=10 --sweep myParam=1,2,3
--sweep my2ndParam=0.1,0.3,0.4  --sweep my3rdParam=1000 

You can put as many parameters with "sweeps" as you want. You can also
directly edit a config section of replicator.pl instead of giving the
command line stuff.  This script presupposes the program can accept
--seed and --run as arguments, because it creates 10 runs of the model
for each "mix and match" combination of parameters.

My opinion is that we should consider putting some script like that into
the Swarm distribution itself, to ease the process of repeating a
simulation many times with various seeds.  

As I say in the script's top part, I think drone is great and I use it
all the time, but installation and configuration have been a major
challenge for my associates and this script gets all the work done we
need.

I'm accepting patches/bug reports/tips.  As far as I know, I've followed
all the good Perl housekeeping policies, with -w and the "use strict"
pragma.  

After posting that script I just thought of the unlikely possibility
that the perl rand function might draw the same number twice if a
simulation is run 1000 times. Is that possible?  I can easily code
around this problem, I think.

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