There are 10 different convergence criteria that can be added to your optimization method.
- DeltaFConvergence: Given a value D (minimum difference), this criteria will return true, if the distance (absolute value of the difference) between fcurrent and flast is less than or equal to D.
- DeltaGradFConvergence: Given a value D (minimum difference), this criteria will return true, if the norm (1-norm sum of absolute values) of the gradient less than or equal to D.
- DeltaXConvergence: Given a value D (minimum difference), this criteria will return true, if the norm of the difference between xcurrent and xlast is less than or equal to D.
- MaxAgeConvergence: Internally keeps track of the age of the best candidate. If it exceeds the given MaxAge value, the criteria will return true. This is to say, if no better candidate is found in MaxAge iterations, return true.
- MaxIterationsConvergence: Given a value Kmax, this criteria will return true if the process reaches this many iterations.
- MaxFnEvalsConvergence: Given a value Kmax, this criteria will return true if the process reaches this many function evaluations.
- MaxTimeConvergence: Given a value for maxTime, this criteria will return true, when the process reaches this length of time. It does not use any of the convergence arguments, but it may be regarded as the most user-friendly criteria. Use
wisely. Use often.
- ToKnownBestFConvergence: Given a value for fAtOptimal and a tolerance on either side. The criteria returns true when the value of fBest is within the range of fAtOptimal +/- tolerance. One is welcome to
set the tolerance to 0. The default of infinity is fine if it is on the opposite side of the optimization direction.
- ToKnownBestXConvergence: Given a value for xAtOptimal and a minimum difference, D. The criteria returns true when the norm of the difference between xBest and xAtOptimal is less than or equal to D.
- MaxDistanceInPopulationConvergence: Given a minimum span, S, this criteria returns true when the span is equal to or less than S. This is probably the slowest criteria (p*log(p)) given that it must check the distance between every pair
of solutions in the population. But, probably not an significant increase for p < 1000.
Within the optimization method these convergence criteria are added in a list which is typically checked at the end of every iteration. The default is that the iterative process completes when any of the criteria are true. However, the property,
numConvergeCriteriaNeeded, may be set to any integer greater than or equal to one. If it is set to a value greater than or equal than the number of criteria added, then all of the loaded criteria must return true for the process to
stop. After the process has completed, one can check the optimization property,
ConvergenceDeclaredBy to retrieve a list of which criteria returned true. This list is perhaps not useful since what is desired is simply revealing the name of the criteria. Therefore, the property,
ConvergenceDeclaredByTypeString, simply returns a single string that lists the types in a comma-separated list.
In the example, note the use of convergence in the following lines of code.
/* stop after 500 iteration (i.e. generations) */
/*stop after 20 generations of the best not changing */
/*stop if the largest distance is only one unit. */
optMethod.NumConvergeCriteriaNeeded = 2;
/* two of these three criteria are needed to stop the process. */