Skip to content

Commit

Permalink
Update product parameters with integers
Browse files Browse the repository at this point in the history
Parameters updated to integers:
* Temperature
* Time
Fix incorrect multiples for temperatures and boxing and oven capacities
  • Loading branch information
argenos committed Nov 28, 2017
1 parent 3c4abc5 commit 36d75a3
Show file tree
Hide file tree
Showing 4 changed files with 3,552 additions and 3,129 deletions.
13 changes: 7 additions & 6 deletions config/scenarios.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ random: # Scenario name
heating_rate: # chosen at random between max and min
max: 5
min: 1
products: # chosen at random
dough_prep_time: [0.25, 0.5] # between .25 and 0.5
resting_time: [0.33, 1.25] # to 1.25
item_prep_time: [0.02, 0.1] # per item
products: # chosen at random. Time values are given in seconds for the time being
# TODO define if time is real seconds or simulated minutes
dough_prep_time: [5, 15] # between .25 and 0.5
resting_time: [20, 75] # to 1.25
item_prep_time: [2, 5] # per item
breads_per_oven: 16 # Multiples of 2
baking_time: [0.2,0.4]
baking_time: [12, 25]
baking_temp: [180, 200]
cooling_rate: [0.01,0.03]
cooling_rate: [5, 20]
boxing_temp: [40,60] # <40
breads_per_box: 15 # Multiples of 5
production_cost: [0.3, 2]
Expand Down
32 changes: 21 additions & 11 deletions factory/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,24 @@ class Product(object):
"""docstring for Product."""
def __init__(self, id, params):
self.guid = id
self.dough_prep_time = uniform(*params['dough_prep_time'])
self.resting_time = uniform(*params['resting_time'])
self.item_prep_time = uniform(*params['item_prep_time'])
self.breads_per_oven = randint(4, params['breads_per_oven']*2)/2
self.baking_time = uniform(*params['baking_time'])
self.baking_temp = uniform(*params['baking_temp'])
self.cooling_rate = uniform(*params['cooling_rate'])
self.boxing_temp = uniform(*params['boxing_temp'])
self.breads_per_box = randint(25, params['breads_per_box']*5)/5
self.production_cost = uniform(*params['production_cost'])
self.sales_price = uniform(*params['sales_price'])

# Preparation
self.dough_prep_time = randint(*params['dough_prep_time'])
self.resting_time = randint(*params['resting_time'])
self.item_prep_time = randint(*params['item_prep_time'])

# Baking
self.breads_per_oven = randint(4, params['breads_per_oven'])
self.breads_per_oven = self.breads_per_oven - self.breads_per_oven % 2
self.baking_time = randint(*params['baking_time'])
self.baking_temp = randint(*params['baking_temp'])
self.baking_temp = self.baking_temp - self.baking_temp % 5
self.cooling_rate = randint(*params['cooling_rate'])

# Packaging
self.boxing_temp = randint(*params['boxing_temp'])
self.boxing_temp = self.boxing_temp - self.boxing_temp % 5
self.breads_per_box = randint(5, params['breads_per_box'])
self.breads_per_box = self.breads_per_box - self.breads_per_box % 5
self.production_cost = round(uniform(*params['production_cost']), 2)
self.sales_price = round(uniform(*params['sales_price']), 2)
Loading

0 comments on commit 36d75a3

Please sign in to comment.