Data Structure for Spatial Agent Based Modeling [closed]

天涯浪子 提交于 2019-12-09 11:49:52

问题


What are some good data structures for keeping track of agents in a two-dimensional, spatial simulation?

I've seen some references to quadtrees (which I understand) and kd-trees (which I don't understand very well).

I'm looking for something through which an agent can efficiently 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 is fine) would be greatly appreciated.

I'm working in Java.


回答1:


Well, I'm not sure exactly how it is implemented, but the MASON toolkit uses a discretization algorithm that places agents that are close to one another in the same "bucket" of a hash table. It makes for very fast lookups, as only a few of these buckets have to be checked for each query.

The best thing for you 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:


I have found something called a Bucket PR Quadtree.



来源:https://stackoverflow.com/questions/7810928/data-structure-for-spatial-agent-based-modeling

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!