Data structure for spatial agent modeling

What are some good data structures for tracking agents in two-dimensional spatial modeling?

I saw some references to quadrants (which I understand) and kd trees (which I don't understand very well).

I am looking for something with which an agent can effectively say: "I know my location, and I would like to know which agents are near me (within a certain radius of myself)."

Examples (pseudo code in order) would be appreciated.

I am working in Java.

+6
source share
2 answers

I found something called the Bucket PR Quadtree .

+2
source

Well, I don’t know exactly how this is implemented, but the MASON toolkit uses a discretization algorithm in which agents close to each other in the same β€œbucket” of hash table. It provides a very fast search, since for each request you need to check only a few of these buckets.

Your best bet is probably to take a look at the source code here: http://code.google.com/p/mason/source/browse/trunk/mason/sim/field/continuous/Continuous2D.java?r=529

+2
source

Source: https://habr.com/ru/post/899540/


All Articles