logoalt Hacker News

karmakurtisaaniyesterday at 10:14 PM1 replyview on HN

> Yes, some parts are inherently O(n²) (mate finding, crowd density, predator/prey proximity, pathogen spread). Ecology needs pairwise relationships.

You might be able to do a bit better for some of these, check this out https://en.wikipedia.org/wiki/N-body_simulation

Essentially the idea in some optimizations is to divide the space into cells, and so you can discard relations with elements in far away cells.


Replies

senfiajtoday at 12:39 AM

Could use quad trees, or similar bucketing. But I think he already stated that he tried to avoid the processing of long distance pairs. So probably he does some localized bucketing. Personally, I don't even fully understand what his simulation is doing. There are tradeoffs between accuracy / performance, depending on the specific problem. So hard to judge here.