
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
English | 简体中文
DEAP is a novel evolutionary computation framework for rapid prototyping and testing of ideas. It seeks to make algorithms explicit and data structures transparent. It works in perfect harmony with parallelisation mechanisms such as multiprocessing and SCOOP.
DEAP includes the following features:
Genetic algorithm using any imaginable representation
Genetic programming using prefix trees
Evolution strategies (including CMA-ES)
Multi-objective optimisation (NSGA-II, NSGA-III, SPEA2, MO-CMA-ES)
Co-evolution (cooperative and competitive) of multiple populations
Parallelization of the evaluations (and more)
Hall of Fame of the best individuals that lived in the population
Checkpoints that take snapshots of a system regularly
Benchmarks module containing most common test functions
Genealogy of an evolution (that is compatible with NetworkX)
Examples of alternative algorithms : Particle Swarm Optimization, Differential Evolution, Estimation of Distribution Algorithm
Following acceptance of PEP 438 by the Python community, we have moved DEAP's source releases on PyPI.
You can find the most recent releases at: https://pypi.python.org/pypi/deap/.
See the DEAP User's Guide for DEAP documentation.
In order to get the tip documentation, change directory to the doc
subfolder and type in make html
, the documentation will be under _build/html
. You will need Sphinx to build the documentation.
Also checkout our new notebook examples. Using Jupyter notebooks you'll be able to navigate and execute each block of code individually and tell what every line is doing. Either, look at the notebooks online using the notebook viewer links at the botom of the page or download the notebooks, navigate to the you download directory and run
jupyter notebook
We encourage you to use easy_install or pip to install DEAP on your system. Other installation procedure like apt-get, yum, etc. usually provide an outdated version.
pip install deap
The latest version can be installed with
pip install git+https://github.com/DEAP/deap@master
If you wish to build from sources, download or clone the repository and type
python setup.py install
DEAP build status is available on Travis-CI https://travis-ci.org/DEAP/deap.
The most basic features of DEAP requires Python2.6. In order to combine the toolbox and the multiprocessing module Python2.7 is needed for its support to pickle partial functions. CMA-ES requires Numpy, and we recommend matplotlib for visualization of results as it is fully compatible with DEAP's API.
Since version 0.8, DEAP is compatible out of the box with Python 3. The installation procedure automatically translates the source to Python 3 with 2to3, however this requires having setuptools<=58
. It is recommended to use pip install setuptools==57.5.0
to address this issue.
The following code gives a quick overview how simple it is to implement the Onemax problem optimization with genetic algorithm using DEAP. More examples are provided here.
import random
from deap import creator, base, tools, algorithms
creator.create("FitnessMax", base.Fitness, weights=(1.0,))
creator.create("Individual", list, fitness=creator.FitnessMax)
toolbox = base.Toolbox()
toolbox.register("attr_bool", random.randint, 0, 1)
toolbox.register("individual", tools.initRepeat, creator.Individual, toolbox.attr_bool, n=100)
toolbox.register("population", tools.initRepeat, list, toolbox.individual)
def evalOneMax(individual):
return 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 = toolbox.select(offspring, k=len(population))
top10 = tools.selBest(population, k=10)
Authors of scientific papers including results generated using DEAP are encouraged to cite the following paper.
@article{DEAP_JMLR2012,
author = " F\'elix-Antoine Fortin and Fran\c{c}ois-Michel {De Rainville} and Marc-Andr\'e Gardner and Marc Parizeau and Christian Gagn\'e ",
title = { {DEAP}: Evolutionary Algorithms Made Easy },
pages = { 2171--2175 },
volume = { 13 },
month = { jul },
year = { 2012 },
journal = { Journal of Machine Learning Research }
}
If you want your project listed here, send us a link and a brief description and we'll be glad to add it.
FAQs
Distributed Evolutionary Algorithms in Python
We found that deap demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.