# Genetic Algorithms Fitness Function - Genetic Algorithms

## What is Genetic Algorithms Fitness Function?

The fitness function merely defined is a function which proceeds a candidate solution to the problem as input and produces as output how “fit” our how “good” the solution is with respect to the problem in consideration.

Calculation of fitness value is done frequently in a GA and so it should be adequately fast. A slow calculation of the fitness value can badly affect a GA and make it remarkably slow.

In maximum cases the fitness function and the objective function are the same as the objective is to either maximize or minimize the given objective function. Though, for more complex problems with multiple objectives and constraints, an Algorithm Designer might choose to have a different fitness function.

A fitness function should possess the following characteristics −

• The fitness function should be sufficiently fast to compute.
• It must quantitatively measure how fit a given solution is or how fit individuals can be produced from the given solution.

In particular cases, calculating the fitness function openly might not be possible due to the inherent difficulties of the problem at hand. In such circumstances, we do fitness estimate to suit our needs.

The resulting image shows the fitness calculation for a solution of the 0/1 Knapsack. It is a simple fitness function which just sums the profit values of the items being picked (which have a 1), scanning the elements from left to right till the knapsack is full. Genetic Algorithms Topics