Optimizing the Eggholder function with genetic algorithms

The genetic algorithm-based program we created for optimizing the Eggholder function resides in the Python 01-optimize-eggholder.py program located at:


The following steps highlight the main parts of this program:

  1. The program starts by setting the function constants, namely the number of input dimensions—2, as this function is defined over the x-y plane, and the boundaries that were mentioned previously:
DIMENSIONS = 2  # number of dimensionsBOUND_LOW, BOUND_UP = -512.0, 512.0  # boundaries, same for all dimensions
  1. Since we are dealing with floating-point numbers ...

Get Hands-On Genetic Algorithms with Python now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.