/// <summary> /// Will stop when the difference between the min evaluation and max evaluation is equal to or less than "diff" /// </summary> public StopAtConvergence(double diff) { if (diff < 0) { throw GeneticAlgorithmArgumentException.SmallerThanZeroException(nameof(diff), diff); } this.diff = diff; }
/// <summary> /// Will stop when we reach a max evaluation equal to or greater then "evaluationToStopAt" /// </summary> public StopAtEvaluation(double evaluationToStopAt) { if (evaluationToStopAt < 0) { throw GeneticAlgorithmArgumentException.SmallerThanZeroException(nameof(evaluationToStopAt), evaluationToStopAt); } this.evaluationToStopAt = evaluationToStopAt; }
/// <summary> /// Will renew "precentageToRenew" of the population when the difference between the min evaluation and max evaluation is equal to or less than "diff". /// </summary> public RenewAtDifferenceBetweenAverageAndMaximumFitness(double diff, double precentageToRenew) { precentageToRenew.VerifyPrecentageToRenew(); this.precentageToRenew = precentageToRenew; this.diff = diff >= 0 ? diff : throw GeneticAlgorithmArgumentException.SmallerThanZeroException(nameof(diff), diff);; }