## Fitness and Selection Techniques

This section discusses fitness selection and Replacement techniques that are available with the package. In addition, there are example selections for each type.

Fitness selection can take a number of forms. This is a description of the selection strategies used in the package for both selection of the fittest, and replacement of the weakest.

Selection strategies can be combined to get the best mix of surviving members and new recruits.

### Fitness List

The fitness list is the class which holds the fitness values for a generation. It is a subclassed list with additional statistics tacked on.

The following is an example of a typical fitness list. The format is:

[fitness_value, member_no]

where member_no is the index position within the list.

Example of a Fitness List sorted by fitness value: ================================================= [0.02689267374143145, 2] [0.034262795979475125, 4] [0.14574760894032901, 10] [0.29515808870127069, 13] [0.33073484487074634, 14] [0.34466928410553321, 8] [0.38313755184891773, 3] [0.38960229772992716, 9] [0.44736210658328246, 11] [0.49378372171131801, 7] [0.51691822222144257, 0] [0.84866669583470145, 6] [0.89358906741444621, 5] [0.95832596214321464, 12] [0.98303101435534523, 1]

A fitness list is instantiated with the fitness type, and optionally a target value. The type refers to the objective of the evolutionary process, such as generating the largest fitness value possible. Accepted fitness types are 'min', 'max', or 'center'. While a target value is required for a 'center' type, it is optional for 'min', and 'max'.

An example of a 'center' based fitness list could have a target value of 0.01, which would mean that the process would continue until the abs(fitness value) is less or equal than 0.01.

To help evaluate the fitness space, additional statistical functions are part of the FitnessList object:

- Statistics: mean, median, standard deviation
- Min/Max values: min_value, max_value
- Min/Max members: min_member, max_member
- Superlative values: best_value, worst_value
- Superlative members: best_member, worst_member

### Selections

Selections are made by either taking simply the top or bottom percentage, a simulated roulette wheel from a biased probability list, or a tournament where a small selection is taken from the fitness list and the best member is selected.

#### Elitism

This process selects on the basis of the best or the worst. Usually, it is a fixed percentage. When used exclusively, it has a tendency to become mired in less capable genotypes because of an inadequate search of the solution space. It often is combined with other selection strategies.

#### Roulette

In gambling a roulette wheel contains a series of numbers on the wheel, and while spinning a marble eventually comes to rest on one of those numbers making the selection. In the processes here, there is a similar process. However, what is different is that while the gambling roulette wheel is hopefully unbiased, the fitness selection roulette wheels bias the selection towards more fit values and away from less fit values. It is as if some numbers on the roulette wheel are wider on more fit values and narrower on less fit values. There are various strategies that govern the widths that are derived, but all roulette selection strategies use a probabilistic list that totals 1.0.

The benefit of using such a strategy is that while a selection process is likely to select a number of desirable genotypes, selecting less desirable genotypes may well crossover or mutate to become much more succesful genotypes than any of the current genotypes. Genetic diversity helps to avoid becoming trapped in a local minima of the search space.

#### Tournaments

Tournaments represent another approach to ensuring a level of genetic diversity. A tournament is a contest in which a small number of members are drawn from the population and the most fit member of the group is selected. Because the selection process is random, diversity is likely, but because the most fit is selected, a bias towards more fit is likely as well.

The following presents a description of the fitness selection types and typical results that would be obtained using the fitness list given above.

### Fitness Classes

#### FitnessProportionate Class

The FitnessProportionate class selects by a roulette process where the probability list is shaped and scaled by the actual fitness values. There are several types:

- linear: Scales all the values into a probability list according to relative size.
- truncation: Scales all the values over a hurdle value into a probability list according to relative size.
- exponential: Scales all the values raised to a power into a probability list according to relative size.
- logarithmic: Scales all the log values into a probability list according to relative size.

One thing worth noting is that proportionality is based upon the fitness value to the sum of the fitness values. That implies that the sign of all the fitness values are the same.

Typical results follow for each type of selection. Fitness type refers to the objective of the evolutionary strategy. The numbers below each description are the member numbers selected from the population. By comparing the number selected with the fitness list above, you can see examples of the selection process at work.

Scaling Type:linear Fitness Type:max 1 13 12 11 0 6 13 8 1 12 6 9 0 1 11 Scaling Type:linear Fitness Type:min 2 10 2 2 2 4 2 2 2 4 2 4 2 10 4 Scaling Type:linear Fitness Type:center 11 12 5 7 8 5 8 1 8 14 1 0 8 6 8 Scaling Type:exponential Fitness Type:max 5 1 1 12 11 1 0 0 0 3 5 5 5 9 6 Scaling Type:exponential Fitness Type:min 2 4 2 4 4 2 4 2 2 2 4 4 2 4 2 Scaling Type:exponential Fitness Type:center 6 7 0 6 8 5 13 3 12 2 6 5 5 5 1 Scaling Type:truncation Fitness Type:max Truncation Value:0.25 5 5 8 6 11 7 7 6 5 3 1 13 3 1 7 Scaling Type:truncation Fitness Type:min Truncation Value:0.25 14 5 13 6 12 9 0 0 14 3 8 11 13 11 14 Scaling Type:truncation Fitness Type:center Truncation Value:0.25 11 13 2 3 7 14 11 3 7 13 9 3 3 8 9

#### FitnessTournament Class

The FitnessTournament class implements a tournament for fitness as described above. The tournament size is adjustable. The larger the tournament size, the more likely that high fitness members are to be included.

Fitness Type: max Tournament Size: 2 7 14 6 11 6 13 7 3 12 1 9 9 8 13 8 Fitness Type: min Tournament Size: 2 0 8 14 13 10 11 11 14 4 14 4 8 2 7 4 Fitness Type: center Tournament Size: 2 1 6 12 6 8 6 7 8 1 4 8 9 1 4 12

#### FitnessElites Class

The FitnessElites class implements a selection strategy that takes the top percentage of the population, ensuring that the best of a generation can be continued to the next generation.

Fitness Type: max Elite Rate: 0.3 1 12 5 6 0 Fitness Type: min Elite Rate: 0.3 2 4 10 13 14 Fitness Type: center Elite Rate: 0.3 6 5 12 1 0

#### FitnessLinearRanking Class

This class selects fitness on the basis of rank with other members. Only the position in the ranking matters rather than the fitness value. The probability curve is calculated on that basis, then roulette selection takes place.

This uses the formula for the probability curve of:

worstfactor: w bestfactor: b population: p Probability = 1 / p * (w + (b - w) * (rank(Member) - 1) / (p - 1))

When b + w = 2 and 1 <= worstfactor <= 2, the best individual produces up to twice the number of children as the average.

Fitness Type: max Linear Ranking: 0 1 2 2 5 6 8 11 4 2 7 4 6 0 1 Fitness Type: min Linear Ranking: 4 2 10 12 1 8 4 10 8 11 2 11 0 10 4 Fitness Type: center Linear Ranking: 3 12 10 6 7 0 3 6 6 5 6 6 1 0 3

#### FitnessTruncationRanking Class

This class selects fitness on the basis of rank with other members if above a certain rank. Once above that rank, any member can be selected with an equal probability. The truncation value is entered as a rate and converted to a ranking value. For example, if a population has 100 members and a truncation value of .2, the truncated ranking will be converted to a rank of 20.

Fitness Type: max Truncation rate: 0.2 10 10 4 2 4 10 10 2 4 2 2 10 2 10 4 Fitness Type: min Truncation rate: 0.2 5 5 12 5 1 5 5 12 12 5 12 1 1 12 1 Fitness Type: center Truncation rate: 0.2 2 2 10 4 10 2 4 10 2 10 2 4 2 4 4

### Replacement Classes

#### ReplacementDeleteWorst Class

The ReplacementDeleteWorst class acts just as the FitnessElite class, except in reverse, culling a percentage of the weakest members.

Fitness Type: max Replacement Count: 3 2 4 10 Fitness Type: min Replacement Count: 3 1 12 5 Fitness Type: center Replacement Count: 3 2 4 10

#### ReplacementTournament Class

The ReplacementTournament class selects on the basis of a tournament, culling the weakest members.

Fitness Type: max Tournament Size: 2 14 3 13 14 14 7 2 4 11 8 13 13 2 11 4 Fitness Type: min Tournament Size: 2 0 7 1 1 0 5 5 5 11 5 3 12 3 9 6 Fitness Type: center Tournament Size: 2 7 7 4 2 3 13 10 10 14 2 10 13 4 4 2