code: public double getFitness(List<ColouredPolygon> candidate,
                               List<? extends List<ColouredPolygon>> population)
      {
          // Use one renderer per thread because they are not thread safe.
          Renderer<List<ColouredPolygon>, BufferedImage> renderer = threadLocalRenderer.get();
          if (renderer == null)
          {
              renderer = new PolygonImageRenderer(new Dimension(width, height),
                                                  false,
                                                  transform);
              threadLocalRenderer.set(renderer);
          }
          
          BufferedImage candidateImage = renderer.render(candidate);
          Raster candidateImageData = candidateImage.getData();
  
          int[] candidatePixelValues = new int[targetPixels.length];
          candidatePixelValues = (int[]) candidateImageData.getDataElements(0,
                                                                            0,
                                                                            candidateImageData.getWidth(),
                                                                            candidateImageData.getHeight(),
                                                                            candidatePixelValues);
          double fitness = 0;
          for (int i = 0; i < targetPixels.length; i++)
          {
              fitness += comparePixels(targetPixels[i], candidatePixelValues[i]);
          }
  
          return fitness;
      }
docs: Render the polygons as an image and then do a pixel-by-pixel comparison
  against the target image.  The fitness score is the total error.  A lower
  score means a closer match.
  @param candidate The image to evaluate.
  @param population Not used.
  @return A number indicating how close the candidate image is to the target image
  (lower is better).