Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can Ciw set a state-dependent system capacity allocation for simulation? #204

Open
ARCCer opened this issue Jun 2, 2022 · 3 comments
Open

Comments

@ARCCer
Copy link

ARCCer commented Jun 2, 2022

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!

@geraintpalmer
Copy link
Member

Dear @ARCCer can you please give some more information? What is the system you would like to simulate?

@ARCCer
Copy link
Author

ARCCer commented Jul 6, 2022

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.

@galenseilis
Copy link
Contributor

galenseilis commented Dec 20, 2023

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. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants