我无法找到解决这个问题的方法......我有海龟创建社交网络(我使用无向链接)。
代理商有很多变量,其中包括“y”和“ro”。我想知道的是与海龟有关的海龟的平均[ro] [y< 1] ......有办法吗?
在实践中......在以下公式中
mean [ro] of turtles with [link-neighbor? turtle n]
我想代替turtle n
代理商设置turtles with [y < 1]
......有办法吗?
谢谢!
答案 0 :(得分:3)
turtles-own [y ro]
to test
ca
crt 50 [
set y random-float 2
set ro one-of [1 2]
]
ask turtles [
create-links-with n-of 5 other turtles
]
show mean [ro] of (turtles with [has-poor-neighbor])
end
to-report has-poor-neighbor ;turtle proc
report any? link-neighbors with [y < 1]
end