首页 文章

如何在AnyLogic中保存或导出变量的值

提问于
浏览
-2

new_Screenshot

Questions revised: In my model, I have 10000 "Persons" as a type of agents at "Main" level. As shown new_Screenshot, there is a process like the statechart. "variable1" is determined by the process. For example, Person 1 will have 10 for the value of "variable1" while Person 2 will have 100 through the process. My question is how to obtain the values (e.g. Person 1: 10, Person 2: 100,.....Person 10000: 10) in AnyLogic. Thank you.

上一个版本:我的模型有10000个“人”作为一种代理 . “人员”具有状态图和变量(屏幕截图中的“variable1”)从状态图中获取一组不同的值 . 我试图从变量中为所有10000“人”收集所有这些值 . 我怎样才能做到这一点?我曾尝试使用traceln但它没有用,因为我需要的是值而不是最小值,最大值,平均值等 .

谢谢!

Screenshot

1 回答

  • 0

    所以答案如下:

    如果您的代理被定义为代理类型,那么您无法创建10,000的人口...来创建需要创建代理人口的10,000人口,所以我认为这就是您所做的,即使您说相反 .

    可以使用与任何集合相同的方式访问代理群体的元素: persons.get(N); 其中N是0到9999之间的任何整数 . 如果要访问该特定代理中的变量:

    persons.get(N).variable1
    

相关问题