NetLogo:向 link-neighbors 询问滴答计数器值
NetLogo: ask link-neighbors for a tick-counter value
目前我正在研究一个关于社交网络中成功创新扩散的基于代理的模型。到目前为止,我是基于代理的建模和编程的新手。
主要思想是模拟农民之间的社会学习,因此代理人决定采用创新主要取决于他的个人网络,这意味着如果他有良好的人脉关系并且他的邻居成功地使用了创新,他会更多如果他在网络中位于远程位置,则可能会采用。
除了关于社会学习的网络相关论点之外,我想实现一个时间维度,例如,代理人的邻居成功使用创新的时间越长,代理人也越有可能采用创新。但这正是我目前陷入困境的地方。我的目标是实现以下论点。到目前为止,伪代码如下所示。
1) 海龟自己的滴答计数器
...
ask turtles
[
ifelse [adopted? = true]
[set ime-adopted time-adopted + 1] [set time-adopted 0]
]
...
2) 在第二个过程中,每个代理人应该检查他的邻居使用这项创新的时间(根据 "check time-adopted of neighbors")。
ask turtles with [not adopted?]
[
[ask link-neigbhors with [adopted?]
[...*(Here I dont know how to ask for the time adopted value)*]
;the agent will then sum up all values he got from his neighbors from "time-adopted"
set time-neighbors-adopted [sum all "time-adopted" values of neighbors]
]
;The agent will then implement these values into his personal utility
;function which determines if he adopts the innovation or not
set utility utiltiy + 0.3 * time-neighbors-adopted
]
非常感谢您的帮助和建议。
亲切的问候,
莫里茨
要计算邻居采用创新的时间总和,您只需要一行,因为 Netlogo 太棒了。
set time-neighbors-adopted sum [time-adopted] of link-neighbors with [adopted?]
那样
目前我正在研究一个关于社交网络中成功创新扩散的基于代理的模型。到目前为止,我是基于代理的建模和编程的新手。
主要思想是模拟农民之间的社会学习,因此代理人决定采用创新主要取决于他的个人网络,这意味着如果他有良好的人脉关系并且他的邻居成功地使用了创新,他会更多如果他在网络中位于远程位置,则可能会采用。
除了关于社会学习的网络相关论点之外,我想实现一个时间维度,例如,代理人的邻居成功使用创新的时间越长,代理人也越有可能采用创新。但这正是我目前陷入困境的地方。我的目标是实现以下论点。到目前为止,伪代码如下所示。
1) 海龟自己的滴答计数器 ...
ask turtles
[
ifelse [adopted? = true]
[set ime-adopted time-adopted + 1] [set time-adopted 0]
]
...
2) 在第二个过程中,每个代理人应该检查他的邻居使用这项创新的时间(根据 "check time-adopted of neighbors")。
ask turtles with [not adopted?]
[
[ask link-neigbhors with [adopted?]
[...*(Here I dont know how to ask for the time adopted value)*]
;the agent will then sum up all values he got from his neighbors from "time-adopted"
set time-neighbors-adopted [sum all "time-adopted" values of neighbors]
]
;The agent will then implement these values into his personal utility
;function which determines if he adopts the innovation or not
set utility utiltiy + 0.3 * time-neighbors-adopted
]
非常感谢您的帮助和建议。
亲切的问候,
莫里茨
要计算邻居采用创新的时间总和,您只需要一行,因为 Netlogo 太棒了。
set time-neighbors-adopted sum [time-adopted] of link-neighbors with [adopted?]
那样