-
Notifications
You must be signed in to change notification settings - Fork 25
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
nw:turtles-on-path-to much slower and more resource hungry than old network:link-path-turtles #79
Comments
Thanks for reporting. I'm investigating the issue, but I'm not sure yet what is going on. Would you mind sharing your test code? I can probably replicate something similar, but it would help to have the same test case. |
curious about this one |
The time to build the snapshot is significant, but that should be helped by having I did some profiling, but could not find any other obvious bottlenecks. The main issue, I think, is that for some graphs, BFS (used in the old extension) may simply perform better. Different implementations of Dijkstra's algorithm may have different time complexities. I'm currently using Jung's implementation, which claims to be O(|E| log |V|). BFS is O(|E| + |V|), so it seems like a superior choice when it's possible to use it (it only works with unweighted graphs.) Is that all there is to it? I'm not entirely sure. I'll see how much @qiemem also suggests implementing A* (#81) and I am all for it, but neither Jung nor JGraphT provides it, so we'd have to bring in another lib or implement it ourselves. |
Here is a profiling test for this:
As of 10641a0, for an 80 × 80 lattice, on my laptop, we get:
And for 500 × 500 (i.e., 250000 turtles and 499000 links):
The remaining discrepancy might be explainable by the randomization introduced for #82, or maybe just by the general overhead of |
Used nw-ext-beta 0.02 and NetLogo 5.04
Replicating patches and neighbors*8 with turtles and links to use pathfinding in an 80 * 80 lattice. Times given are averages to find a random path over 100 paths using profiler extension.
13ms: network:link-path-turtles (average over 100 random paths)
23 seconds: nw:turtles-on-path-to for the first path found after snapshot
49ms: nw:turtles-on-path-to average over 100 paths after initial path was found
network:link-path-turtles can find paths in lattices over 600 * 600 before a Java heap overflow in creating over 5 million turtles and links.
finds a path in a 500 * 500 lattice in 2 seconds.
nw:turtles-on-path-to previously froze on a 100 * 100 lattice (with Netlogo 5.03), but now handles 150 *150 before freezing, albeit taking over 5 minutes to find the first path.
The text was updated successfully, but these errors were encountered: