GEATbx: Main page  Tutorial  Algorithms  M-functions  Parameter/Options  Example functions  www.geatbx.com

# 8 Termination options

All the termination is handled by the function terminat.

### Termination.Method

This option sets the employed methods for termination of the optimization. You may select none, one or multiple of the available termination methods.

• Default value: 1
• Type: integer in [1, Inf]
• When Termination.Method is 0, no termination at all takes place.
• Multiple termination methods may be used at the same time. The methods are OR combined. That means, when one of the employed termination methods is true, the optimization is finished.
• The following termination methods are available. The parameters of the termination methods are defined by specific options given in parenthesis.
• Two styles for the definition of multiple termination methods are available:
• The termination methods are defined as a vector of numbers, each element of the vector specifying one employed termination method: [ 1 3 6].
• The termination methods are contained in one number and each digit of the number defines one of the employed termination methods: 136.
• Example - employ termination methods maximal generations and maximal time (both styles shown):
```GeaOpt = geaoptset(GeaOpt, 'Termination.Method', 12);
GeaOpt = geaoptset(GeaOpt, 'Termination.Method', [1 2]);```
• Example - employ termination methods maximal generations, difference to optimum and running mean:
```GeaOpt = geaoptset(GeaOpt, 'Termination.Method', 134);
GeaOpt = geaoptset(GeaOpt, 'Termination.Method', [1 3 4];```

### Termination.MaxGenerations

This option determines the maximal number of generations an optimization is run. When the specified number of generations is reached, the optimization terminates.

• Default value: 100
• Type: integer in [1, Inf]
• Example - define the maximal number of generations before termination to 234:
```GeaOpt = geaoptset(GeaOpt, 'Termination.MaxGenerations', 234, ...
'Termination.Method', 1);```
• A good starting value for maximal number of generations depending on the number of independent variables is: 200 times sqrt(n) (n is the number of independent variables).
• Option number in previous versions: 51 or 14 (2.x), 14 (1.x)

### Termination.MaxTime

This option determines the maximal time (in minutes) an optimization is run. When the specified time is over, the optimization terminates.

• Default value: 10
• Type: integer in [0, Inf]
• Example - define the maximal optimization time to 4.5 minutes:
```GeaOpt = geaoptset(GeaOpt, 'Termination.MaxTime', 4.5, ...
'Termination.Method', 2);```
• The computing time is (currently) measured as real/absolute time (and not cpu time). Before a generation starts, the time is measured. If this time is longer than specified, the optimization terminates.
• Option number in previous versions: 52 (2.x), not available (1.x)

### Termination.Diff2Optimum

This option terminates an optimization run, if the best objective value reached a defined value (measure of the precision required of the objective function at the solution). If the difference between the best objective value and the defined global optimum (precision of solution) is smaller than Termination.Diff2Optimum, the termination criteria is true and the optimization terminates.
This may be used for benchmarking different optimization algorithms (difference to known global optimum) or for termination, when a good enough value is found (problem specific). The global optimum/good enough objective value must be defined in System.ObjFunMinimum.

• Default value: 0.0001
• Type: scalar in [0, Inf]
• Example - define the difference to global optimum to 0.01 and the global optimum to 3.45. As soon as an objective value of 3.46 or smaller is found, the optimization terminates:
```GeaOpt = geaoptset(GeaOpt, 'Termination.Method', [3 1], ...
'Termination.Diff2Optimum', 0.01, 'System.ObjFunMinimum', 3.45);```
• This termination method is currently only implemented for single-objective optimization. An extension to the multi-objective case is possible. However, currently only the first objective value is used.
• Option number in previous versions: 53 or 3 (2.x), not available (1.x)

### Termination.RunningMean

This option determines the minimal difference between the mean of the best objective values of last RunMean generations and the current best objective value. Internally, RunMean is set to 15 Generations.

• Default value: 0
• Type: integer in [0, Inf]
• Example - define the running mean to 0.01:
```GeaOpt = geaoptset(GeaOpt, 'Termination.RunningMean', 0.01, ...
'Termination.Method', 4);```
• A value for Termination.RunningMean of 0 defines, that the optimization is only terminated, when for 15 (the defined value of RunMean) consecutive generations no better objective value at all is found. A higher value terminates the optimization, when the enhancement of the best objective value is very small only. Running Mean is one of the reliable termination criteria.
• Option number in previous versions: 55/54 (2.x), not available (1.x)

### Termination.StdObjV

This option determines the minimal value of the standard deviation of the objective values of the current generation to reach before termination.

• Default value: 0.001
• Type: integer in [0, Inf]
• Example - define the minimal standard deviation of the objective values to 0.42:
```GeaOpt = geaoptset(GeaOpt, 'Termination.StdObjV', 0.42, ...
'Termination.Method', [5 1]);```
• The standard deviation of the objective values is problem specific. The size of the termination option depends on the used evolutionary operators too. This termination option is not reliable. Use it only, when you know what you are doing!
• Option number in previous versions: 54/55 (2.x), not available (1.x)

### Termination.GoodWorstObjV

This option determines the minimal difference between the objective values of the current worst and best individual.

• Default value: 0.1
• Type: integer in [0, Inf]
• Example - define the minimal difference between best and worst objective value to 11.45:
```GeaOpt = geaoptset(GeaOpt, 'Termination.GoodWorstObjV', 11.45, ...
'Termination.Method', [6 1]);```
• The difference of the best and worst objective value is problem specific. The size of the termination option depends on the used evolutionary operators too. This termination option is not reliable. Use it only, when you know what you are doing!
• Option number in previous versions: 56 (2.x), not available (1.x)

### Termination.Phi

This option determines the minimal difference between 1 and Phi. Phi is the quotient of the average objective value (of all individuals of the population) and the best objective value.

• Default value: 1e-006
• Type: integer in [0, Inf]
• Example - define the termination with Phi to 0.0001:
```GeaOpt = geaoptset(GeaOpt, 'Termination.Phi', 0.0001, ...
'Termination.Method', [7 1]);```
• The value of Phi is problem specific. The termination option depends on the used evolutionary operators too. This termination option is not reliable. Use it only, when you know what you are doing!
• Option number in previous versions: 57 (2.x), not available (1.x)

### Termination.Kappa

This option determines the minimal difference between 1 and Kappa. Kappa is a measure for the similarity of the individuals.

• Default value: 1e-006
• Type: integer in [0, Inf]
• Example - define the termination with Kappa to 0.00002:
```GeaOpt = geaoptset(GeaOpt, 'Termination.Kappa', 0.00002, ...
'Termination.Method', [8 1]);```
• The value of Kappa is problem specific. The termination option depends on the used evolutionary operators too. This termination option is not reliable. Use it only, when you know what you are doing!
• Option number in previous versions: 58 (2.x), not available (1.x)

### Termination.Cluster

This option defines the termination option for cluster analysis. The calculation of the cluster termination is complex. Please look into the respective documentation (to be done - diploma of Johannes).

• Default value: 0
• Type: integer in [0, Inf]
• Example - define the cluster termination option to 0.01:
```GeaOpt = geaoptset(GeaOpt, 'Termination.Cluster', 0.01, ...
'Termination.Method', [9 1]);```
• Option number in previous versions: not available (2.x and 1.x)

 GEATbx: Main page  Tutorial  Algorithms  M-functions  Parameter/Options  Example functions  www.geatbx.com

This document is part of version 3.8 of the GEATbx: Genetic and Evolutionary Algorithm Toolbox for use with Matlab - www.geatbx.com.
The Genetic and Evolutionary Algorithm Toolbox is not public domain.