VI. GA Example - Minimum of Function


About the Problem

As you already know from the chapter about search space, problem solving can often be expressed as searching for an extreme of a function. That is exactly the kind of problem shown here.

A function is given, and the GA tries to find its minimum. For other problems, we only need to define the search space and the fitness function, which means defining the function whose extreme we want to find.


Example

You can try running the genetic algorithm in the following demonstration by pressing the Start button. The graph represents a search space, and the vertical lines represent solutions (points in the search space). The red line is the best solution; the green lines are the other ones. Above the graph, the old and new populations are displayed. Each population consists of binary chromosomes - red and blue points represent zeros and ones. In the demonstration you can watch the process of forming a new population step by step.

The Start button begins the algorithm, Step performs one step (that is, forms one new generation), Stop stops the algorithm, and Reset restores the population.
We suggest that you begin by pressing Step and watching how the GA works in detail. The outline of the GA was introduced in one of the previous chapters. First you can see elitism, and then the formation of new offspring by crossover and mutation until the new population is complete.