Print

Print


Hello,

I'm doing a GP problem that includes database queries as part of the
evaluation.  Because the number of database queries can vary greatly
depending on the composition of the individuals in the population, the time
for each generation also varies significantly.  100 generations might take
10 minutes or it might take 5 hours.   I decided I wanted to be able to set
an optional time limit that would terminate evolution if it exceeded the
given time.

My initial approach was to extend SimpleEvolutionState and add a new
parameter during setup() and override evolve() to check if the duration was
exceeded.  This worked fine, other than going through an extra breeding
before it terminated.

I decided that a time limit might be useful to other people, so I went
ahead and modified some of the core ECJ classes - EvolutionState,
SimpleEvolutionState, and SteadyStateEvolutionState - to support it.

I added new parameter called time-limit, which is a integer value in
minutes  It is optional.  The existing generations and evaluations
parameters are checked before the time limit, so if the generation limit is
reached before the time-limit, then the run will end.  If time-limit is
set, then generations and evaluations are optional - one of the three must
be set.

A patch for this change is attached.  It was created by running 'svn diff'
from the ec directory of the current revision of the source tree.

I have tested the parameter handling in EvolutionState and the run
termination in SimpleEvolutionState, but have not tested
SteadyStateEvolutionState.

Sean - if you feel this feature would useful going forward, feel free to
incorporate into the main source tree.

Doug