I see your struggle with the DEAP docs. Nevertheless, I have written my own Evolutionary Computing library, and lately I have been using DEAP for many proof-of-concepts and I think they did a good job with it.
Going on, Let's take a look at the complete example. If you read the docs you will be confortable looking at the code. The problem size is the number of variables, so in your case if I understand correctly you would have N = 2
(x and y).
And you need your custom fitness function instead of benchamrks.rastrigin
:
toolbox.register("evaluate", myownfunction)
The constraints are not implemented, but are an easy task. In the fitness function you can invalidate the individuals that violate the constraints (for instance by assigning a very high fitness, if minimizing) and in few generations your population should be free of invalids.
This would be the simplest approach with DEAP, but the deap.cma.Strategy
class can be extended in order to override/extend any method, for instance, the generate
method so that all the individuals in the initial population are valid.