NETLOGO: Using variable from previous tick

天涯浪子 提交于 2019-12-02 10:40:01

问题


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.


回答1:


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

then you can use [price-last-tick] of other agents in your code rather than the current price.



来源:https://stackoverflow.com/questions/33370786/netlogo-using-variable-from-previous-tick

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!