向海龟询问链接另一端的最小变量
Asking turtles for minimum of variable on the other-end of links
我目前正在解决一个问题,我有两个代理集:买家和卖家,卖家与买家相关联。我的问题是:如何要求买家选择卖家变量(价格)的最小值。
我认为我可以通过像这样的原语来做到这一点:
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
]
]
谢谢。
我猜你需要这样的东西:
... 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]
]
我目前正在解决一个问题,我有两个代理集:买家和卖家,卖家与买家相关联。我的问题是:如何要求买家选择卖家变量(价格)的最小值。
我认为我可以通过像这样的原语来做到这一点:
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
]
]
谢谢。
我猜你需要这样的东西:
... 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]
]