Subject: | |
From: | |
Reply To: | |
Date: | Tue, 26 Jul 2005 19:17:44 -0400 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
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)
{
super.evaluatePopulation(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
parameters:
quit-on-run-complete = true
# you need to use the full classname here, like ec.foo.MyEvaluator if
necessary
eval = MyEvaluator
Sean
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
|
|
|