2

.nlogo fileenter image description here

I am getting this error while running iterations using behavior space

The tick counter has not been started yet. Use RESET-TICKS.
error while observer running TICKS
called by procedure __EVALUATOR 

I am not sure why this is happening. I have included reset-ticks in the "set" routine.

In addition in the behavior space dialog wizard, i also included reset-ticks as the final command to be executed. Yet i am getting this error.

Below is my setup and go code:

to setup
  clear-all
  setup-citizens
  setup-parties
  update-support
  reset-ticks

end

to go
  ask parties [ adapt set my-old-size my-size ]
  update-support
  election
  plot-voter-turnout
  plot-volatility
  if (Turnout-100%? = false) [plot-citizen-comparison]

  tick

end
Raj
  • 1,049
  • 3
  • 16
  • 30
  • Would you post a screenshot of your behaviorspace configuration? – Bryan Head Mar 16 '16 at 15:29
  • @BryanHead: I have edited the questions with the screenshot. – Raj Mar 16 '16 at 15:47
  • I see `reset-ticks` as a final command. (Unneeded.) Are you sure it is in your `setup`, *before* any call to `tick`? What happens if you run `ca setup` at the command line? – Alan Mar 16 '16 at 16:17
  • @Alan: I have included the Setup and Go in the main question. I included reset-ticks in the final command to see if that would prevent the error but doesn't seem to be working. – Raj Mar 16 '16 at 16:27
  • Can you post setup-citizens, setup-parties, update-support functions? Do you call tick inside of these functions? Have you run a single trial without behavior space? I am not convinced that the behavior space is causing the problem. – mattsap Mar 16 '16 at 18:32
  • @mattsap: I agree, behavior space is not causing the problem. I tried running the iterations excluding one of the inputs and it is working for other combination of the inputs. So one of the values of the input variable seems to be causing the problem. But what i dont understand is why am i getting the above error? When or what causes a reset-ticks error – Raj Mar 16 '16 at 19:26
  • 1
    "When or what causes a reset-ticks error" — typically, using the `ticks` reporter before having called `reset-ticks`. As for why that's happening in your particular case, I think it must have to do with logic in parts of your code that you haven't shown us. Where are you using the `ticks` primitive? When you get the error, does it show what procedure it was called from? In posting only the bare text of the error message, you've omitted potentially useful information. – Seth Tisue Mar 16 '16 at 20:04
  • @SethTisue: I haven't used ticks or reset-ticks anywhere else other than the go and setup respectively. I didnt post the complete code here because its a little big and in the past when i have posted the code asking for help, usually there has been no response. – Raj Mar 16 '16 at 20:58
  • Also if there was something wrong in the code the model shouldn't run right? I have 72 combination which i am iterating 100 time each. So in total i have 7200 iterations, the model for 2800 iterations and then threw the error at 2801 run. There is no difference between the 2800 and 2801 run. Both have the same inputs. – Raj Mar 16 '16 at 22:31
  • are you using any extensions? – JenB Mar 17 '16 at 07:31
  • @JenB: No. I dont think so. I am pretty new to Netlogo. So i could be wrong but other than in-built functions i haven't used anything else. – Raj Mar 17 '16 at 12:49
  • do you have anything that could, for example, lead to a division by 0 error? Or perhaps you ask NetLogo to select from an agentset that is empty. Errors like this can lead to commands being skipped and that will create the error. Have a look at your output and see what the parameter values are, not just for the last run (the one that crashed), but also for the runs just before it. – JenB Mar 17 '16 at 13:22
  • The error literally says `observer running TICKS`, so it's impossible that your model doesn't call the `ticks` primitive somewhere. Try opening the `.nlogo` file in a text editor and searching for that string. It must be in there. NetLogo doesn't call that primitive of its own volition. Maybe it's in a plot, or in your BehaviorSpace experiment definition? – Seth Tisue Mar 17 '16 at 13:27
  • @SethTisue: I tried what you suggested. In the code section, i have used ticks only in the "Go" routine. Nowhere else. – Raj Mar 17 '16 at 13:35
  • @JenB: Yes there is patch-set and another variable which are used in a situation that you have described. I will track the values they take through the iterations to see if they are causing the problem. – Raj Mar 17 '16 at 13:37
  • @Yuvaraj post a link to the complete .nlogo file, with instructions for how to reproduce the error? – Seth Tisue Mar 17 '16 at 13:46
  • @SethTisue: I have posted the link at the top of the image. Please let me know if its not working. The experiment that i ran on behavior space should also be there. – Raj Mar 17 '16 at 13:56

3 Answers3

2

You are using ticks in your BehaviorSpace experiment's "stop condition", so I think it's nearly certain that's where the "error while observer running TICKS" error must be coming from, given that the stack trace doesn't refer to a procedure name.

Here's my best guess at what's going on here: under some conditions, your setup procedure fails, and therefore never reaches the call to reset-ticks at the end of setup. Then BehaviorSpace tries to run your stop condition, resulting in the error you see.

This guess has some problems:

  • Why BehaviorSpace would only be showing you the eventual ticks error, and not the error causing setup to fail, I don't know.

  • I have no idea why your setup procedure would be failing.

Nonetheless, that's the best I can offer you without doing a more in-depth investigation.

Seth Tisue
  • 29,985
  • 11
  • 82
  • 149
  • Thanks a lot for your help and time. I am not sure why it stopped but following your reply, i removed the ticks condition from the stop condition and though i am getting other errors, at-least the error pertaining to reset-ticks has stopped. – Raj Mar 17 '16 at 21:20
0

I was facing the same issue not too long ago. I'm pretty sure that the issue goes back to how Netlogo shares the global variables/states among the threads. I suspect that one thread starts the go procedure while another thread hasn't called the reset-ticks yet.

A temporary fix to this is to call reset-ticks if it hasn't been called already at the beginning of your go procedure.

carefully [let t ticks][reset-ticks]

0

For those people who found this question by searching for the error "The tick counter has not been started yet. Use RESET-TICKS." but are not actually using BehaviorSpace - the question (and therefore the accepted answer) does not apply to your situation. Instead, you have almost certainly forgotten to initialise the model before trying to run it, probably by hitting the go button without first hitting the setup button.

The reset-ticks command starts the tick counter (makes the internal clock available) so that the tick command can advance the clock. By convention, a procedure named setup has all the commands to initialise the model, including reset-ticks, creating turtles etc. Similarly, a procedure called go contains all the commands to actually run the model like moving turtles around, including tick. Also by convention, these procedures are run by pressing buttons named setup and go respectively.

JenB
  • 17,620
  • 2
  • 17
  • 45