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

Server priorities bug #200

Open
srinath-radhakrishnan opened this issue Mar 31, 2022 · 1 comment
Open

Server priorities bug #200

srinath-radhakrishnan opened this issue Mar 31, 2022 · 1 comment

Comments

@srinath-radhakrishnan
Copy link

Hi, when using server priorities by individual - I'm facing 2 issues.

  1. The model works fine for first few instances as long as there is no state change. For example: I want class 0 (apple) to be prioritized first by server1 and then by server 2 and server 3 equally and class 1 (orange) to be prioritized by server 2 and 3 equally and then later by server 1 if both server 2 and 3 are busy. For this scenario, as long as server 1 is available for apples model works perfectly. The moment server 1 is busy and servers 2 and 3 start picking apples, the priority completely changes when next apple/orange comes into the queue. It goes to the point where beyond a stage, even if server 1 could wait to pick up the next apple, it assigns server 2 and 3 to apples.
  2. within the allocation, the model randomly allocates customers rather than first come first serve. For example, I have 2 customers 1 apple customer at 11a and 1 orange customer at 11:30a and server 1 is busy during both arrivals . Server 2 is assigned. Server 2 just finished a customer at 11:20am. Now ideally the server 2 should work on apple customer at 11a (which has a 15 minute wait time) but instead it works on orange customer at 11:30a, finishes that first and then goes back to 11a apple customer. Due to this, my wait time/ customer is getting skewed and the simulation approach itself isn't right.

Can someone please help me here?

@srinath-radhakrishnan srinath-radhakrishnan changed the title Server priorities issue Server priorities bug Mar 31, 2022
@MichalisPanayides
Copy link
Contributor

MichalisPanayides commented Mar 31, 2022

Hi there @srinath-radhakrishnan

I am not sure I fully understand what your model looks like. Correct me if I'm wrong but my understanding is that you have two classes of customers:

  • Class 0 - Apples
  • Class 1 - Oranges
  • 3 servers

and you want to prioritise your servers for both classes in such a way so that if:

  • apple customer arrives: Server 1, Server 2 or 3
  • orange customer arrives: Server 2 or 3, Server 1

One way of doing that is:

import random
import ciw

def custom_server_priority(srv, ind):
    if ind.customer_class == 0:
        priorities = {1: 0, 2: random.random(), 3: random.random()}
        return priorities[srv.id_number]

    if ind.customer_class == 1:
        priorities = {1: 1, 2: random.random(), 3: random.random()}
        return priorities[srv.id_number]


N = ciw.create_network(
    arrival_distributions={
        "Class 0": [ciw.dists.Exponential(1)],
        "Class 1": [ciw.dists.Exponential(1)],
    },
    service_distributions={
        "Class 0": [ciw.dists.Exponential(2)],
        "Class 1": [ciw.dists.Exponential(2)],
    },
    number_of_servers=[3],
    server_priority_functions=[custom_server_priority],
)

Is that similar to what you have? If not, can you show me how you defined your network object?

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

2 participants