2016-07-07 100 views
0

我无法找到一种方法来解决这个问题......我有海龟创建一个社交网络(我使用无向链接)。Netlogo - 网络问题

代理有许多变量,其中“y”和“ro”。我想知道的是与海龟相连的海龟的平均[ro]与[y < 1] ...有没有办法?

在实践中...下面的公式

mean [ro] of turtles with [link-neighbor? turtle n]

我想,而不是turtle n代理设置turtles with [y < 1] ...是有办法吗?

谢谢!

回答

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