Acuity level - nurse - anylogic

Viewed 32

Please any idea how to model the following in any logic using block and a simple code:

  • we have resourcepool of 14 nurses
  • one nurse can supervise up to 4 patients (supervise means she only watch them and can not watch more than 4 at the same time, when one patient leaves she can take another patient in his place but max 4 per nurse)
  • during the supervision she can serve only one patient of the four at the same time, so the other three patients need to wait (for example one of the four patient needs drug injection, so she can do that for him then see the requirement of the second patient if any)
  • the nurse should not wait for the four patients to arrive. So batch here don't wotk?

This is very challenging, I read previous questions and answers but did not work such as batch or multiplying the number of nurees by 4 .. etc

Is there a simple trick to do that? Thank you

1 Answers

Great question! This is a difficult logic to implement. The nurse is assigned to up to 4 people and then she can serve 1 of them at a time.

To do this I would have a patient be assigned to a nurse upon entry. They would search for the first nurse that has less than 4 people assigned and then "register" with this nurse. Then if they need treatment you would have the patient wait to seize the nurse it has been assigned to.

  1. To start create a new agent called nurse, with a variable of type LinkedHashSet that will store agent of type patient.

enter image description here

In the agent parameters remember to set the nurse as resource unit. enter image description here

  1. Create resource pool of nurses and a population for nurses, adding new resource units to the nurse population

enter image description here

  1. Now when a patient need to assign it self to a nurse do this function on your nurse population.
Nurse availableNurse = findFirst(nurses, e -> e.assignedPatients.size() < 4);
agent.nurse = availableNurse;
availableNurse.assignedPatients.add(agent);

You can call this code when ever a patient enters a process modelling library block where it gets assigned to a nurse. (I also added a nurse variable to the patient so that the patient knows which nurse it is assigned to)

  1. Now when a patient needs to seize a nurse for an injection or some other activity it can know to seize the nurese assigned to it.

enter image description here

Related