Jump to content

How to remove entities from system at random times? (modelling mortality)


Recommended Posts

How can I schedule a randomly distributed death event for each entity, and pull them out of the system (or perhaps route to a "mortality" sink) if it occurs before they have already left?

Somewhat similar to reneging, but I need mortality to be possible during a service, not only in queues. If an entity is removed from service, I also need the seized resources to be released.

What I have tried so far: When an entity is created, I provide them with a state variable for TimeTillDeath, lets say exponential(2) hours. This is a real number, not a datetime. As they enter each queue, I set the reneg trigger as ModelEntity.TimeTillDeath subtract any elapsed time since creation, min 0. This works to model mortality while they are waiting for service, but not during a service.

Any help is appreciated, 

KO

Link to comment
Share on other sites

First define a real state variable to your modelentity named "livingtime" after its creation. Then make a copy of your modelentity and send the copy of modelentity to a process (maybe called as death_process). Place a delay step and set delay time as modelentity.livingtime. Of course the original one should go its way. Then place a search step and find the original modelenity in the system when the time is up at delay step (while finding the original entity you should set a match condition such as candidate.modelentity.ID==modelentity.ID etc. I am not sure whether the ID's of both entities are same, you should try. If it does not work you should try to match creation times of them (both should be same) or any other user defined  state variables or properties). If the search is succesful make necessary controls (i.e., if it owned any resource release them etc.) by placing necessary steps following found branch. You should remove and transfer the found modelentity (it is the original one) to appropriate place. At the end you should place a destroy step following the original branch or even transfer it to appriate place. It depends on your goals. 

Link to comment
Share on other sites

An alternate approach is to place a monitor element which looks at the TimeTillDeath State variable. If this reaches zero, within the monitor element you may choose to execute a user defined process named "proc_WhateverYouWantToCallIt".

Within this process, I will use the "remove" block if the entity is in a queue, or simply just utilise the "destroy" block. You may have to utilise the aforementioned blocks with a conditional "search" block as to ensure the correct entity is destroyed.

Hope this helps.

 

Link to comment
Share on other sites

Thanks for the help. I came up with another solution, let me know what you think:

The Entity has reached end of queue and is about to begin processing. In Server-Before Processing state assignments I recalculate .TimeTillDeath. At this time I will also give them a .TreatmentTime = random.exp(x). 

Actual server processing time is Min(ModelEntity.TimeTIllDeath, ModelEntity.TreatmentTime)

Once they leave the station, my routing is based on if TimeTillDeath < Treatment Time. If that is true, then they had effectively died at end of service and are sent to a sink. 

I can see how this would fudge some of the Server stats in the results page, but I am not concerned about actual treatment times there. 

Let me know if i'm missing something. 

 

Link to comment
Share on other sites

While I think all approaches mentioned above are good depending on the situation, I'll mention one more advanced approach, perhaps just for the educational value.

While most people think of balking and reneging as a Server-type of option, it is actually implemented as a feature on every Station. So another approach, particularly if you encountered this situation a lot, might be to subclass the Server and change the properties of the Processing station to implement reneging on that station.

Link to comment
Share on other sites

×
×
  • Create New...