disruption_process Module¶
Overview¶
This module contains the DisruptionProcess class. A DisruptionProcess
object represents a disruption process that a node is subject to. Attributes specify the type of
random process governing the disruption, as well as the type of disruption itself (i.e., its effects).
The object keeps track of the current disruption state and generates new states according
to the random process.
Note
The notation and references (equations, sections, examples, etc.) used below refer to Snyder and Shen, Fundamentals of Supply Chain Theory (FoSCT), 2nd edition (2019).
Example: Create a DisruptionProcess object representing disruptions that follow a 2-state
Markov process with a disruption probability of 0.1 and a recovery probability of 0.3.
Disruptions are “order-pausing” (a disrupted node cannot place orders). Generate a new
disruption state assuming the current state is True (disrupted).
>>> dp = DisruptionProcess( ... random_process_type='M', # 2-state Markovian ... disruption_type='OP', # order-pausing disruptions ... disruption_probability=0.1, ... recovery_probability=0.3 ... ) >>> dp.disrupted = True >>> dp.update_disruption_state() >>> dp.disrupted True >>> dp.update_disruption_state() >>> dp.disrupted False >>> # Calculate steady-state probabilities of being up and down. >>> pi_up, pi_down = dp.steady_state_probabilities() >>> pi_up, pi_down (0.7499999999999999, 0.25)
API Reference¶
- class DisruptionProcess(**kwargs)[source]¶
A
DisruptionProcessobject represents a disruption process that a node is subject to. Attributes specify the type of random process governing the disruption, as well as the type of disruption itself (i.e., its effects). The object keeps track of the current disruption state and generates new states according to the random process.- Parameters
**kwargs – Keyword arguments specifying values of one or more attributes of the
DisruptionProcess, e.g.,random_process_type='M'.
- random_process_type¶
The type of random process governing the disruptions, as a string. Currently supported strings are:
None
‘M’ (2-state Markovian)
‘E’ (explicit: disruption state for each period is provided explicitly)
- Type
str
- disruption_type¶
The type of disruption, as a string. Currently supported strings are:
‘OP’ (order-pausing: the stage cannot place orders during disruptions) (default)
‘SP’ (shipment-pausing: the stage can place orders during disruptions but its supplier(s) cannot ship them)
‘TP’ (transit-pausing: items in transit to the stage are paused during disruptions)
‘RP’ (receipt-pausing: items cannot be received by the disrupted stage; they accumulate just before the stage and are received when the disruption ends)
- Type
str
- disruption_probability¶
The probability that the node is disrupted in period \(t+1\) given that it is not disrupted in period t. Required if
random_process_type= ‘M’. [\(\alpha\)]- Type
float
- recovery_probability¶
The probability that the node is not disrupted in period \(t+1\) given that it is disrupted in period t. Required if
random_process_type= ‘M’. [\(\beta\)]- Type
float
- disruption_state_list¶
List of disruption states (
True/False, one per period), ifrandom_process_type='E'. If disruption state is required in a period beyond the length of the list, the list is restarted at the beginning. Required ifrandom_process_type= ‘E’.- Type
list, optional
- disrupted¶
Trueif the node is currently disrupted,Falseotherwise.- Type
bool
- validate_parameters()[source]¶
Check that appropriate parameters have been provided for the given random process type. Raise an exception if not.
- to_dict()[source]¶
Convert the
DisruptionProcessobject to a dict. List attributes (disruption_state_list) are deep-copied so changes to the original object do not get propagated to the dict.- Returns
The dict representation of the object.
- Return type
dict
- classmethod from_dict(the_dict)[source]¶
Return a new
DisruptionProcessobject with attributes copied from the values inthe_dict. List attributes (disruption_state_list) are deep-copied so changes to the original dict do not get propagated to the object. Any missing attributes are set to their default values.- Parameters
the_dict (dict) – Dict representation of a
DisruptionProcess, typically created usingto_dict().- Returns
The object converted from the dict.
- Return type
- update_disruption_state(period=None)[source]¶
Update the disruption state using the type specified in
random_process_typeand set thedisruptedattribute accordingly.If
random_process_typeisNone, setsdisruptedtoFalse.- Parameters
period (int, optional) – The period to update the disruption state for. If
random_process_type= ‘E’ (explicit), this is required ifdisruption_state_listis a list of disruption states, one per period. If omitted, will return first (or only) disruption state in list.