3

在我建立创新扩散模型的过程中,我在 NetLogo 中遇到了另一个小的编程问题。我想模拟人们更有可能向相似的人学习。因此,该模型考虑了分配给每个代理的能力值:

[set ability random 20 ] 

然后,在围棋过程中,我希望他们将自己的能力值与关联邻居的值进行比较。例如:乌龟1的能力= 5,邻居1的能力= 10,邻居2的能力= 4。因此(绝对)差异为[ 5, 1]。因此,他从邻居 2 那里学到的东西比从邻居 1 那里学到的更多。

但我不知道如何解决向每个邻居询问差异的问题。作为第一个想法,我想通过像 [difference1, ..., difference(n)] 这样的列表变量来实现。

到目前为止,我只得到了一种使用平均值的聚合方法,但这与最近的社会学习理论并不完全一致,并且可能会覆盖代理有许多不同邻居但与他非常相似的情况:

ask turtles
  [
    set ability random 20   
    set ability-of-neighbor (sum [ability] of link-neighbors / count link-neighbors) 
    set neighbor-coefficient (abs (ability - ability-of-neighbor))
;;the smaller the coefficient the more similar are the neighbors and the more the turtle learns from his neighbor(s)

]

再次感谢您的帮助和建议,我非常感谢您提出任何意见。

亲切的问候,

莫里茨

4

1 回答 1

3

我花了一些时间来了解您想要的东西,但这是一种对链接邻居进行排名的方法。

let link-neighbor-rank sort-on [abs (ability - [ability] of myself)] link-neighbors 

它按能力差异的升序生成链接邻居列表。

如果你只想要最近的邻居使用

 let best min-one-of link-neighbors [abs (ability - [ability] of myself)]

我希望这有帮助。

于 2016-01-07T22:22:56.153 回答