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

KDTree bug #54

Closed
scottpdo opened this issue Jul 9, 2020 · 1 comment
Closed

KDTree bug #54

scottpdo opened this issue Jul 9, 2020 · 1 comment

Comments

@scottpdo
Copy link
Owner

scottpdo commented Jul 9, 2020

KDTrees occasionally enter an infinite loop when rebalancing.

Unfortunately it appears inconsistent, but probably has to do with specific agent positions and the median comparing them to. Can occasionally (rarely) be seen in the Flocking model: https://codesandbox.io/s/flocking-vw76q

@scottpdo
Copy link
Owner Author

scottpdo commented Jul 9, 2020

Whew, fortunately not an issue with KDTrees themselves, rather with the implementation of the Flocking model. When looking at a neighbor occupying the same position, the separation Vector got assigned an infinite value, which ends up resolving to NaN somewhere in the calculations... KDTree can't handle NaN values, so it threw up its hands and kept on trying to rebalance.

tl;dr not a library issue!

@scottpdo scottpdo closed this as completed Jul 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant