Basically, I have the following problem: I have to model specialties of several hospitals in Anylogic, and analize what happens when one of more specialties are closed.
The problem is that the number of combinations of hospital-specialty is very high (around 1000), so i'm searching for a way to do it "dynamically/programmatically".
In other words, I'm searching for a way to create automatically a resourcePool (and a Schedule attached to it), without the need to create the resource in Anylogic MANUALLY. For example, something like this
//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
}
}
Furthermore, in this picture I have several specialties (they are modeled as resourcePool, because the capacity and the delay time are essential for the problem I have to model)
An example of the modeled problem
You can see that I have created a bunch of resourcePools and Schedules, but I have done this manually.
I have also tried to copy/paste some resourcePools, but there is no way to change the name of a resourcePool. I have also seen the Java API but I have not found a solution.
Method one:
The easiest way is to use the Parameter variation experiment, and create a simple model where you only have to define the Parameter with the capacity of your resourcePool.
that way you can run a lot of experiments in a row, and simultaneously.
This demands, however, a model that can handle the variations between your combinations of hospital-specialty. Since i don't know every details of your problem i'm not sure it is possible. But I would try to use this method since this is usually way easier and faster.
Method two:
Another way and probably more along what you are trying.
Advanced
of your ResourcePool. You should see an
option to select either: Single agent
and Population of agents
. Population of agents
. this will change it into an array of resourcepools. Also select initial empty
add_NameOfMyResourcepool( ... parameters ...)
Resource sets
to a dynamic parameter and write: {{NameOfMyResourcepool.get(index_of_resource_you_want)}}