public void saveState(PopulationInterface Pop) { oldFit = Pop.getBestFitness().clone(); oldNorm = PhenotypeMetric.norm(oldFit); popFitCalls = Pop.getFunctionCalls(); popGens = Pop.getGeneration(); firstTime = false; }
/** * Return true if |oldFit - curFit| < |oldFit| * thresh (relative case) and if |oldFit - curFit| < * thresh (absolute case). * * @param * @return */ protected boolean isStillConverged(PopulationInterface pop) { double[] curFit = pop.getBestFitness(); double dist = EuclideanMetric.euclideanDistance(oldFit, curFit); boolean ret; if (convergenceCondition.isSelectedString("Relative")) { ret = (dist < (oldNorm * convThresh)); } else { ret = (dist < convThresh); } return ret; }