Skip to content

Instantly share code, notes, and snippets.

View chrisschopp's full-sized avatar

Chris Schopp chrisschopp

View GitHub Profile
def sample_from_gamma_distribution(shape, scale):
while True:
yield np.random.default_rng().gamma(shape, scale)
step_list = [
{
"step_name": "STEP A",
"process_time": sample_from_gamma_distribution(shape=4, scale=1.0),
},
{
"step_name": "STEP B",
"process_time": sample_from_gamma_distribution(shape=4, scale=0.5),
},
{
def generate_interarrival_time(scale):
"""When called, returns the time until the next lot arrives
at the factory.
The scale parameter is passed to the exponential distribution,
where it is equal to the mean and standard deviation.
"""
while True:
yield np.random.exponential(scale)
def generate_lot_id():
'''Generator that assigns an incremental number to each lot,
starting with lot_id = 1.
'''
lot_id = 1
while True:
yield lot_id
lot_id += 1