Netlogo 要求一个代理集从另一个代理集获取值

Netlogo 要求一个代理集从另一个代理集获取值,netlogo,agents,Netlogo,Agents,我的卖家使用以下代码设置交易价格: ask buyers [ ask sellers [if any? buyers-here [ if seller_Price <= [buyer_Price] of myself [ set trade_Price seller_Price + random ([buyer_Price] of myself - seller_Price) ]]]] 我认为这是错误的代码,因为我从我的代理夫妇那里得到了不同的交易价格。 你知道我怎

我的卖家使用以下代码设置交易价格:

ask buyers  [ ask sellers [if any? buyers-here [ if seller_Price <= [buyer_Price] of myself 
       [ set trade_Price  seller_Price + random ([buyer_Price] of myself - seller_Price) ]]]] 
我认为这是错误的代码,因为我从我的代理夫妇那里得到了不同的交易价格。 你知道我怎么设置吗?
最好的结果

据我所知,你正在尝试这样的东西:

ask buyers [
  let candidate one-of sellers-here
  if candidate != nobody [
    set trade_Price [trade_Price] of candidate
  ]
]
请注意,在这一点上没有询问卖家的
。您只希望每个买家每次通过
go
运行一次


请注意,如果补丁上有多个卖家,
这里的一个卖家随机挑选一个。

谢谢,它运行:)我还有一个问题。在一些补丁中,我有“孤独的”卖家没有买家或孤独的买家没有卖家。在本例中,我对其进行编码,使其交易价格为0。在图中,我想显示交易价格。我的代码是这样的:plot是指海龟的[trade_Price],它会计算0或0的trade_Price吗?我希望它只计算>0的交易价格。如何在绘图中编码?如果我的答案有效,那么您可以通过接受它来感谢我(使用它旁边的大复选标记)。要问一个新问题,请打开一个新问题。我在90分钟内只能问一个问题:(
ask buyers [
  let candidate one-of sellers-here
  if candidate != nobody [
    set trade_Price [trade_Price] of candidate
  ]
]