The genetic algorithm-based program we created for finding a single minimum of Himmelblau's function resides in the Python 02-optimize-himmelblau.py program, located at:
The program is similar to the one we used for optimizing the Eggholder function, with a few differences highlighted as follows:
- We set the boundaries for this function to [-5.0, 5.0]:
BOUND_LOW, BOUND_UP = -5.0, 5.0 # boundaries for all dimensions
- We now use Himmelblau's function as the fitness evaluator:
def himmelblau(individual): x = individual[0] y = individual[1] f = (x ** 2 + y - 11) ** ...