如何调用彼此连接的其他代理的属性

how to call properties of other agents who are connected to each other

问候,

假设,我有一个制造商和 10 个制造商的客户随机与其中一些创建链接(我称这些链接为 "contract-links")。

制造商的属性之一是 "real-cost",客户的属性之一是 "real-waiting-time"。 "real-waiting-time" 是一个明确的数字。此外,假设服务成本为全局变量。

要计算 "real-cost",我需要与制造商有联系的 "real-waiting-time" 客户的总和,然后乘以服务成本。

我这里有个问题要计算"real-cost"。我怎样才能调用所有客户的 "real-waiting-time" 然后计算制造的实际成本?

manufactures-own [ final-costs] 
customers-costs [ real-waiting-time] 
contract-links [ the-real] 

ask manufactures [ 
final-calculation-for-manufacture
] 

to final-calculation-for-manufacture
 let the-manufacture self
 let the-contract my-contract-links
 ask my-contract-links [
 set the-real [real-waiting-time] of end2 
 ]
 let the-sum sum [ the-real] of my-contract-links
 set final-cost the-sum * cost-service-slider
end

它给了我一个数字,但答案是错误的。

我认为您得到错误数字的原因是您在 link 的另一端对属性值进行了大量设置,而不是从 [=] 获取信息17=]。但是您的一般方法太复杂了 - 如果您创建了一个名为 contract-links 的 link 品种(您似乎拥有),那么这些 link 另一端的代理就是link 代理询问的邻居。尝试这样的事情。

manufactures-own [ final-costs] 
customers-costs [ real-waiting-time] 
contract-links [ the-real] 

ask manufactures
  [ let the-sum final-costs sum [real-waiting-time] of contract-links-neighbors
    set final-cost the-sum * cost-service-slider
  ] 
end

这假设您需要 linked 客户的等待时间总和。我无法弄清楚 the-real 属性对于 link 是什么。