code: private SwingBackgroundTask<Biomorph> createTask(final int populationSize,
                                                       final int generationCount,
                                                       final boolean random)
      {
          return new SwingBackgroundTask<Biomorph>()
          {
              @Override
              protected Biomorph performTask()
              {
                  EvolutionaryOperator<Biomorph> mutation = random ? new RandomBiomorphMutation(new Probability(0.12d))
                                                                   : new DawkinsBiomorphMutation();
                  InteractiveSelection<Biomorph> selection = new InteractiveSelection<Biomorph>(console,
                                                                                                renderer,
                                                                                                populationSize,
                                                                                                1);
                  EvolutionEngine<Biomorph> engine = new GenerationalEvolutionEngine<Biomorph>(new BiomorphFactory(),
                                                                                               mutation,
                                                                                               selection,
                                                                                               new MersenneTwisterRNG());
                  engine.addEvolutionObserver(new GenerationTracker());
                  return engine.evolve(populationSize,
                                       0,
                                       new GenerationCount(generationCount));
              }
  
              @Override
              protected void postProcessing(Biomorph result)
              {
                  selectionDialog.setVisible(false);
                  biomorphHolder.removeAll();
                  biomorphHolder.add(renderer.render(result));
                  biomorphHolder.revalidate();
              }
          };
      }
docs: Helper method to create a background task for running the interactive evolutionary
  algorithm.
  @param populationSize How big the population used by the created evolution engine
  should be.
  @param generationCount How many generations to use when the evolution engine is
  invoked.
  @param random If true use random mutation, otherwise use Dawkins mutation.
  @return A Swing task that will execute on a background thread and update
  the GUI when it is done.