我正在研究一个模型,它由一组由链接连接的节点组成。最初有两种代理商,比如黄蜂和收藏家。我的收藏家找到蜜蜂所在的一个节点,前往那里收集蜜蜂。(模型的工作方式是,当收集者到达蜜蜂所在的节点时,蜜蜂被杀死,收集者-自己的变量称为蜜蜂-将更新1)。接下来,收集器将旅行到某个节点,让坐节点与蜂巢。在这一点上,我想创造一个新的品种,让我们说新品种的蜜蜂,即红蜂。问题的出现是因为只有观察者才能创建一个新的品种,而不是收集器。孵化也不能工作,因为它将创造更多的收藏家,而不是一只新的红蜜蜂。知道怎么解决这个问题吗?
breed [yellow-bees yellow-bee]
breed [collectors collector]
breed [red-bees red-bee]
breed [nodes node]
breed [hives hive]
collectors-own [bees-collected current-node]
nodes [hive-present]
to go
...
...
ask collectors[
if current-node = nodes with [hive-present = True][
create-red-bees bees-collected
]
]发布于 2019-06-06 09:06:56
如果您使用命令的hatch-<breeds>版本,正如NetLogo字典条目中提到的那样,孵化将工作,它将创建给定品种的新海龟。
下面是一个示例:
breed [collectors collector]
breed [red-bees red-bee]
to setup
clear-all
create-collectors 10
ask collectors [
hatch-red-bees 1
]
print count red-bees
endhttps://stackoverflow.com/questions/56471756
复制相似问题