
to surely and quickly jump to the exact same situation as when a previous simulation was interrupted. with the 'save-current-seed-as-custom' button and 'use-custom-seed?' switch, this allows the user

exact same ticks as when the 'save-current-ticks-as-custom' button was used. the user, after switching on the 'use-custom-ticks?' switch, to bring the simulation to the This procedure lets the user store the current 'ticks' value as 'custom-ticks'. If (use-custom-ticks?) AND (ticks = custom-ticks) 'save-current-ticks-as-custom' procedure above). manually by the user, or through the 'save-current-ticks-as-custom' button (see the which is set in the Interface in the input box. The custom-defined ticks value is retrieved from the 'custom-ticks' global variable, The first if-statement allows the user to bring the run to a custom-defined ticks value. To make things even more useful, the same logic can be applied to ticks: to jump exactly to the same point where the rare error occurred (maybe thousands of ticks after the start of the run), it is possible to combine the previous arrangement about seeds and the following arrangement for ticks: This will make it possible to reproduce the same run where a rare error occurred, just by saving that run's seed as the custom seed and switching on the switch. allow such value to be re-used after turning on the 'use-custom-seed?' switch in the Interface. 'random-seed' global variable see comment in 'manage-randomness') as 'custom-seed', which will This procedure lets the user store the seed that was used in the current run (and stored in the user wants to perform 'save-current-seed-as-custom'. only way to have such value displayed in the Interface, and re-use such value in case the having a global variable storing the value that will be passed to the 'random-seed' primitive is the In either case, this selection is mediated by the 'current-seed' global variable. the 'save-current-seed-as-custom' procedure below). can be defined either manually by the user, or through the 'save-current-seed-as-custom' button (see from the 'custom-seed' global variable, which is set in the Interface in the input box. In the latter case, the custom-defined seed is retrieved This procedure checks if the user wants to use a new seed given by the 'new-seed' primitive, or if
Netlogo codes code#
In order to avoid this problem, the following arrangement can be used (note that the code blocks only contain very few lines of code, the vast majority is only comments). If that is the case, even just reproducing the error can become time consuming. Some errors might occur only rarely (for example, every few hundred runs). Not a NetLogo feature, but an expedient I've devised recently.
Netlogo codes download#
This approach, instead, makes you able to reproduce the error after it occurred, potentially saving tons of time by letting you reproduce that rare run ex-post.įeel free to download this blueprint from the Modelling Commons if anyone finds it useful and wants to save the time to set it up. However, for rare errors, it is impractical to manually change random-seed (maybe a few hundred times) until you hit by chance a run in which the error appears.

Using random-seed is an ex-ante way to reproduce a run. NB: Note that this approach is not just a convoluted way to achieve the exact same benefit that using random-seed gives.
