NETLOGO:使用上一个刻度的变量 [英] NETLOGO: Using variable from previous tick
问题描述
是否存在一些使用上一个刻度的变量值的原语?我试图为一个代理商计算价格"变量,但我的意思是使用包含其他代理商的价格"变量的公式,但该公式是从上次报价开始的.
is there some primitive for using value of variable from previous tick? I tried to compute variable of "price" for one agent and I mean to use formula which includes other agents' "price" variable but from previous tick.
推荐答案
否,NetLogo中没有内置方法可以做到这一点.最好的选择可能是创建一个名为varname-last-tick
的变量,然后将其更新为您在这些代理程序的go
过程中所做的最后一步.听起来您想为代理商使用的变量是价格",所以类似,
No, there is no built-in way to do this in NetLogo. Your best bet would probably be to create a variable called something along the lines of varname-last-tick
and then updating that as the last thing you do in the go
procedure of these agents. It sounds like the variable you want to use for your agents is 'price', so it would be something like,
to agent-go
do-stuff
set price-last-tick price
end
然后您可以在代码中使用[price-last-tick] of other agents
而不是当前价格.
then you can use [price-last-tick] of other agents
in your code rather than the current price.
这篇关于NETLOGO:使用上一个刻度的变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!