DEAP (software)

{{Refimprove|date=September 2015}}

{{Infobox software

| name = Distributed Evolutionary Algorithms in Python

| title = DEAP

| logo =

| 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

| released = {{Start date|2009}}

| discontinued =

| latest release version = {{wikidata|property|edit|reference|P348}}

| latest release date = {{start date and age|{{wikidata|qualifier|P348|P577}}}}

| programming language = Python

| operating system = Cross-platform

| language =

| genre = Evolutionary computation framework

| license = LGPL

| website = {{URL|https://github.com/deap}}

}}

Distributed Evolutionary Algorithms in Python (DEAP) is an evolutionary computation framework for rapid prototyping and testing of ideas.{{cite journal|last=Fortin|first=Félix-Antoine|author2=F.-M. De Rainville |author3=M-A. Gardner |author4=C. Gagné|author5=M. Parizeau|title=DEAP: Evolutionary Algorithms Made Easy|journal=Journal of Machine Learning Research|year=2012|volume=13|pages=2171–2175|url=http://jmlr.org/papers/v13/fortin12a.html}}

{{cite journal|last=De Rainville|first=François-Michel|author2=F.-A Fortin |author3=M-A. Gardner |author4=C. Gagné |author5=M. Parizeau|title=DEAP: Enabling Nimber Evolutionss|journal=ACM SIGEVOlution|year=2014|volume=6|issue=2|pages=17–26|doi=10.1145/2597453.2597455|s2cid=14949980|url=http://www.sigevolution.org/issues/pdf/SIGEVOlution0602.pdf}}

{{cite journal|last=De Rainville|first=François-Michel|author2=F.-A Fortin |author3=M-A. Gardner |author4=C. Gagné |author5=M. Parizeau|title=DEAP: A Python Framework for Evolutionary Algorithms|journal=In Companion Proceedings of the Genetic and Evolutionary Computation Conference|year=2012|url=http://vision.gel.ulaval.ca/~cgagne/pubs/deap-gecco-2012.pdf}}

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{{Cite web|url=http://sior.ub.edu/jspui/cris/socialimpact/socialimpact00441|title=Creation of one algorithm to manage traffic systems|website=Social Impact Open Repository|archive-url=https://web.archive.org/web/20170905143318/http://sior.ub.edu/jspui/cris/socialimpact/socialimpact00441|archive-date=2017-09-05|url-status=dead|access-date=2017-09-05}} 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 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

See also

  • Python SCOOP (software)
  • {{Portal-inline|Free software}}

== References ==

{{Reflist}}