CodeReclaimers / neat-python

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

Error when running LunarLander example - "Expected 8 inputs, got 2" #268

Closed amirest123 closed 1 year ago

amirest123 commented 1 year ago

I'm trying to run the included LunarLander example, using the evolve.py file and the associated config file. I have not modified either of these files but receive this error. The config file is set to 8 input nodes so somewhere along the line that must be changed or overwritten by other code. I've come across others having the same issue but haven't found a solution. Any help would be massively appreciated, thanks.

SoniaRaskolnikov commented 1 year ago

This seems to be caused by some changes in the OpenAI code that to have been addressed in PR #252, but for some reason, that PR's yet to be merged.

Quick Fix: Replace line 89 & 200 of evolve.py with observation, info = env.reset() (to fix your error) Replace line 100 & 218 of evolve.py with observation, reward, done, truncated, info = env.step(best_action) (to fix a similar error)

amirest123 commented 1 year ago

@SoniaRaskolnikov Thanks, that gets everything working as expected.