netlogo - 如何监控依赖于海龟自身变量的特定海龟的百分比?
问题描述
我想在我的界面上添加一个监视器,它显示设置世界中所有公司的在家公司数量(以百分比为单位)。
我正在尝试在一个行业(世界)中建立公司(海龟),这些公司要么在国内生产(公司在国内),要么在离岸生产(离岸公司)。我给他们一个叫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-firms
或firms-at-home
总数除以,firms
因为我无法弄清楚如何。感谢您的输入!
解决方案
推荐阅读
- reactjs - 在顶层使用带有上下文 api 的 useSelector 挂钩以提高性能
- matlab - 如何改变点云中平面的位置?
- mongodb - MongoDB Mongoose 在日期范围内选择文档
- javascript - ajax数据表,无法检索数据
- jquery - 请求了不受支持的 HTTP 方法“OPTIONS”,而我设置为 HTTP 方法:“POST”
- laravel - Laravel 嵌套 Foreach 的常见问题视图试图获取非对象的属性
- java - 如何向洋葱服务器发送http请求?
- html - 布局菜单项,更改所选页面“项目”的样式
- prometheus-alertmanager - Alertmanager 中的指纹字段是否唯一?
- android - Ionic 4 与 Ionic 3 中的后台工作人员