CodeReclaimers / neat-python

Python implementation of the NEAT neuroevolution algorithm
BSD 3-Clause "New" or "Revised" License
1.41k stars 490 forks source link

Fixed ZeroDivisionError if pop_size is set to 1 #224

Closed vaknin closed 2 years ago

vaknin commented 3 years ago

There's currently a bug where if the population size is 1, neat will raise a ZeroDivisionError exception.

Adding the following check to 'species.py' fixes that: if len(population) > 1:

In addition, changing the config parameter in 'reproduction.py' from 2 to 1.