As you already know from the chapter about search space, problem solving can be often expressed as looking for extreme of a function defined over the search space. We solve exactly this problem here.
A function is given and GA tries to find minimum of the function. For other problems we just have to define search space and the fitness function (for which we want to find an extreme).
Try to run the genetic algorithm in the following applet by pressing Start button. The graph represents a search space and vertical lines represent solutions (points in search space). The red line is the best solution, green lines are the other ones. Old and new population is shown at the top of the applet. Each population consists of binary chromosomes - red and blue points mean zeros and ones. You can see the process of forming the new population in steps in the applet.
Start button starts the algorithm, Step button performs one step (i.e. forming
one new generation), Stop button stops the algorithm and Reset button resets the
population.
It is suggested to start with pressing the Step button and to watch how GA works
in details. The outline of
GA has been introduced in one of the previous chapters. You can see
elitism for the first chromosomes and then forming new offspring by crossover and mutation until
the new population is completed.