Reputation: 881
I have a Netlogo model that sometimes causes an error at setup, because just by chance, there are not enough turtles within a set radius to select X of them. When I'm at the computer I just hit setup again and keep going.
When using behavior space, what will happen when it hits one of these errors please? It seems to ignore it and move on but still record the run in the output.
Upvotes: 1
Views: 306
Reputation: 30498
I like Alan's answer. But also, if you just want the failed setup to be retried, you might consider changing your setup commands from:
setup
to something more like
let done? false
while [not done?] [
carefully [
setup
set done? true
] [ ]
]
Upvotes: 1
Reputation: 9620
The documentation suggests that the experiment will be interrupted: http://ccl.northwestern.edu/netlogo/docs/behaviorspace.html
But in any case, good programming practice in any case will prevent such possible runtime errors. E.g., to try and get 2 partners in-radius 1 for each turtle:
to-report select-partners ;turtle proc
let candidates (other turtles in-radius 1)
if (2 < count candidates) [
set candidates (n-of 2 candidates)
]
report candidates ;may be an empty agentset!
end
Upvotes: 1