Python icon indicating copy to clipboard operation
Python copied to clipboard

genetic_algorithm/basic_string.py: select() is not binding population_score

Open cclauss opened this issue 2 years ago • 1 comments

Repository commit

master

Python version (python --version)

Python 3.11.0

Dependencies version (pip freeze)

None

Expected behavior

@D4rkia Can you please examine line 132 of genetic_algorithm/basic_string.py and remove the flake8 BugBear B023 linter directive and then fix the failing test?

@CaedenPH and I have been looking at this error but we are not sure how it should be fixed.

Actual behavior

Error B023

cclauss avatar Nov 06 '22 15:11 cclauss

I think we should simply move the evaluate, select, crossover and mutate functions out of the while loop, and pass population_score as an argument to the select function.

Something like this: def select(parent_1: tuple[str, float], population_score: list[tuple[str,float]]) -> list[str]:

D4rkia avatar Nov 08 '22 11:11 D4rkia