Pre-emptive Interruptions & Options for Resuming Service

Pre-emptive interruptions can happen in a number of settings. In Ciw they may happen when using customer priorities, that is when a higher priority customer arrives while a lower priority customer is in service, the lower priority customer is displaced from service. They may also happen when using server schedules, when servers go off duty during a customer’s service they are displaced.

Resuming Service

There are a number of options of what may happen when an interrupted individual resumes service. In Ciw they can either:

  • Have their service resampled ("resample");

  • Restart the exact same service ("restart");

  • Continue the original service from where they left off ("resume").

Pre-emption & Priorities

During non-pre-emptive priorities, customers cannot be interrupted. Therefore the lower priority customers finish their service before the higher priority customer begins their service (False).

In order to implement pre-emptive or non-pre-emptive priorities, put the priority class mapping in a tuple with a list of the chosen pre-emption options for each node in the network. For example:

priority_classes=({'Class 0': 0, 'Class 1': 1}, [False, "resample", "restart", "resume"])

This indicates that non-pre-emptive priorities will be used at the first node, and pre-emptive priorities will be used at the second, third and fourth nodes. Interrupted individuals will have their services resampled at the second node, they will restart their original service time at the third node, and they will continue where they left off at the fourth node.

Ciw defaults to non-pre-emptive priorities, and so the following code implies non-pre-emptive priorities:

priority_classes={'Class 0': 0, 'Class 1': 1} # non-preemptive

Note: If there are more than one lowest priority customers in service to pre-empt, then the customer who started service last will be pre-empted.

Unfinished pre-empted services are recorded as DataRecords and so are collected along with service records with the get_all_records method. They are distinguished by the record_type field (services have service record type, while pre-empted services have pre-empted service record types).

Pre-emption & Server Schedules

During a non-pre-emptive schedule, customers cannot be interrupted. Therefore servers finish the current customer’s service before disappearing. This of course may mean that when new servers arrive the old servers are still there. During a pre-emptive schedule, that server will immediately stop service and leave. Whenever more servers come on duty, they will prioritise the interrupted customers and continue their service.

In order to implement pre-emptive or non-pre-emptive schedules, the ciw.Schedule object takes in a keywords argument preemption the chosen pre-emption option. For example:

number_of_servers=[
    ciw.Schedule(schedule=[[2, 10], [0, 30], [1, 100]], preemption=False)      # non-preemptive
    ciw.Schedule(schedule=[[2, 10], [0, 30], [1, 100]], preemption="resample") # preemptive and resamples service time
    ciw.Schedule(schedule=[[2, 10], [0, 30], [1, 100]], preemption="restart")  # preemptive and restarts origional service time
    ciw.Schedule(schedule=[[2, 10], [0, 30], [1, 100]], preemption="resume") # preemptive continutes services where left off
]

Ciw defaults to non-pre-emptive schedules, and so the following code implies a non-pre-emptive schedule:

number_of_servers=[ciw.Schedule(schedule=[[2, 10], [0, 30], [1, 100]])] # non-preemptive

Records of Interrupted Services

Interrupted services are recorded as DataRecords and so are collected along with completed service records with the get_all_records method. They are distinguished by the record_type field (services have service record type, while interrupted services have interrupted service record types).

Note: For data records of the type interrupted service, the service_time field corresponds to the originally intended service time for that service, not the amount of time that the customer spent in service before being interrupted. The difference between the exit_date and arrival_date fields give the amount of time that customer spent in service before being interrupted.

Note: In both service and interrupted service record types, the waiting_time field corresponds to the total time between the arrival_date and the service_start_date. Therefore this includes all previous interrupted services that customer may have experienced before this particular record’s service start date.