3

I remember that there used to be a button for "halt" in NetLogo, and no more in v.5.1.0.

So there is a need to click menu > tools > halt, which is quite cumbersome.

While debugging a model I get to do this a lot, in order to stop a forever button.

So perhaps any of you know how to make a button for "halt", or a keyboard shortcut for that, or some other one-click method to stop everything right this moment?

Btw, pressing again the forever button is not doing what I have in mind (it takes much longer than "halt").

So am I missing something?

Thanks.

Best, M

Lizardie
  • 200
  • 1
  • 11
  • 1
    It sounds like you might be misusing forever buttons. Typically, halt should only be required if you have a bug in your code that causes an infinite, or unintentionally long-running loop. If your forever button calls `go`, a single call to `go` should be a single step in your simulation. For most simulations, this takes only a couple milliseconds. Does your simulation involve more than 10,000 turtles? – Bryan Head Dec 15 '14 at 19:57
  • My model has animals, foraging an feeding in a heterogeneous background. Duration of a proper run is one night. Perhaps you a right about the misusing part. My go calls one step each tick, and there is no infinite loop inside. I tried e.g. with 30 turtles. – Lizardie Dec 17 '14 at 08:26
  • It runs ok. However there is a least-cost-path searching for each turtle to its current target, using A* algorithm. It's normally fast, but if the turtle chose a far target it becomes a long wait. It runs every time a turtle changes target, not each step. So for debugging i've been running the model and watching it work and checking its behaviour. Perhaps you a right about the misusing part. I've been using halt when I don't want to wait till the night's end and one of the turtles chose a far target and everybody stands in place and waits until it decides where/how to go. – Lizardie Dec 17 '14 at 08:35
  • 1
    Ah, I see. That definitely makes sense. For debugging, you could either make your world smaller or limit the distance of the target (just with `in-radius`) to make sure it doesn't take too long. – Bryan Head Dec 17 '14 at 18:11
  • 1
    Since the need to Halt comes from the fact that there are many steps that the code takes in each tick, would it be possible to spread the search process over several ticks? This might be bad for making your code easy to understand and modify, though. Or I wonder whether it would be possible to periodically check whether a Switch element has been changed, and abort in that case. – Mars Dec 18 '14 at 05:55
  • Oh, that's a good idea I guess. I'll try... (the switch, and making the world smaller) – Lizardie Dec 18 '14 at 11:25

1 Answers1

3

Unfortunately there's no such button. Maybe someome could try to edit the source code and add a button, but I doubt it since having to use Halt it's often because you have an infinite loop in your model. Good luck!

David Merinos
  • 1,195
  • 1
  • 14
  • 36