There are a couple of options you can do:
1. Use a scripting language to launch ECJ with different parameters
(it accepts "-p param=value" on the command line, and that overrides
any parameters defined in the parameter files). You might try Python.
2. Run ECJ using its rudimentary jobs facility:
java ec.Evolve -file my.params -p jobs=20000
[eesh, that's a big number: 400x500]
The idea of the second option is this. By default your
EvolutionState object contains an instance variable called 'job'.
This is an auxiliary variable which can be anything, but in the
default form, jobs contains an Integer which stores the current
job number. Thus you could do something like this: before your
EvolutionState.setup() method is called, you look up jobs and
based on the value stored in there you set various parameters in the
ParameterDatabase as you like (just use state.parameters.set
(_parameter_, _value_). These programmatically set parameters
override any parameters loaded from files or specified on the command
line. Then when EvolutionState.setup() gets called, it'll set up
based on those parameters. Thus each new job you can have your
evolution use different "parameters" on a per-job basis. Each of
those jobs will have a different random seed too (they'll each differ
by 1 -- of you can reseed the generator as you like prior to setup()).
So how do you tap into something before setup()? A couple of ways:
A. Make a subclass of EvolutionState and override the setup() method
to do your stuff and THEN call super.setup()
B. Make a subclass of EvolutionState and override the startFresh()
method to do your stuff and THEN call super.startFresh() (setup() is
called from startFresh)
C. [probably best] Modify the Evolve class's main() method. Note
that there's a spot in the main() method, inside the jobs loop, where
you can modify parameters in your EvolutionState based on the job
number. This spot is marked prior to state.run(), which in turn
calls state.startFresh(), so you know you're modifying stuff before
anything shows up.
3. Build your own looper inside your own Evolve.main() code. This
isn't nearly as hard as it sounds; in fact it may be the easiest of
your three options. In the Evolve class, I have (in comments)
examples of how you make a very simple main() function rather than
the elaborate ones used in Evolve proper. You can just rewrite main
() to repeatedly create EvolutionStates and run them. What you could
do is make a loop which creates EvolutionStates, initializes them
(with a new random number seed offset each time -- perhaps your job
number -- to make sure each time they have different random number
generators), CHANGES THE PARAMETERS right then and there in the
parameter database, and THEN runs them.
I'd do #1 if possible, then #2C if you're sick of fiddling with
On Apr 1, 2008, at 2:52 PM, Johanna Rosenbusch wrote:
> Dear all,
> I finished my coevolutionary algorithm and now I need to run many
> each with different parameter combinations. It's probably going to
> be around
> 500 different combinations, each one running for maybe 400 jobs.
> I was thinking about using some kind of script language for
> windows. Since I
> don't have any experience with scripting I wanted to ask if anyone
> has done
> something similar?
> Thanks and best regards,