question

David Seo avatar image
0 Likes"
David Seo asked Ben Wilson commented

How to make the patient moving to the place of least waiting time using List?

I want to know how to make the patient move to the least waiting place according to the treatment. The places the patient should move to are determined according to the treatment result.

My original issue is followed;

https://answers.flexsim.com/questions/84857/how-to-move-the-patient-to-multi-places-using-list.html

The solution will be good though not using list activity. The issue is that the patient will move to the place for least waiting time.

FlexSim 20.1.2
flexsim 20.1.2dynamic track of patient
· 8
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

tannerp avatar image tannerp commented ·

@Seung Yong Seo,

I would think that the best way to do this would be to pull from a list based on a query. The problem is that you need a way of pushing locations to a list that include a label value indicating the waiting time for each location. Do you have a model you're building that you could upload? If so, is there already a method you're using to calculate the waiting time at each location.

0 Likes 0 ·
David Seo avatar image David Seo tannerp commented ·

Thank you. @tanner.p

Yes. I think List activity should be used but the patient does not move to next step.

I upload the sample simple model to have a same issue below. I have the real model which the customer does not open in public and the real model is very complicated and very large.

Task1.32 - Add Triage_Decision and Using List - Add LAB.fsm

Task1.32 - Add Triage_Decision and Using List.fsm

The patient moving sequence is not fixed but the patient should move to the place which the label value equals to 1. The patient should move to the place to the least waiting time by himself or the nurse guidance.

If this simple model attached is not enough for solving my issue, I will send or upload it in private.

Thank you.

0 Likes 0 ·
tannerp avatar image tannerp David Seo commented ·

@Seung Yong Seo,

Sorry for the inconvenience, but can you upload the model again in a comment? Our Answers forum has had issues with broken links on attachments, so I can't download your model.

It sounds like you'll need a query that will pulled locations that have a label value equal to 1. If that's the case, then I would create a query in the Pull from List query field that looks like the following:

WHERE myLabelValue = 1

Then you can assign the pulled location to a token label, such as "token.pulledLocation".

Like I mentioned, if you don't mind re-uploading the model in a comment, I'll take a look at your model and see if we can get it to work using this method.

0 Likes 0 ·
Show more comments
tannerp avatar image tannerp commented ·

@Seung Yong Seo,

I apologize for the delayed response to your question. Fortunately, the answer why this is not working is simple. The unfortunate part is that you're going to have to come up with a different method for what you're doing. Let me explain.

When a token arrives at a Push to List activity, the designated value is pushed to the list and then the token waits for the value to be pulled from the list. So, in your model, a token arrives at the Push to List and it waits to be pulled. But, the only way that token can be pulled is by itself, so there's a deadlock; the token can't move on from pushing to the list, but it also can't pull itself from a list.

In this case, you need another instance of something to pull from the list. But, I think the logic that you're trying to create here is that of a Decide activity. You are trying to determine the destination of the token based on whether LAB, EKG, or Xray is equal to 1. Why not just use a Decide activity rather than the push/pull sequence?

0 Likes 0 ·
David Seo avatar image David Seo tannerp commented ·

@tanner.p. Thank you for your reply. I was waiting for a long time.

The reason I did not use to Decide activity is that the sequence of patient's moving is not fixed like one route of LAB-EKG-Xray. The patient can move any destination after he looks for the waiting patients quantity of the destination.

If the sequence of the patient moving is fixed on one way like LAB-EKG-Xray using Decide activity, the waiting line and time will become longer. In real-world, the patient will move to the destination of a few patient quantities or no patient among which he should go (the label value equals to 1). So the patient route is not fixed. He can go to any destination based his label value 1. I want to make it in the model.

I don't know how to use another instance in the above case. Please explain it more detail. I have not enough experience to apply PF to a project.

0 Likes 0 ·
Ben Wilson avatar image Ben Wilson ♦♦ commented ·

Hi @david.seo, was tanner.p's answer helpful? If so, please click the red "Accept" button on their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept or comment back to reopen your question.

0 Likes 0 ·

1 Answer

tannerp avatar image
0 Likes"
tannerp answered tannerp commented

@Seung Yong Seo, sorry to keep you waiting. I have come up with a solution that should achieve the behavior you described.

Using a Decide activity, we can set the logic to be "Connector By Case" as shown below. This logic checks a function, which I set to be "token.route", and then sends the token to the appropriate connector (LAB, EKG, Xray). You can see which number the connector is by clicking on it and looking at the Quick Properties window.

The "token.route" label is assigned by logic in the "Assign Route" activity prior to the Decide activity. Basically, I set it up to check each of the person labels (LAB, EKG, Xray) and then assign the route number to the label that is equal to 1. So, in this case, if the LAB label is equal to 1, the token.route label will be assigned to 1. (EKG -> 2, Xray -> 3)

You can, of course, change this to be a random distribution if, for example, all three labels are equal to 1. I will let you be creative in how you assign the token.route label. Here's what I put for reference:

triage help.fsm


decide-by-case.png (15.3 KiB)
triage-help.fsm (386.3 KiB)
· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

David Seo avatar image David Seo commented ·

@tanner.p

Thank you for your answer.

I don't know how to solve my problem as your guided. And I think it is not a solution I expect. I think It was a result for my poor explanation about the issue I have in this subject. In this example model, the places the patient should go are only three according to the exam result. And the combination places according to the exam result are the max three. But my real model has max five places to move according to the exam result. Yes the patient can have a case all five route label value = 1.

For Example, person.LAB =1, person.XR=1, person.PXR=1, person.CT=1, person.MR=1. In this case, the patient should be routed to the five places. He should go to and come back again in five times.

What I should solve in this process flow is TWO issue followed;

1) The patients should keep his bed in the first hospitalization though he will go to the exam places according to the decision result. After he finish the exam at the first exam place, he will come-back to his bed again and waiting for it's his turn.

2) After he finished the routes of all his exams (the case of person.label = 1), he can move out from his hospitalized bed.

3) The route sequence is not fixed and the patient can be routed to the places which minimum persons waiting for.

I have some difficulties to explain my thinking and what I am trying to do because of my poor English expression. And I hope you will be able to understand my meaning.

Can't I solve my problem using 'List'? After the patient finish one exam, he come-back to his bed again. And then he move to the next place of label value = 1. And then he come-back again to his bed and then he go to the place of the next label value = 1. ...

0 Likes 0 ·
tannerp avatar image tannerp David Seo commented ·

@Seung Yong Seo,

Unfortunately, I don't think you can use lists in this process flow because there's only one token per person in the model. This means that there can't be one token pushing the person to a list and another token pulling that person from the list in the same flow.

You might be able to use a list on a general Process Flow. I've set up an example that does the LAB and EKG stations. Essentially, these stations always have one token in the ProcessFlow trying to pull a patient. When they're successful, they perform the tasks, assign the label of "LAB"/"EKG" to be 0 (so they are not pulled again to this area), and push the items back onto the list. See if this works.

triage-help (1)_1.fsm

0 Likes 0 ·
triage-help-1-1.fsm (398.7 KiB)