Selection is a key ingredient in any evolutionary algorithm. It's what determines
which individuals survive to reproduce and which are discarded. All we've said about
selection so far is that it should favour fitter individuals. This definition permits
several different implementations. The Watchmaker Framework includes all of the most
common selection strategies in the
org.uncommons.watchmaker.framework.selection package. These are
sufficient for most evolutionary algorithms but, if necessary, it is straightforward
to write your own implementation of the SelectionStrategy
interface.
Some selection strategies work better than others for certain problems. Often a little
trial-and-error is required to pick the best option. We will delve into the details of
various selection strategies in Chapter 3, Selection Strategies & Elitism, but for now we will
just create an instance of the RouletteWheelSelection
class and use
that for our "Hello World" application.
Roulette wheel selection is the most common type of fitness-proportionate selection. It gives all individuals a chance of being selected but favours the fitter individuals since an individual's selection probability is derived from its fitness score.