Closed mnips closed 7 years ago
Hi @mnips thanks for the questions and great ideas!
I'll answer each point in separate comments:
Beginning with point 2.
Batch customers are not formally implemented in Ciw yet. This is a great idea and I'd like to get working on this soon! There is however a workaround for deterministic arrivals:
Consider the case where 5 customers arrive in a batch ever 100 minutes: Using a Sequential
arrival distribution, this can be simulated as follows:
>>> N = ciw.create_network(
... Arrival_distributions=[['Sequential', [10.0, 0.0, 0.0, 0.0, 0.0]]],
... Service_distributions=[['Deterministic', 0.5]],
... Number_of_servers=[1]
... )
>>> Q = ciw.Simulation(N)
>>> Q.simulate_until_max_time(25)
>>> recs = Q.get_all_records()
We would now expect 5 customers to arrive at date 10
, 5 customers to arrive at date 20
, 5 customers to arrive at 30
and so on. If we run this for 25
time units we would expect 10 customers to go through, but we can also see that they queue up as normal:
>>> [r.arrival_date for r in recs]
[10.0, 10.0, 10.0, 10.0, 10.0, 20.0, 20.0, 20.0, 20.0, 20.0]
>>> [r.service_time for r in recs]
[0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5]
>>> [r.waiting_time for r in recs]
[0.0, 0.5, 1.0, 1.5, 2.0, 0.0, 0.5, 1.0, 1.5, 2.0]
>>> [r.exit_date for r in recs]
[10.5, 11.0, 11.5, 12.0, 12.5, 20.5, 21.0, 21.5, 22.0, 22.5]
So deterministic batch arrivals can be implemented. It isn't very readable and I'd like to develop a wrapper for this to make a BatchArrival
distribution or something similar to make this feature easier and more intuitive to use.
As for number 1), unfortunately this (server resources) can't be implemented in queue as you have written it. However I do believe that there are equivalent formulations that can be simulated.
One that immediately springs to mind is described below, however we must drop the assumption that customers are willing to wait up to 30 minutes for a bike. Assuming they baulk as soon as there are no bicycles:
This is equivalent as the amount of time a bicycle is spent at the node is identical to the amount of time a bicycle is spend waiting for a customer in the original scenario. In this case we do not care about the customers as they do not wait, they simply arrive and take a bike, thus the only information we require is the inter-arrival time, which is now modelled as a service time.
Does that make sense? Now this model would need to be adapted to satisfy all details of the original model (e.g. customers willing to wait up to 30 minutes for a bike). But this is quite advanced customer behaviour that isn't supported by Ciw unfortunately.
Thanks a lot @geraintpalmer ! Although not very intuitive, I believe the formulation proposed is good to go with for the bicyle use case. For metro use case, I would like to add that I used Exponential distribution as a service distribution as it serves 100 customer/per unit of time. Yes, it does not depict a batch but I guess it still gives the actual number of passengers served. Am I right?
Hi @mnips check out the latest release. Batch arrivals have now been implemented in commit 9eed6f48c151338325527c13a49393c0af4168d5
Can we simulate the given use case using ciw: 1) Say, there is a bicycle rental station where there are 100 cycles present at a time. Now the customers arrive with a certain distribution to take the cycle. Each customer is allowed one cycle at a time. The new batch of cycles comes only after 60 minutes which means that the empty cycle servers are refilled only after 60 minutes. A customer baulks if there are no cycles currently present and the refilling of the cycles will take more than 30 minutes. The rented cycles are returned to the warehouse. There amount of resources(cycles) available in the warehouse can be taken as any number. Is there a way this can be simulated?
2) In a metro station, or even production lines, a batch of customers are served simultaneously. Like 100 people enter the metro together. Is there a method for batch processing available?