首页 > 解决方案 > 如何监控依赖于海龟自身变量的特定海龟的百分比?

问题描述

我想在我的界面上添加一个监视器,它显示设置世界中所有公司的在家公司数量(以百分比为单位)。

我正在尝试在一个行业(世界)中建立公司(海龟),这些公司要么在国内生产(公司在国内),要么在离岸生产(离岸公司)。我给他们一个叫offshored的公司自己的?答案是真或假。

我试过这段代码:

breed [ firms firm ]

firms-own [
  offshored?   ;; true or false
  reshored?   ;; true or false
]

to-report offshored-firms
  report 100 * [ if firms with offshored? true ] / n-of firms ]
end

to-report firms-at-home
  report 100 * [ if firms with offshored? false ] / n-of firms ]
end

然后我会firms-at-home在我的显示器的记者窗口。

我没有将数量offshored-firmsfirms-at-home总数除以,firms因为我无法弄清楚如何。感谢您的输入!

标签: netlogopercentagemonitoragent-based-modeling

解决方案


推荐阅读