我的代理商设定trade_Price,而不是交易时,他们将利润保存到他们的支付变量中。在ai进程中我必须编写代码,我的代理必须环顾四周并选择具有最高回报的邻居代理。并且代理商必须向该代理商提供其决策价值。我之前问过这个代码:
ask buyers [
let current-buyer self
ask sellers [
let current-seller self
let how-much 1
set decision ;some number
ask current-buyer [
set decision ;some number
]]]
但得到了我想要的东西。比我自己编码所以:
ask sellers
[ let partner one-of buyers-here if partner != nobody
[ move-to one-of partner with-max [decision] of buyers]]
但是也有错误,你能给出一个提示或者至少哪种代码是正确的方法吗?
答案 0 :(得分:1)
回应评论时修改:
ask sellers [
let candidates (buyers-on neighbors)
ifelse any? candidates [
let partner one-of (candidates with-max [decision])
move-to partner
][
die ;; or whatever you want to do in this case
]
]