CiwPython / Ciw

Ciw is a simulation library for open queueing networks.
http://ciw.readthedocs.io
MIT License
146 stars 42 forks source link

[Feature Request] Failure to start service #228

Closed galenseilis closed 1 month ago

galenseilis commented 7 months ago

Thinking about Issue 222, there is a desired behaviour. I would like there to be a way to have a service discipline behaviour in which servicing fails to start.

One option is to make that happen when the service discipline returns None.

import random

def sometimes_block(individuals, p=0.01):
    if random.random() < p:
        return None # Skip to the next event

     return individuals[0]

Another option might be for it to return a non-negative float indicating the amount of time until the service center will attempt to service again.

import random

def sometimes_block(individuals, p=0.01):
    if random.random() < p:
        return 5.0 # Delay next servicing until 5.0 units from now

    return individuals[0]
geraintpalmer commented 3 months ago

Thanks for the idea. So there are 2 cases:

1) Service fails to start completely, 2) Service is delayed.

In case 1) what happens to the customer? Are they routed to the next node, or do they exit the system? In both cases, sampling a service time of 0.0 would give the desired behaviour.

In case 2), sampling a slightly longer service time would give the desired behaviour. E.g., if service is usually samples with an Exponential distribution with rate 5, and with probability 0.2 they are delayed by 1 time unit, then the following distribution will give the desired behaviour: ciw.dists.Pmf(values=[0, 1], probs=[0.8, 0.2]) + ciw.dists.Exponential(rate=5)

However, in both cases, the thing thats missing is a record that service failed / was delayed.

galenseilis commented 1 month ago

This is covered by the new rerouting feature.