Dear Netlogo community,
I have created a simulation enviornment on Netlogo, which runs around 35000 ticks. It takes around 70 to 80 mins to execute completely. I am facing some errors at the end of simulation (near 25000 ticks). Now I am debugging program by using print command. simulation takes 45 to 50 mins to reach to the desired tick (a ticks that creates problem). Is there any fast way in Netlogo by using which i can reach to the desired tick quickly.
As JenB suggests, use the export-world and import-world primitives to save and restore world state. Or use the equivalent menu items of the same names on NetLogo's File menu.
Related
I'm working on a model in Netlogo and I'm having a problem understanding how to set up an "experiment". In my model, I have a matrix that has all of the values that I'm interested in (6 in total) and the matrix is updated whenever a condition is met (every time X turtles are killed off) basically capturing a snapshot of the model at that point. The previous values in the matrix are cleared, so the matrix is a 1x6, not a 10000x6 matrix with only one line being updated for each snapshot.
What I would like to do is to set up an experiment to run my model several hundred times, collecting this matrix each time for the first X number of snapshots or until Y ticks have occurred. But I can't see a way to do that in the experiment setup?
Is this possible to do, or would I have to create the 100x6 (100 snapshots) and then just export that matrix to a CSV somehow?
I've never set up an experiment in Netlogo, so this might be super easy to do or just be completely impossible.
If I understand your question correctly, then you want 6 values reported at specific ticks during the run. Those ticks are chosen by meeting a condition rather than a certain number of ticks. NetLogo has an experiment management tool called BehaviorSpace. It is straightforward to set up your several hundred runs (potentially with different values for any inputs on sliders etc). It's not so straightforward to only output on certain ticks.
The BehaviorSpace dialogue box has a checkmark for every tick or at the end only. If you have it set to every tick, then you can export your six numbers every tick automatically. In your case, it is likely to be easier to do that than to try and only output occasionally. You could add a seventh reporter that is true/false for whether the matrix is being reset this tick. Then all you have to do in post-processing is select the lines where that seventh reporter is true.
If you want to run the model for exactly N snapshots, then you would also need to set up a global variable that is incremented each snapshot point. Your BehaviorSpace settings would then use that counter for the stop condition.
I'm not sure I understand your question, but usually you will have a Setup function and a Run function, correct? So I'm guessing the code structure below should be kind of what you are looking for. I haven't used netlogo in a while so the exact matrix code you'll have to figure out yourself.
globals your-1by6-matrix your-100by6-matrix
to setup
;reset your experiment
end
to run
;run your experiment
end
to run100times
repeat 100[
setup
run
;save your 1by6matrix into your 100by6matrix
]
;use your 100by6matrix to plot or export
end
I am trying to run a 1 ns simulation using VMD/NAMD on top of my 200 ps simulation, so I set the program to run 800000 with a timestep of 1. However, the next day (it took about 12 hours) it was complete, but I only had ~16500 frames. Anyone know why the program only collected so many frames? I have a similar issue with running different simulations: the amount I ask it to run and the number of frames I get are not the same.
I want to record data while running Behavior Space once within a given period, e.g. once per 1000 ticks. I see that Behavior Space can call reporters once per tick or once at the end of the simulation run. However, I do not want to record once per tick, because that produces too much data, but I also don't want to just have data at the end of the simulation. I cannot change the simulation time represented by tick because of numerical stability. I tried putting code into Behavior space, i.e.
if ticks mod 1000 = 0 [reporter]
but this gave an error ("Syntax, expected reporter") when I started the experiment. Is there a way around this issue, or am I stuck with gathering too much or too little data? Thx.
In your "Go commands", put repeat 1000 [ go ] instead of just go. That way, each "step" is actually 1000 ticks, so recording the data each step records it once every 1000 ticks.
I'm currently modelling the dynamics of an ice sheet. I therefore made a script that plots the volume of an ice sheet throughout time (in steps of 500 years). The volume increases rapidly at first, but the curve flattens later on as the volume does not change anymore and the ice sheet is in steady state... its shape is familiar like y=ln(x)... I thus have 2 output arrays, namely a) vol_time with the time in steps of 500 years and b) vol with the corresponding volume. Now, the program runs until a fixed time that I inserted (200 000 years) but I want to run the program only until this steady state is reached. So my question is: how can I make the program run only until the volume changes with only 0.002% per 500 years?
Thanks
You can ether wrap your ice-sheet thickness calculation in a while loop so the code performs the calculation until the 0.0002% condition is met or you loop through the whole 200.000 years.
Another option could be to add a if check end the end of your ice-sheet thickness calculation and if you enter and then add break in the if, this way the loop terminate.
There are 5000 milliseconds in 5 seconds. So if I run this code in Netlogo during that time:
every 0.001 [
some-calls-in-the-middle
tick
]
I expect to get 5000 ticks, but I'm getting no more than 150. Is there any way to map ticks to seconds more efficiently?
Presumably whatever computation you're doing in some-calls-in-the-middle is taking approximately 1/150 second for NetLogo to perform.
every is only useful for making a snippet of code run less often — never for making it run more often. (It might help to give the dictionary entry for every a careful read.)