Questions tagged [deap]

DEAP is an evolutionary computation framework for rapid prototyping and testing of ideas

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 mechanism such as multiprocessing and SCOOP.

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
173 questions
2
votes
1 answer

How to add elimination mechanism in Python genetic algorithm based on DEAP

Here is my question. I'm dealing with one optimization problem using DEAP. For now, I use toolbox.register("select", tools.selNSGA2) to select some fittest indivual to survive. But I want to add some threshold by user-defined function. Can the…
Han Zhengzu
  • 3,694
  • 7
  • 44
  • 94
2
votes
2 answers

HyperVolume function not working in Python 3

Based on a HyperVolume function found here (direct download link), I am trying to return hypervolume metrics for my algorithm. However, not even the test code works: from hv import HyperVolume referencePoint = [2, 2, 2] hyperVolume =…
Silviu Tofan
  • 379
  • 1
  • 3
  • 17
2
votes
0 answers

Resource Allocation Optimization - Variation of Multiple Knapsack

I have J projects, running over T weeks, each project using S amount of resources in week t (based on a pre-defined matrix). I have to allocate these projects to I clusters, where cluster capacity C_i is known. Furthermore, each project belongs to a…
Silviu Tofan
  • 379
  • 1
  • 3
  • 17
2
votes
3 answers

How to use random.randint to find random 0 and 1 with not equal propbability

I am using DEAP toolbox in Python for Genetic Algorithm. toolbox.register("attr_bool", random.randint, 0, 1) is a function randomly chooses 0 and 1 for populations in GA. I want to force GA to choose 0 and 1 randomly but with for example 80% one…
Amn Kh
  • 531
  • 3
  • 7
  • 19
2
votes
1 answer

RuntimeError of python occers on windows to multiprocessing

I am trying Threading and Multiprocessing for python on a windows machine.But python give the following message. RuntimeError: Attempt to start a new process before the current process has finished its bootstrapping phase. …
kishi-kun
  • 21
  • 1
  • 4
2
votes
1 answer

Python - Safe Indexing with boolean

I have some code which returns values from a list. I'm using strongly typed genetic programming (using the excellent DEAP module), but I realise that 1 & 0 is the same as True and False. This means where a function is expecting an integer, it might…
Anjum Sayed
  • 872
  • 9
  • 20
2
votes
2 answers

Implementing GP that works on pandas DataFrames in DEAP

I'm using DEAP's implementation of genetic programming for one of my research projects. I would like to create a GP that works on pandas DataFrames: Each primitive will be a custom function that takes a DataFrame as input and returns a DataFrame as…
Randy Olson
  • 3,131
  • 2
  • 26
  • 39
1
vote
0 answers

How can I change Value of Bounds during evolution in a genetic algorithm by DEAP implementation?

def checkBounds(min, max): def decorator(func): def wrapper(*args, **kargs): offspring = func(*args, **kargs) for child in offspring: for i in range(len(child)): if child[i] > max: …
Arijit
  • 11
  • 3
1
vote
1 answer

DEAP package for genetic algorithm in pyhton

The DEAP package which is used to execute GA has the below codes and can be found here http://aqibsaeed.github.io/2017-08-11-genetic-algorithm-for-optimizing-rnn/ population_size = 4 num_generations = 4 gene_length = 10 # As we are trying to…
NN_Developer
  • 417
  • 6
1
vote
0 answers

How can I access all feasible solutions from Genetic Algorthm with DEAP library?

I am trying to apply GA for generating a set of solutions that fulfil a list of constraints. I would like to find solutions (individuals) of diets that fulfill nutritional constraints, for which I think GA could be a good way to do so. I have found…
1
vote
0 answers

How can I choose particular ranges of gene number in mutation function of DEAP?

I would like to ask what should I do if my Mat (the first gene of the chromosome) is only 0 and 2 (not 1)? Following is the code: tools.mutUniformInt(low=[Mat_min, 0, Span_min, Span_min], up=[Mat_max, 7, Span_max, Span_max], indpb=0.05,…
1
vote
1 answer

How to represent mixed float and discrete variables in DEAP library for genetic algorithm?

Assume that I want to optimize the following function: Minimize y = x1 * x2 - x3 -5 <= x1 <= 5 # float 0 <= x2 <= 1 # float with precision 0.01 0 <= x3 <= 5 # integer can have values : [0, 1, 2, 3, 4, 5] x2 can have decimal values with…
Mohammad
  • 775
  • 1
  • 14
  • 37
1
vote
0 answers

'NoneType' Object is not Subscriptable on deap expr func call

I'm aware that there are other questions with the same name, but they're all about indexing and I'm getting this error when trying to invoke func(r_curr). I've already checked and func is not NoneType after assignment, it is at…
Andrew
  • 357
  • 5
  • 16
1
vote
1 answer

Difference between DEAP fitness and fitness.value

For the following code, why does printing out ind.fitness and printing out ind.fitness.values returns the same exact output. Does it mean the method is the same or is there any difference? for ind, fit in zip(pop, fitnesses): #print(ind,…
MIT
  • 17
  • 4
1
vote
0 answers

Is it possible to add a timeout to a fitness evaluation function in DEAP?

I'm trying to use DEAP to evolve regex strings. It worked for small inputs but when I try larger inputs, then it starts to evolve regex strings that exhibit catastrophic backtracking. This stalls the evolution process as the regex search never…
Jim
  • 661
  • 11
  • 30