在链接的另一端询问海龟最小变量

时间:2015-07-01 15:48:19

标签: netlogo

我目前正在解决一个问题,即我有两个代理商集:买家和卖家以及卖家与买家挂钩。我的问题是:如何要求买家选择卖家变量(价格)的最小值。

example of the links and agentsets

我以为我可以通过以下原语来实现:

ask buyers with [count my-in-links > 1][
    min-one-of price of other-end ;; something like this, this don't work obviously just wanted to show you my idea.
]

或:

ask buyers with [count my-in-links > 1][
     if min-one-of in-link-neighbors of in-link-neighbors price  < 1[
       set color yellow
     ]
  ]

谢谢。

1 个答案:

答案 0 :(得分:1)

我猜你需要这样的东西:

... min-one-of in-link-neighbors [price]
例如,如果您想将最便宜的卖家作为代理存储在变量中:

ask buyers with [count my-in-links > 1][
  let cheapest-seller min-one-of in-link-neighbors [price]
]

或者您可以直接访问此卖家的价格,例如将其存储在变量中:

ask buyers with [count my-in-links > 1][
  let cheapest-price [price] of min-one-of in-link-neighbors [price]
]