public boolean optimize(final int numSteps, final double convergenceDelta) throws InvalidConfigurationException {
        if (!configured) {
            configure();
        }
        final int deltaNumSteps = numSteps/10;
        final Genotype population = Genotype.randomInitialGenotype(configuration);
        final boolean converged;
        int timesFitnessStable = 0;
        double previousFitness = -1;
        progressLogger.expectedUpdates = numSteps;
        progressLogger.start("optimization");
        IChromosome fitestChromosome = null;
        double fitness = -2;
        for (int i = 0; i < numSteps; i++) {
             //   writeCurrentPopulation(population);
            fitestChromosome = population.getFittestChromosome();

            fitness = fitnessFunction.getFitnessValue(fitestChromosome);
            fitestFunctionValue = fitness;
            if (i % moduloProgressReport == 1) {
                log.info("Current solution has a fitness value of " +
                        formatDouble(Math.log(fitestChromosome.getFitnessValue())) +
                        " absolute: " + formatDouble(Math.log(fitness)) +
                        "or raw: " + fitness);
                log.debug(fitestChromosome.getGene(0).toString());
            }
            if (fitness >= previousFitness && fitness - previousFitness < Math.abs(convergenceDelta)) {
                timesFitnessStable++;
                log.trace("fitness function value stable " + timesFitnessStable);
            } else {
                timesFitnessStable = 0;
                log.trace("fitness function not stable, old: " + previousFitness + " new fitness: " + fitness);
            }

            previousFitness = fitness;
            if (timesFitnessStable >= deltaNumSteps) {
                break;
            }
            numberOfIterationsPerformed = i;
            if (i != numSteps - 1) {
                // do not evolve if this is the last step.
                population.evolve();
                progressLogger.lightUpdate();
            }

        }
        if (fitness - previousFitness < Math.abs(convergenceDelta)) {
            converged = true;
        } else {
            converged = false;
        }
        progressLogger.stop("optimization");
        convertFittestToSolution(fitestChromosome);

        return converged;

    }