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

How can I limit the amount of food being produced in my model according to a specific distribution

在我的模型中,我在整个环境中生产食物。我知道总共应该有多少食物,我根据特定的分布将其包装起来,在这种情况下是 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]

希望能帮到你

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

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
]]