I have a system that modelizes a kind of queuing system, that is composed of these elements :
- services : a service that can be offered to a customer
- desks : a desk that can offer one or more services. There are several desks, and each can be configured to provide a different subset of services, with or without overlap between the desks
- customers/tickets : a customer comes in, and prints a ticket specifying which service she needs
The system is already in place and works fine. It is a real-world system, with tickets distributors that allow customers to request and print tickets, and desks client app to call customers to the desks, and displays to show the customers who goes where.
Now a new requirement is a way to approximately predict the waiting time for any given ticket in the queue, and raise an alarm if this waiting time gets too high.
We will have a service duration time that will be collected from usage statistics, for each service.
The prediction does not need to be very precise, the goal is to give the administrator of a site a quick outlook of the situation, a feedback whether everything is flowing smoothly, or if customers are accumulating in the queue and it would be good to open one more desk, or in the contrary, customers are scarce and a desk could be shut. The most important factor is the waiting time for the customers (for example it would be ok to have 10 customers waiting if each customers stays at the desk 1 minute, but not if this duration is 10 minutes!).
The problematic is that any desk can provide any service without limitations. So a given service can be provided by any number of desks. But in turn each desk can provide any number of services.
I tried various approaches :
You could generate a queue that consists exclusively of tickets for services that can be provided by one desk. But then, each ticket in this list might be “serviceable” by just this desk, or by 5 other desks too…
You could grab a ticket, see which desks are susceptible to service it, and grab all the tickets that can be serviced by any of these desks. Again the problem is that some tickets can be treated by only one desk in the set and others by all of them…
I really don’t know how to tackle the problem from here. Are there any queuing models that can be used for that kind of heterogenous desks ? Any ideas how to modelize this ?
Since you have tagged the question with
algorithm, and you are asking in a programming site (rather than a math or statistics site), I will approach this from a programming perspective.Model:
Usage:
Implementation:
tick() would iterate over all desks to see which have finished(), and assign tickets to desks according to current policy. By calling tick() several times until the queue is empty, the exact time-to-close can be determined for each service type — but this destroys the queue, and it should be done only on clone()s of the current queue.
forecast() would clone() the queue N times, and for each cloned queue, advance the time ‘now-t’ times while adding simulated tickets (generated with createFuture()). You should chain the times of createFuture as follows:
simulated tickets would only be pushed into the actual queue once the simulated time reached their simulated arrival times. Once the simulated time reached ‘now+t’, the actual service latencies would be determined and averaged out over all N simulations, to yield the probabilistic forecast.