【问题标题】:rnd from a local variable来自局部变量的 rnd
【发布时间】: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


【解决方案1】:

我建议考虑将逻辑函数作为一种将相似性与概率相关联的方法。逻辑函数是一个“s”形函数,范围从 0 到 1,因为某个 X 值(例如,相似性)在很大范围内变化。例如,您可以通过假设哪些相似性值产生 10% 和 90% 的概率来定义逻辑函数。

Railsback and Grimm 2019, "Agent-based and Individual-based Modeling" 第 16 章对 NetLogo 模型中逻辑函数的使用和编程进行了完整的讨论。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-05-01
    • 2017-07-22
    • 2011-07-06
    • 2018-03-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多