Dear community,
we are creating a model that uses rasters and shapefiles (using NetLogo’s GIS extension). The SETUP button uploads these raster and shape files, which are quite heavy and they take some time to upload. When we run experiments in Behaviorspace, the SETUP uploads this files for each experiment. Is there a way to run experiments WITHOUT loading raster files for every repetition? Thank you very much.
Hi,
Welcome to the forum.
I think it may be possible by using Pre Experiment Commands
. The attached model shows how that capability can be used to open an external file that each run is aware of. If you have questions about how to do that it would be helpful if you could supply a model that loads a smallish set of files in setup that I could work with.
Wolf Sheep Predation with Timing.nlogo (42.5 KB)
- Aaron
Hi–We addressed exactly this issue in our article on speeding up NetLogo models, which is here:
with updates here:
https://www.railsback-grimm-abm-book.com/jasss-models/
The article section “Avoid unnecessary re-initialization” describes a way to re-organize the setup process so multiple model runs can run without re-loading the GIS files. Send me a message if you want example code.
The problem with our method is that it only works if all the BehaviorSpace runs are executed sequentially on only one processor. It does not work if you run the experiment on multiple processors. The only way to take advantage of this approach and multiple processors is to run completely independent BehaviorSpace experiments in separate NetLogo instances.
Because of that problem, I no longer use that approach. Even if it takes 5 minutes to set up each run, it’s easier and faster to set up and run one BehaviorSpace experiment that uses many processors (if there is enough memory for them all).
Steve R.
OK, now Aaron Brandes of the NetLogo team explained to me the new BehaviorSpace features “Pre experiment commands” and “post run commands”. Those run code once before all the separate model runs start and (presumably) whatever that code creates will persist until the start of each run.
I have not tried it yet but you should be able to write a procedure that loads your GIS files, and execute it as a pre-experiment command. Then the guidance in our JASSS article should be useful for modifying your setup procedure so it does not clear the GIS input: don’t use “clear-all” but instead clear the turtles and anything else that wasn’t read in from GIS.
Dear Aaron and Steve,
thank you very much for your warm welcome and for your quick answers and disposition! We are going firstly to try your approaches by ourselves. If we have more questions or need an example code, we will be back to you with pleasure.
Thank you very much again.
Yours truly,
M.