Reputation: 21
I have a GIS city landscape which I have loaded into Netlogo that populates my landscape with a number of variables. One of these is a ID that indicates which land parcel each Netlogo patch belongs to. I am trying to create a visualization procedure that updates the color of all of the patches within a parcel (i.e. share ID) depending on their resource usage throughout my simulation.
The problem I am running in to is finding an efficient way to do this at high spatial resolution. My landscape is currently 400x400 patches and I would prefer to increase that but the procedures I have attempted are slow at even this resolution. Here are the 3 methods I have currently attempted:
Querying all patches and updating colors independently e.g.
ask patches [ set pcolor scale-color 5 mywateruse maxwateruse minwateruse]
Creating a single patch that is a parcel representative asking it to run through a procedure similar to above and then getting it to ask patches that share it's ID to change their color e.g.
ask patches with [parcelrep? = true] [set pcolor scale-color 5 mywateruse maxwateruse minwateruse]
ask other patches with [parcelID = [parcelID] of myself] [set pcolor [pcolor] of myself]
I also attempted modifying the "Patch Clusters Example" in the Netlogo modelling library to run code that would assign each patch to an patchset based on shared IDs and then update colors of these clusters. Although this would likely improve the speed of the 'backend' of the simulation (i.e. changing the colors of patches) the clustering procedure in the setup took a number of hours to run on its own.
Any help with finding a more efficient way to do this would be greatly appreciated.
Upvotes: 2
Views: 79
Reputation: 30453
I set up a 400x400 world (count patches
= 160000) and timed how long your variant #1 takes to run on my MacBook Pro:
observer> reset-timer ask patches [ set pcolor scale-color 5 mywateruse 10 0] print timer
0.04
That's 1/25 a second. That's "extremely slow"? It seems unlikely this could be the worst speed bottleneck in your model.
Upvotes: 2