Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NetLogo Debugging

NetLogo being interactive makes debugging easy, but I yet to find any tools available for setting breakpoints and stepping through code. Please guide me if such exist. Or I can achieve the same with the current setup available.

like image 481
Abhishek Bhatia Avatar asked Aug 25 '15 12:08

Abhishek Bhatia


4 Answers

I am not aware of such a tool if one exists. For debugging I use meaningful print statements. First I make a switch as a global parameter to set the debug mode on and off, then I add a statement to each method that prints which method updates which variable and in which order they were called (if debug mode is on).

I also use profiler extension which shows how many times each method was called and which one is the most or least time consuming one.

like image 60
Marzy Avatar answered Nov 17 '22 02:11

Marzy


Not existing currently. Still, you can use one of the alternatives from above or you might take a look at user-message (https://ccl.northwestern.edu/netlogo/docs/dictionary.html#user-message), which will pop up a dialog. This will also block the execution at that step, although not providing you with a jump-to-next-line mechanism, for me this solution proved to be the best.

like image 3
iusting Avatar answered Nov 17 '22 02:11

iusting


Another possibility is to do the debugging in any modern browser if/when NetLogo Web produces source maps. This way one can set breakpoints in the NetLogo code and use Chrome or FireFox or IE11's developer tools on the NetLogo code.

like image 2
ToonTalk Avatar answered Nov 17 '22 02:11

ToonTalk


I have used user-message and inspect together as the debugging tool for NetLogo. Here is a video demo on how to use them to identify the cause of an error.

  • the reason for using inspect is to examine all properties of an object when we are not sure where exactly went wrong
  • using user-message to print out some instruction, output some outcome and halt the program
like image 1
Daniel Avatar answered Nov 17 '22 03:11

Daniel