Chapter 2. The Watchmaker Framework

Table of Contents

The Evolution Engine
The Candidate Factory
Evolutionary Operators
The Evolution Pipeline
The Fitness Evaluator
Selection Strategy
Random Number Generator
Completing the Jigsaw
Termination Conditions
Evolution Observers

The Watchmaker Framework for Evolutionary Computation is an extensible, high-performance, object-oriented framework for implementing platform-independent evolutionary algorithms in Java. It is freely available under a permissive Open Source licence. It can be downloaded from http://watchmaker.uncommons.org.

This chapter introduces the core components of the Watchmaker Framework and shows how they can be used to implement simple evolutionary algorithms such as the "Hello World" example outlined in the previous chapter.

The Evolution Engine

The central object of an evolutionary program built with the Watchmaker Framework is the evolution engine.

The framework provides multiple implementations of the EvolutionEngine interface, but the one that you will usually want to use is GenerationalEvolutionEngine. This is a general-purpose implementation of the evolutionary algorithm outline from chapter 1.

An EvolutionEngine has a single generic type parameter that indicates the type of object that it can evolve. For the "Hello World" program we need to be able to evolve Java strings. Code that creates an engine that can evolve strings would look something like this:

EvolutionEngine<String> engine
    = new GenerationalEvolutionEngine<String>(candidateFactory,
                                              evolutionaryOperator,
                                              fitnessEvaluator,
                                              selectionStrategy,
                                              rng);
      

Once you have created an EvolutionEngine, your program is as simple as calling the evolve method with appropriate arguments. However, as you can see from the code snippet above, there is a little bit of work to be done first in order to create an EvolutionEngine that is configured appropriately for the given problem. The constructor of the GenerationalEvolutionEngine class requires five objects. These are:

  • A Candidate Factory
  • An Evolutionary Operator
  • A Fitness Evaluator
  • A Selection Strategy
  • A Random Number Generator