Skip to content

NetLogo let target min-one-of neighbors math operation produced a non-number #47

@jmstadt

Description

@jmstadt

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions