NetLogo:杀死agentset的其余部分
上面的代码是我现有的一个功能代码。由于堵塞物减少,他们将遵循最后一个方程,告诉他们去死。然而,我到了一个地步,它想要15个插科打诨死,但我只有10在代理集剩下。所以我试着在后面直接添加一行新代码,但它仍然给我带来同样的问题,所以很明显,这是不对的。我写的代码行写在下面NetLogo:杀死agentset的其余部分,netlogo,kill,agentset,Netlogo,Kill,Agentset,上面的代码是我现有的一个功能代码。由于堵塞物减少,他们将遵循最后一个方程,告诉他们去死。然而,我到了一个地步,它想要15个插科打诨死,但我只有10在代理集剩下。所以我试着在后面直接添加一行新代码,但它仍然给我带来同样的问题,所以很明显,这是不对的。我写的代码行写在下面 to change-vgags ifelse (((-0.007333 * x * x) + (0.07333 * x) + 1) = 1) [stop] [ifelse (((-0.007333 * x * x) +
to change-vgags
ifelse (((-0.007333 * x * x) + (0.07333 * x) + 1) = 1)
[stop]
[ifelse (((-0.007333 * x * x) + (0.07333 * x) + 1) > 1)
[ask n-of (((((-0.007333 * x * x) + (0.07333 * x) + (1)) / 48) - (1 / 48)) * 590) gags with [pcolor = red - 2] [ hatch 1 ]]
[ask n-of (((1 / 48) - (((-0.007333 * x * x) + (0.07333 * x) + 1) / 48)) * 590) gags with [pcolor = red - 2] [die]]]
如果有人对如何解决这个问题有任何建议,我将不胜感激!提前谢谢 替换:
if (((1 / 48) - (((-0.007333 * x * x) + (0.07333 * x) + 1) / 48)) * 590) > count gags with [pcolor = red - 2] [ask gags with [pcolor = red - 2] [die]]
end
与:
或者,如果这看起来有点难读,你可以:
let quota ...
let targets gags with [pcolor = red - 2]
ask n-of min (list quota count targets) targets [ die ]
let quota ...
let targets gags with [pcolor = red - 2]
ask n-of min (list quota count targets) targets [ die ]
let quota ...
let targets gags with [pcolor = red - 2]
if quota > count targets
[ set quota count targets ]
ask n-of quota targets [ die ]