NetLogo / NetLogo/GIS-Extension
NetLogo let target min-one-of neighbors math operation produced a non-number
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 36
- Forks
- 23
- PR merge metrics
- No merged PRs in 30d
Description
Hello, I am new to NetLogo, so I apologize if this is the wrong forum. I am trying to reproduce the following: https://github.com/YangZhouCSS/Pedestrian_Model_Krasnow. I know when I load the .nlogo it warns me that it was produced in 5.2 and I am using 6.3 so I may have to make changes for it to work. But, I am not sure what changes to make.
The error I get is:
math operation produced a non-number
error while patch -25 -58 running +
called by procedure GO
called by Button 'go'
It comes from the following line in the code:
let target min-one-of neighbors [ elevation + ( count turtles-here * 9999999) ]
Which is in the to go section:
`to go
if count turtles > 0 [set move-speed count turtles with [moved? = true] / count turtles]
if count turtles = 0 [stop]
ask patches with [exit = 1] [ask turtles-here[die]]
ask turtles [
set moved? false
let target min-one-of neighbors [ elevation + ( count turtles-here * 9999999) ]
if [elevation + (count turtles-here * 9999999)] of target < [elevation] of patch-here
[ face target
move-to target
set moved? true
ask target [set path path + 1]]
]
if Show_path? [ask patches with [elevation < 9999999][let thecolor (9.9 - (path * 0.15)) if thecolor < 0.001 [set thecolor 0.001] set pcolor thecolor]]
tick
end
`
I am looking at the .asc files and I see that the NAN value is -9999. I am thinking that the error arises because one of the neighbors is -9999. But, in the to setup section, I would have thought the "set-world-envelope" would prevent that.
I know this is not a bug so apologize again if this is the improper place to ask this question. I posted in StackOverflow here: https://stackoverflow.com/questions/74977284/netlogo-let-target-min-one-of-neighbors-math-operation-produced-a-non-number/74985127#74985127
I am trying to get this project to work as it is similar to something else I am trying to do.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by loading the linked .nlogo model in NetLogo 6.3 and reviewing the .asc elevation files alongside the setup and go procedures. Trace the min-one-of neighbors expression and compare the reported behavior with the linked Stack Overflow discussion; done means the non-number error and the required compatibility or data-handling change are clearly identified.
Written by the indexing model from the issue text.
Assessment
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100