Search code examples
simulationanylogic

Anylogic Seize Block ResourcePool Problem for Assigning Different Sources


Regarding Anylogic Resource Pool and Seize Block and Anylogic Resource Pool and Seize Block_2

Hi,

I am working on assigning 17 doctors within a single resource pool named doctorPool, based on their names and schedules. I have two agents: Patient and Doctor. The Patient agent includes a parameter called doctorName, which reads from an Excel file to determine which doctor each patient should be assigned to. The Doctor agent has parameters for name and schedule. I have attached examples of the panels I have configured so far.

SeizeBlock

resourcePool

main_codes

Schedule name_parameter schedule_parameter


Solution

  • One of the best options is to have populations for both your resources and your agents. That way, you can visually test and see if your setup makes sense.

    You can drag the patient and doctor agents from your projects toolbar, place them on the canvas and change them to populations. Then set them to initially empty, and maybe change the name to plural to make sense that they are populations and not single instances of the agent.

    Screenshot of agent populations

    Now, in the resource poo,l you set that the newly created agents be put into the population (instead of AnyLogic creating a custom population in the backend somewhere)

    Adding new units to custom population

    Do the same for patients in the source block.

    Adding created agents in source to custom population

    Now run your model and click on both the doctors and the patients.

    Showing contents of population during model run

    You will notice that none of the patients have a doctorName_index that matches the doctors index_dr number... All the doctors have index = 0...

    So our custom resource code of agent.doctorName.equals (((Doctor) unit) .name) will never be true.

    You can set the index of the doctor in the parameter in the default section, but I see your index for doctors start at 1, not 0, so you need to increment it.

    Setting the index of the dr

    Or you can set this in your startup code.

    NOTE: Be careful. I see that you instructed the size block to sieze 17 doctors. Do you really need 17 doctors for a single patient? Will you have enough doctors with the specific index to service a single patient?

    enter image description here