如何根据具体分布限制模型中生产的食物量

时间:2017-07-31 17:00:53

标签: netlogo

在我的模型中,我在整个环境中生产食物。我知道应该有多少食物和我根据特定的分布包装起来,在这种情况下是Gamma。

大部分食物在一天结束时衰退,于是我想在第二天再次开始这个过程。 (我确实有一些食品代理需要更长的时间来腐烂,但这不应该影响我在这里寻找的东西)。

我想要类似下面的内容,但却无法得到它:

  if ticks = 0 [while [sum [mass] of foods < 100000] [
create-foods n-foods [ ;; this could be arbitrarily high to allow the model to keep making food up to the limit of the mass
set mass random-gamma 1.2 0.002
]]]

为了完整性,我稍后会要求食品代理商增加一个腐烂计数器,并用它告诉他们是否在一天结束时死亡:

  ask foods with [decay = 2] [die]

希望你能帮忙

1 个答案:

答案 0 :(得分:1)

我找到了一个适合我的解决方案,通过使用补丁来发芽食物。

ask patches [
    while [sum [mass] of foods < random-normal 6000 100] [
sprout-foods 1 [ 
set mass random-gamma 1.2 0.004
setxy random-pxcor random-pycor
]]