79426279

Date: 2025-02-10 06:57:01
Score: 0.5
Natty:
Report link

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

Reasons:
  • Probably link only (1):
  • Long answer (-1):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • High reputation (-1):
Posted by: Jaco-Ben Vosloo