Search code examples
python-2.7geneticdeap

How to create three mutually exclusive subsets of a population using DEAP


I am using Python and the DEAP Genetic programming libraries. I have a population set, but I need to create three mutually exclusive and collectively exhaustive subsets of my population. Is this supported by DEAP itself or do I need to create these subsets on my own?


Solution

  • Out of the box, DEAP provides three tools (repeat, iterate and cycle) for population generation which can be found here in their docs. These tools allow the user to provide a function to create a single individual which can be called in a certain manner to eventually produce a population of size n.

    To the best of my knowledge, none of these carry out population generation in the way you describe, so you might want to write it yourself. If you do, I'd encourage you to maybe fork the repository and add it to the source that way (maybe creating a pull request once you have finished to contribute to the library).