import csv from pathlib import Path def generateRawDataset(): battery_values = ['high', 'low'] distance_values = ['far', 'close'] mood_values = ['undefined', 'good', 'bad'] status_values = ['empty', 'new order', 'waiting for dish', 'have a dish'] other = ['no', 'yes'] training_data = [] training_data.append([ "Battery level", "Distance between kitchen and table", "Customers mood", "Basket is empty", "Dish is ready", "Dish in basket", "Table status", "Is actual", "Priority" ]) for battery in battery_values: for distance in distance_values: for mood in mood_values: for basket in other: for ready in other: for dish in other: for status in status_values: for actual in other: dataset = buildDataset( battery, distance, mood, basket, ready, dish, status, actual ) training_data.append(dataset) Path("out/").mkdir(parents=True, exist_ok=True) with open('out/rawDataset.csv', 'w', newline='') as file: writer = csv.writer(file) writer.writerows(training_data) def buildDataset(b, d, m, e, r, i, s, a) -> list: dataset = [ b, # battery d, # distance m, # mood e, # basket is empty r, # ready i, # dish in basket s, # status a, # actual ] dataset.append(getPriority(dataset)) return dataset def getPriority(dataset) -> str: PRIORITY = { 'high': 'high priority', 'low': 'low priority', 'kitchen': 'return to kitchen' } BATTERY_LEVEL = dataset[0] DISTANCE_TO_OBJECT = dataset[1] MOOD = dataset[2] BASKET_IS_EMPTY = dataset[3] DISH_IS_READY = dataset[4] DISH_IN_BASKET = dataset[5] STATUS_OF_TABLE = dataset[6] IS_ACTUAL = dataset[7] def mood_and_distance() -> str: if MOOD == "undefined": return PRIORITY['kitchen'] elif MOOD == "good": return PRIORITY['low'] elif DISTANCE_TO_OBJECT == "far": return PRIORITY['high'] else: return PRIORITY['low'] if BATTERY_LEVEL == "low": return PRIORITY['kitchen'] elif IS_ACTUAL == "no": return PRIORITY['high'] elif STATUS_OF_TABLE == "empty" or STATUS_OF_TABLE == "have a dish": return PRIORITY['kitchen'] elif STATUS_OF_TABLE == "new order": return mood_and_distance() elif BASKET_IS_EMPTY == "yes": return PRIORITY['kitchen'] elif DISH_IS_READY == "no": return PRIORITY['kitchen'] elif DISH_IN_BASKET == "no": return PRIORITY['kitchen'] else: return mood_and_distance()