【发布时间】:2020-03-19 12:46:17
【问题描述】:
我正在尝试编写一个代码,其中协作成功的概率越高,代理越相似。每次运行时,局部变量都会计算代理之间的差异,并在差异不超过阈值时创建代理之间的链接。代理随后根据是否创建链接存储在 2 个单独的列表中。现在,我想创建另一个列表,其中包含创建链接的每个代理的成功与不成功值。该值“成功”的概率越高,代理越相似(它们的差异值越接近 0)。
我最接近实现这一点的是 rnd 扩展。但是,在我看来,rnd:weighted-one-of 仅将代理集或列表作为输入,并且我没有针对代理相似性的预定义列表。我希望与局部变量进行比较的是 0(完全相似)和 1(不相似)的整个范围。以我目前的想法,这可能吗?
let difference 0
let initiator one-of turtles
ask initiator [
let potential one-of other turtles
if random-float 1.0 <= [my-activation] of self [ ;; different probability
set difference [my-profile] of self - [my-profile] of potential] ;; of initiating
;; collab
ifelse difference <= threshold [ ;; if threshold is met
create-link-with potential ;; link is initiated
set collaborators fput potential collaborators][ ;; the initiator adds the
set failures fput potential failures] ;; potential to their list of
;; either collaborators
【问题讨论】:
-
不需要
rnd扩展名。请修改您的问题以指定(1)如何计算两只乌龟的相似度,以及(2)相似度和成功概率之间的数学关系是什么。同时删除所有关于rnd扩展的东西。
标签: list netlogo local-variables