DEAP (software) explained

Distributed Evolutionary Algorithms in Python
DEAP
Author:François-Michel De Rainville, Félix-Antoine Fortin, Marc-André Gardner, Marc Parizeau, Christian Gagné
Developer:François-Michel De Rainville, Félix-Antoine Fortin, Marc-André Gardner
Programming Language:Python
Operating System:Cross-platform
Genre:Evolutionary computation framework
License:LGPL

Distributed Evolutionary Algorithms in Python (DEAP) is an evolutionary computation framework for rapid prototyping and testing of ideas.[1] [2] [3] It incorporates the data structures and tools required to implement most common evolutionary computation techniques such as genetic algorithm, genetic programming, evolution strategies, particle swarm optimization, differential evolution, traffic flow[4] and estimation of distribution algorithm. It is developed at Université Laval since 2009.

Example

The following code gives a quick overview how the Onemax problem optimization with genetic algorithm can be implemented with DEAP.import arrayimport randomfrom deap import creator, base, tools, algorithms

creator.create("FitnessMax", base.Fitness, weights=(1.0,))creator.create("Individual", array.array, typecode='b', fitness=creator.FitnessMax)

toolbox = base.Toolboxtoolbox.register("attr_bool", random.randint, 0, 1)toolbox.register("individual", tools.initRepeat, creator.Individual, toolbox.attr_bool, 100)toolbox.register("population", tools.initRepeat, list, toolbox.individual)

evalOneMax = lambda individual: (sum(individual),)

toolbox.register("evaluate", evalOneMax)toolbox.register("mate", tools.cxTwoPoint)toolbox.register("mutate", tools.mutFlipBit, indpb=0.05)toolbox.register("select", tools.selTournament, tournsize=3)

population = toolbox.population(n=300)NGEN = 40

for gen in range(NGEN): offspring = algorithms.varAnd(population, toolbox, cxpb=0.5, mutpb=0.1) fits = toolbox.map(toolbox.evaluate, offspring) for fit, ind in zip(fits, offspring): ind.fitness.values = fit population = offspring

See also

Notes and References

  1. Fortin. Félix-Antoine. F.-M. De Rainville . M-A. Gardner . C. Gagné. M. Parizeau. DEAP: Evolutionary Algorithms Made Easy. Journal of Machine Learning Research. 2012. 13. 2171–2175.
  2. De Rainville. François-Michel. F.-A Fortin . M-A. Gardner . C. Gagné . M. Parizeau. DEAP: Enabling Nimber Evolutionss. ACM SIGEVOlution. 2014. 6. 2. 17–26. 10.1145/2597453.2597455. 14949980.
  3. De Rainville. François-Michel. F.-A Fortin . M-A. Gardner . C. Gagné . M. Parizeau. DEAP: A Python Framework for Evolutionary Algorithms. In Companion Proceedings of the Genetic and Evolutionary Computation Conference. 2012.
  4. Web site: Creation of one algorithm to manage traffic systems. Social Impact Open Repository. https://web.archive.org/web/20170905143318/http://sior.ub.edu/jspui/cris/socialimpact/socialimpact00441. 2017-09-05. dead. 2017-09-05.