JLW1808
JLW1808

Reputation: 106

division by zero when population size is 1 neat-python

Note: I submitted an issue on their GitHub, but looking at their GitHub, but it does not look like anyone will reply based on other issues submitted.

File "C:\Users\hunty\AppData\Local\RLBotGUIX\venv\lib\site-packages\neat\math_util.py", line 9, in mean
    return sum(map(float, values)) / len(values)
ZeroDivisionError: division by zero

When the population size of my model is set to 1, I receive a division by 0 error, when set to a number > 1, I don't get the error. I found a stack overflow page relating to this, but there was no solution.

Here is some of my code: config file (the portion that matters):

[NEAT]
fitness_criterion     = max
fitness_threshold     = 9999
pop_size              = 2
reset_on_extinction   = False

eval/fitness function:

def main(gnomes, config):
    global net, ge
    net = neat.nn.FeedForwardNetwork(gnomes[0], config)
    ge = gnomes[0]
    ge.fitness = 0

If you have a solution or need more code, please say so!

Whole Traceback:

 ****** Running generation 0 ******

Process Process-1:
Traceback (most recent call last):
  File "C:\Users\hunty\AppData\Local\RLBotGUIX\Python37\lib\multiprocessing\process.py", line 297, in _bootstrap
    self.run()
  File "C:\Users\hunty\AppData\Local\RLBotGUIX\Python37\lib\multiprocessing\process.py", line 99, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\hunty\AppData\Local\RLBotGUIX\venv\lib\site-packages\rlbot\setup_manager.py", line 655, in run_agent
    bm.run()
  File "C:\Users\hunty\AppData\Local\RLBotGUIX\venv\lib\site-packages\rlbot\botmanager\bot_manager.py", line 196, in run
    self.load_agent()
  File "C:\Users\hunty\AppData\Local\RLBotGUIX\venv\lib\site-packages\rlbot\botmanager\bot_manager.py", line 117, in load_agent
    self.agent = agent_class(self.name, self.team, self.index)
  File "C:\Users\hunty\AppData\Local\RLBotGUIX\MyBots\learnie\src\bot.py", line 40, in __init__
    run(config_path)
  File "C:\Users\hunty\AppData\Local\RLBotGUIX\MyBots\learnie\src\bot.py", line 30, in run
    winner = p.run(main)
  File "C:\Users\hunty\AppData\Local\RLBotGUIX\venv\lib\site-packages\neat\population.py", line 89, in run
    fitness_function(list(iteritems(self.population)), self.config)
  File "C:\Users\hunty\AppData\Local\RLBotGUIX\MyBots\learnie\src\bot.py", line 18, in main
    net = neat.nn.FeedForwardNetwork(gnomes[0], config)
TypeError: __init__() missing 1 required positional argument: 'node_evals'
uninitialized_bot error reading header: An existing connection was forcibly closed by the remote host

Upvotes: 1

Views: 293

Answers (0)

Related Questions