Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cclauss opened this issue Nov 6, 2022 · 1 comment · Fixed by #8606
Closed

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

cclauss opened this issue Nov 6, 2022 · 1 comment · Fixed by #8606

Comments

@cclauss
Copy link
Member

cclauss commented Nov 6, 2022

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

@D4rkia
Copy link
Contributor

D4rkia commented Nov 8, 2022

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]:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants