can Ciw set a state-dependent system capacity allocation for simulation?
I am running a simulation about a queue network, whereas the model have a capacity limit, and there exist an optimal capacity allocation policy for the system. But when i use Ciw for my simulation, i found Ciw doesn't support for my requirement. I wonder if Ciw could achieve this and how can i tweak codes. Thanks!
Dear @ARCCer can you please give some more information? What is the system you would like to simulate?
It's a queue network, where two kinds of customers exist and the number of different customers is the system state. The system's capacity is allocated based on the system state, which means the capacity for different customers is dynamically changed. In Ciw the capacity function is a fixed input and cannot change with the system state, this is the problem in my simulation. I hope I have clearly described my problem and can receive your bits of help.
There is a monkey patch strategy I have developed for this and similar issues. The gist of it is to have a randomly-unstable data structure (RUDS) which contains a reference to your instance of ciw.Simulation. Often this involves defining new behaviour for methods like __getattr__ or __getitem__.
Here is a very rough outline:
class RUDSThing:
def __getitem__(self, index):
...
ruds_instance = RUDSThing(...)
...
N = ciw.create_network(
...,
queue_capacities=ruds_instance
)
Q = ciw.Simulation(network)
ruds_instance.simulation = Q
I know this is terse and incomplete. You can also have a look at Ciw Hack to Get Resampling Routing Matrices for an example (which doesn't have access to simulation).
I think that in a future state we should allow dynamic queue capacities without monkey patching. 👍