Deap - Distributed Evolutionary Algorithms in Python
DEAPDEAP is intended to be an easy to use distributed evolutionary algorithm library in the Python language. Its two main components are modular and can be used separately. The first module is a Distributed Task Manager (DTM), which is intended to run on cluster of computers. The second part is the Evolutionary Algorithms in Python (EAP) framework. ComponentsDTMDTM is a distributed task manager that is able to spread workload over a buch of computers using a TCP or a MPI connection. DTM include the following features: Easy to use parallelization paradigms Offers a similar interface to the Python's multiprocessing module Basic load balancing algorithm Works over mpi4py Support for TCP communication manager EAPEAP is the evolutionary core of DEAP, it provides data structures, methods and tools to design any kind of evolutionary algorithm. It works in perfect harmony with DTM, allowing easy parallelization of any demanding evolutionary task. EAP includes the following features: Genetic algorithm using any imaginable representation List, Array, Set, Dictionary, Tree, Numpy Array, etc. Genetic programing using prefix trees Loosely typed, Strongly typed Automatically defined functions Evolution strategies (including CMA-ES) Multi-objective optimisation (NSGA-II, SPEA-II) 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 DocumentationSee the DEAP User's Guide for DEAP 0.8 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. RequirementsThe 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. Version 0.8 is now compatible out of the box with Python 3.2, the installation procedure will automatically translate DEAP to Python 3. ExampleThe 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 array, randomfrom deap import creator, base, tools, algorithmscreator.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)def evalOneMax(individual): return sum(individual),toolbox.register("evaluate", evalOneMax)toolbox.register("mate", tools.cxTwoPoints)toolbox.register("mutate", tools.mutFlipBit, indpb=0.05)toolbox.register("select", tools.selTournament, tournsize=3)population = toolbox.population(n=300)NGEN=40for 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 offspring = [toolbox.clone(ind) for ind in toolbox.select(offspring, len(offspring))] population = offspringProjects using DEAPMarc-AndrÃ© Gardner, Christian GagnÃ© and Marc Parizeau, "Bloat Control in Genetic Programming with Histogram-based Accept-Reject Method", in Proc. Genetic and Evolutionary Computation Conference (GECCO 2011), 2011. Vahab Akbarzadeh, Albert Ko, Christian GagnÃ© and Marc Parizeau, "Topography-Aware Sensor Deployment Optimization with CMA-ES", in Proc. of Parallel Problem Solving from Nature (PPSN 2010), Springer, 2010. If you want your project listed here, send us a link and a brief description and we'll be glad to add it.