DEAP (software)
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.
Original author(s) | François-Michel De Rainville, Félix-Antoine Fortin, Marc-André Gardner, Marc Parizeau, Christian Gagné |
---|---|
Developer(s) | François-Michel De Rainville, Félix-Antoine Fortin, Marc-André Gardner |
Initial release | 2009 |
Stable release | 1.2.2
/ November 12, 2017 |
Repository | ![]() |
Written in | Python |
Operating system | Cross-platform |
Type | Evolutionary computation framework |
License | LGPL |
Website | github |
Example
The following code gives a quick overview how the Onemax problem optimization with genetic algorithm can be implemented with DEAP.
import array
import random
from 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.Toolbox()
toolbox.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
gollark: Sleep deprivation is no joke, as I have occasionally mentioned.
gollark: Yes, """enjoy""""" """"""""""""""""sleep".
gollark: Which is good, if we can actually discuss things without going "no, you are an awful person for even considering this".
gollark: Greetings, ubiquitous form.
gollark: Although people saying "kill all pedophiles" is kind of bad, since it's not like they choose to be pedophiles.
See also
- Python SCOOP (software)
Free software portal
References
- Fortin, Félix-Antoine; F.-M. De Rainville; M-A. Gardner; C. Gagné; M. Parizeau (2012). "DEAP: Evolutionary Algorithms Made Easy". Journal of Machine Learning Research. 13: 2171–2175.
- De Rainville, François-Michel; F.-A Fortin; M-A. Gardner; C. Gagné; M. Parizeau (2014). "DEAP: Enabling Nimber Evolutionss" (PDF). SIGEvolution. 6 (2): 17–26.
- De Rainville, François-Michel; F.-A Fortin; M-A. Gardner; C. Gagné; M. Parizeau (2012). "DEAP: A Python Framework for Evolutionary Algorithms" (PDF). In Companion Proceedings of the Genetic and Evolutionary Computation Conference.
- "Creation of one algorithm to manage traffic systems". Social Impact Open Repository. Archived from the original on 2017-09-05. Retrieved 2017-09-05.
External links
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.