* @return the optimized params.
*/
@Override
public ParameterArray doOptimization( ParameterArray params, double fitnessRange ) {
ParameterArray currentParams = params.copy();
double jumpSize = INITIAL_JUMP_SIZE;
if (!optimizee_.evaluateByComparison()) {
// get the initial baseline fitness value.
currentParams.setFitness(optimizee_.evaluateFitness(currentParams));
}
int numIterations = 0;
log(0, currentParams.getFitness(), 0.0, 0.0, currentParams, "initial test");
notifyOfChange(currentParams);
double fitnessEps = fitnessRange * FITNESS_EPS_PERCENT / 100.0;
// Use cache to avoid repeats. This can be a real issue if we have a discrete problem space.
Set<ParameterArray> cache = new HashSet<ParameterArray>();
cache.add(currentParams);
Improvement improvement = null;
boolean improved = true;
// iterate until there is no significant improvement between iterations,
// of the jumpSize is too small (below some threshold).
do {
//System.out.println( "iter=" + numIterations + " FITNESS = " + currentParams.getFitness() + " ------------");
improvement = currentParams.findIncrementalImprovement(optimizee_, jumpSize, improvement, cache);
numIterations++;
currentParams = improvement.getParams();
jumpSize = improvement.getNewJumpSize();
notifyOfChange(currentParams);