Skip to content
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

Investigate issue with reproduction after stagnation #8

Closed
AlexTheM8 opened this issue Jan 27, 2022 · 1 comment
Closed

Investigate issue with reproduction after stagnation #8

AlexTheM8 opened this issue Jan 27, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@AlexTheM8
Copy link
Owner

Occasionally, the NEAT reproduction will fail after removing stagnated species. The crash happens at the following code in genome.py line 110, get_new_node_key:

    def get_new_node_key(self, node_dict):
        if self.node_indexer is None:
            self.node_indexer = count(max(list(iterkeys(node_dict))) + 1)

        new_id = next(self.node_indexer)

        assert new_id not in node_dict

        return new_id

One fix would be to loop as follows:

        if self.node_indexer is None:
            self.node_indexer = count(max(list(iterkeys(node_dict))) + 1)

        new_id = next(self.node_indexer)
        while new_id in node_dict:
            new_id = next(self.node_indexer)

        assert new_id not in node_dict

        return new_id

But this is editing the library and will not remain as a global fix. Investigate why this happens before asserting the library needs to be fixed.

@AlexTheM8 AlexTheM8 added the bug Something isn't working label Jan 27, 2022
@AlexTheM8 AlexTheM8 self-assigned this Jan 27, 2022
@AlexTheM8
Copy link
Owner Author

Since implementing the "fix" and restarting evolution, this has not been a noticeable issue. This could have been a config issue. Next evolution will involve removing this "fix" and seeing what happens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant