It's quite straightforward.  Most Evaluators, such as SimpleEvaluator,
implement their runComplete(...) method by returning true if any
individual is ideal, else false.  So just subclass the Evaluator you're
using (likely SimpleEvaluator) and override the runComplete function to
use your preferred metric:

public class MyEvaluator extends SimpleEvaluator // or whatever one
        public void evaluatePopulation(EvolutionState state)
                // here would be a good place to gather statistics
                // to use in runComplete below...

        public boolean runComplete(EvolutionState state)
                // called AFTER evaluatePopulation.
                return .... ;  // use your statistics

This will get called once per generation.  Then you just use the

quit-on-run-complete =          true
# you need to use the full classname here, like if
eval =                                  MyEvaluator


On Jul 26, 2005, at 3:15 PM, Sandeep Mulgund wrote:

> Is there any way to encode in ECJ some stopping criteria other than the
> maximum number of generations?  For example, what if I wanted to give
> up if
> I don't get more than x% improvement in the best solution over y
> generations?
> Sandeep