基本上,我有以下问题:我必须模拟多家医院的专科,并分析关闭其中一个专科后会发生什么。
问题是医院专科的组合数量很高(大约1000),所以我正在寻找一种“动态/程序化”的方法。
换句话说,--我正在寻找一种方法来自动创建一个resourcePool (以及附加到它的日程安排),而不需要手动创建中的资源。例如,像这样的事情
//An arraylist of names of hospitals
for (String hospitalCode : hospitals) {
for(String specialtyCode : specialtiesCodes) {
ResourcePool res = new ResourcePool();
res.setName(hospitalCode + "_" + specialtyCode);
Schedule schedule = new Schedule();
//Set the type of the schedule along with other parameters. This will be used
//to set the capacity of the resourcePool res
schedule.setParameters(type, capacity, ...);
res.attachSchedule(schedule); //Connects the schedule to the resource
schedule.create();
res.create() //Creates the resources in the Main panel of Anylogic
}
}此外,在这幅图中,我有几个特性(它们被建模为resourcePool,因为容量和延迟时间对于我必须建模的问题至关重要)
您可以看到,我已经创建了一堆resourcePools和计划,但是我已经手动完成了这个。
我还试图复制/粘贴一些resourcePools,但是没有办法更改resourcePool的名称。我也见过Java,但我没有找到解决方案。
发布于 2017-03-13 08:24:19
方法一:
最简单的方法是使用参数变化实验,并创建一个简单的模型,您只需定义具有resourcePool容量的参数。
这样你就可以连续进行大量的实验,并且同时进行。
然而,这需要一种能够处理医院-专科组合之间的差异的模式。因为我不知道你的问题的每一个细节,我不确定这是可能的。但我会尝试使用这种方法,因为这通常更容易和更快。
方法二:
另一种方式,也许更多的沿着你正在尝试的。
Advanced of your ResourcePool下面看。您应该看到一个选择选项:Single agent和Population of agents。
选择Population of agents。这将将其转换为一系列资源池。也可以选择initial emptyadd_NameOfMyResourcepool( ... parameters ...)Resource sets更改为动态参数并写入:{{NameOfMyResourcepool.get(index_of_resource_you_want)}}来完成的。https://stackoverflow.com/questions/42721010
复制相似问题