Closed MaxvEck closed 3 years ago
thanks for posting.
It seems that the relevant underlying java code that was used for this is not present. The R approach is not ideal, however, because it relies on doing the repeat loop in java, which is about 10 times slower than pushing it all the way into netlogo itself.
My preferred solution would be to build, in python, a string with the equivalent netlogo code for repeat while. My knowledge of logo, however, is rather limited so suggestions are welcome.
As I am not entirely sure how python is connected, i do not know for sure what is and isn't possible/efficient.
If we look at the parameters that the original function took, we can use that as a blueprint.
The netlogo while function (https://ccl.northwestern.edu/netlogo/docs/dictionary.html#while), would potentially be useful for creating this function. I suggest the code to work like this:
to doReportWhile reset-timer ifelse max_seconds = 0 [while [condition] [ command ]][ while [condition and timer < max_seconds][command]]] end
and then reporting the netlogo-reporter, preferably similarly to repeat_report, where multiple netlogo reporters can be given in a list of strings, but if that is too complicated just the single reporter is also already great.
I hope this is of any use to you.
A quick update: I have a working fix on my machine. I hope to finalise testing it over this long weekend and have it available on pip later this week.
Oke great, thanks for working on it so quickly!
Apparentl, the fix is still pending for NetLogoLinkV5
. Are there any plans on porting it?
WARNING: All illegal access operations will be denied in a future release
Traceback (most recent call last):
File "/abm_analysis.py", line 27, in <module>
main(netlogo_directory, version, netlogo_model)
File "/abm_analysis.py", line 19, in main
run_simulation(netlogo_link)
File "t/abm_analysis.py", line 7, in run_simulation
condition="evacuation-finished?")
File "/lib/python2.7/site-packages/pyNetLogo/core.py", line 389, in report_while
result = self.link.doReportWhile(command, netlogo_reporter, condition, max_seconds)
AttributeError: 'NetLogoLinkV5.NetLogoLink' object has no attribute 'doReportWhile'
I do not have specific plans to backport this for netlogo 5.x. Are there very specific reasons for needing this functionality in combination with netlogo 5.
@quaquel I'm tweaking an old-model developed for Netlogo 5. But I think I found a workaround for getting the info I need using repeat_report
:)
Dear devs,
When I try using the Report_while function as documented it gives me the following error:
So it looks like the doReportWhile function is not implemented correctly in version 6.1. I found some R equivalent code of how this function has been implemented as well: https://rdrr.io/cran/RNetLogo/src/R/NLDoReportWhile.R
It would be of great help if this issue can be resolved. Thanks in advance!