You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While debugging labyrinth_test.py, in the create_new_generation method in the Population class there is a problem with the following loop:
"""Secondly, we create the new generation with children being a result od selection and crossover operators
on the current population:"""
new_generation = Generation(size=self.no_parents_pairs * 2, fitness_function=self.fit_fun)
for pair in self.current_children[0].get('children'):
new_generation.add_member(genome=pair[0])
new_generation.add_member(genome=pair[1])
Error traceback:
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm 2023.2.4\plugins\python\helpers\pydev\pydevd.py", line 1535, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\JetBrains\PyCharm 2023.2.4\plugins\python\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:\Users\jg\PycharmProjects\pyqkd\genal\labyrinth_test.py", line 370, in <module>
main_pyqkd()
File "C:\Users\jg\PycharmProjects\pyqkd\genal\labyrinth_test.py", line 366, in main_pyqkd
test.run()
File "C:\Users\jg\PycharmProjects\pyqkd\genal\genetic_algorithm.py", line 317, in run
self.create_new_generation()
File "C:\Users\jg\PycharmProjects\pyqkd\genal\genetic_algorithm.py", line 263, in create_new_generation
for pair in self.current_children[0].get('children'):
~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
Fix it.
The text was updated successfully, but these errors were encountered:
While
debugging labyrinth_test.py
, in thecreate_new_generation
method in thePopulation
class there is a problem with the following loop:Error traceback:
Fix it.
The text was updated successfully, but these errors were encountered: