concept fitness in category algorithms

appears as: Fitness, fitness
Algorithms and Data Structures in Action

This is an excerpt from Manning's book Algorithms and Data Structures in Action.

The core idea, shown in figure 18.4 in the next section, is to encode a solution as a chromosome and assign each chromosome to an organism; then, naturally, it follows that based on how good a solution is, we derive how fit the corresponding organism is for its environment. Fitness, in turn, is a proxy for the chances of an organism to reproduce and pass its genetic material to the next generation through its offspring: like in nature, the alpha-individuals of a population, the stronger (or faster, or yet smarter) ones, tend to have a higher chance of surviving longer and finding a mate.

There are many possible ways to select individuals for mating – we are going to discuss two of the most common here.

Figure 18.7 Tournament selection, applied to our instance of the 0-1 knapsack problem.

Tournament selection is one of the simplest (and easiest-to-implement) selection techniques used in genetic algorithms; it’s illustrated through an example in figure 18.7: conceptually, we randomly select a handful of organisms, and then have them “compete” in a tournament where only the winner gets the right to mate; this is similar to what we see everywhere in wildlife, where (usually) male adults fight for the right to mate with females (ever watched a documentary on deers crossing horns during mating season?).

1/n * [(n-2)/n]k-1
Grokking Artificial Intelligence Algorithms

This is an excerpt from Manning's book Grokking Artificial Intelligence Algorithms.

Selection—A mechanism that measures the fitness of individuals. Stronger individuals have the highest likelihood of survival (survival of the fittest).

These properties imply that the following things happen during the process of evolution (figure 4.3):

In our example, the solution attempts to maximize the value of the items in the knapsack while respecting the weight-limit constraints. The fitness function measures the total value of the items in the knapsack for each individual. The result is that individuals with higher total values are more fit. Note that an invalid individual appears in figure 4.17, to highlight that its fitness score would result in 0—a terrible score, because it exceeds the weight capacity for this instance of the problem, which is 6,404,180.

Figure 4.17 Measuring the fitness of individuals

Depending on the problem being solved, the result of the fitness function may be required to be minimized or maximized. In the Knapsack Problem, the contents of the knapsack can be maximized within constraints, or the empty space in the knapsack could be minimized. The approach depends on the interpretation of the problem.