166 questions
1
vote
1
answer
88
views
Why does this Genetic Algorithm give such bad solutions to a TSP?
I coded a Genetic Algorithm in Python using the DEAP library to solve a modified TSP problem, where the evaluation function is:
def evaluate(self, individual: list[int]) -> float:
...
0
votes
1
answer
57
views
DEAP eaSimple in python crashes becouse of too many laggs
Error
I get SyntaxError: too many nested parentheses.
File /home/tilen/genetic_programming/.venv/lib/python3.10/site-packages/IPython/core/interactiveshell.py:3577 in run_code
exec(code_obj, self....
0
votes
1
answer
277
views
Get the best individual in each generation with DEAP
I learning genetic algorithms with DEAP and i want to animate how the best individual changes in each generation.
For it i use class Statistics and Multistatistics:
stats = tools.Statistics(lambda ind:...
0
votes
1
answer
289
views
Genetic Algorithms - Deap - eaSimple error
I am developing a simple genetic algorithm using Python and the Deap library .
At the end of all I am launching the eaSimple function to have the population evolved, but I keep having the following ...
1
vote
0
answers
78
views
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)):
...
0
votes
2
answers
316
views
Installing deap using pip
An exception occurs while installing a package using pip. I tried installing deap package.
How can fixed it?
\Local\Programs\Python\Python38>pip install deap
WARNING: Retrying (Retry(total=4, ...
0
votes
1
answer
638
views
Unable to import tpot
I tried to install TPOT as per http://epistasislab.github.io/tpot/installing/
I had trouble installing DEAP, so I had installed setuptools==58. Both tpot and DEAP installed.
After installation, when I ...
-1
votes
1
answer
156
views
Sympy changes the random seed
I am working on a python 3 project where I use deap and sympy.
I set the seed to a fixed value after I imported the random module in the main file.py that I execute in order to have a reproductible ...
2
votes
0
answers
534
views
I get an error when importing base from deap
When I try to import base from deap:
from deap import creator, base, tools
Traceback (most recent call last):
File ~\AppData\Roaming\Python\Python310\site-packages\IPython\core\interactiveshell.py:...
0
votes
1
answer
90
views
Use np.arange when generating a population with Deap?
Given this dictionary:
gene_space = [
{"name": "length",'high':110,'low':10,'step':10},
{"name": "emaLength",'high':34,'low':1,'step':2},
{"...
0
votes
1
answer
534
views
Converting a list type to individual type in DEAP library
I am using deap library to apply genetic algorithm (GA) in a problem. I am using tool.box to generate individuals (solutions) and population. Individuals have a type of list. In some generations of GA,...
0
votes
1
answer
1k
views
How to pass argument to "toolbox.population" in DEAP
I try to make a custom "individual" in DEAP. Reason is that individual is made of several explanatory variables. Each explanatory variable has lower and upper bound. Also, it may have step ...
2
votes
0
answers
824
views
How to use multiple mutation/crossover operators in DEAP python?
Is there a way in DEAP to use more than one mutation or more than one crossover with their own probability?
The algorithms expect 'mate' and 'mutate' to be registered in the toolbox.
I can technically ...
0
votes
1
answer
83
views
XOR MLP with GA, analysing graph with different crossover/mutation probabilities, what can be concluded?
Im rather new to GA's, but thought I'd give one a go. I've programmed a GA (using the Deap library) to replace back-propagation in my Multilayer perceptron. The goal was to find the best weights to ...
0
votes
1
answer
400
views
Why is deap multiprocessing method not faster?
I am using the DEAP framework to run a genetic algorithm and I am trying to speed it up using the multiprocessing module from deap :
import multiprocessing
pool = multiprocessing.Pool()
toolbox....
3
votes
2
answers
481
views
How can I select features for Symbolic Regression
How can I select features for Symbolic Regression ?
I have 30 features, I want to use only the most sensitive features for Symbolic Regression.
As an example, this dataset can be used which is similar ...
0
votes
1
answer
608
views
register multiple parameters to an individual using DEAP
I have to integrate DEAP into a bigger frame work.
For testing I defined:
from deap import base
from deap import creator
from deap import tools
from collections import *
import random
NAME = 0
TYPE = ...
1
vote
1
answer
181
views
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, ...
2
votes
0
answers
558
views
Creating a custom function to create individuals using DEAP
I am using DEAP to resolve a problem using a genetic algorithm. I need to create a custom function to generate the individuals. This function checks the values inside in order to append 0 or 1.
Now I'...
0
votes
1
answer
697
views
Going from non-linear root-finding to multi-objective optimization
To simplify, let's say I can describe a system with
variables x1 and x2,
parameters p1 and p2, and
constraints f(x, p) = 0 and g(x, p) = 0:
For example:
f(x1, x2, p1, p2) = x1^2 * p1 + x1^2 * p2 + x2 =...
1
vote
2
answers
466
views
DEAP evolutionary module, always evaluate entire population
I'm trying to solve a non-deterministic problem with DEAP. the problem is that the module only evaluate new chromosome and uses the score kept in memory for old ones.
How can i set the module, so at ...
2
votes
1
answer
275
views
Evaluate batch of individuals in Deap instead of one-by-one evaluation
I wonder if there is a way to evaluate batches of individuals when running deap ? The classic implementations evaluate individuals one by one but my evaluation function requires me to evaluate the ...
1
vote
1
answer
1k
views
Visualizing nested function calls in python
I need a way to visualize nested function calls in python, preferably in a tree-like structure. So, if I have a string that contains f(g(x,h(y))), I'd like to create a tree that makes the levels more ...
1
vote
1
answer
1k
views
Sphinx autodoc does not display all types or circular import error
I am trying to auto document types with sphinx autodoc, napoleon and autodoc_typehints but I am having problems as it does not work with most of my types. I am using the deap package to do some ...
1
vote
1
answer
2k
views
Python DEAP and multiprocessing on Windows: AttributeError
I have the following situation:
Windows 10
Python 3.7
deap 1.3.1
There is a main.py with
def main():
...
schedule.schedule()
...
if __name__== "__main__":
main()
Then, I also have a ...