Beispiel #1
0
 public void saveState(PopulationInterface Pop) {
   oldFit = Pop.getBestFitness().clone();
   oldNorm = PhenotypeMetric.norm(oldFit);
   popFitCalls = Pop.getFunctionCalls();
   popGens = Pop.getGeneration();
   firstTime = false;
 }
Beispiel #2
0
 /**
  * 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;
 }