This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def sample_from_gamma_distribution(shape, scale): | |
| while True: | |
| yield np.random.default_rng().gamma(shape, scale) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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), | |
| }, | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |