diff --git a/cooperative_cuisine/configs/study/level1/level1_config.yaml b/cooperative_cuisine/configs/study/level1/level1_config.yaml index 0a6b785cdb6c874271052400629ebac79aaab120..c46f38eb934564e140dfd13dac1e1301a66e76fc 100644 --- a/cooperative_cuisine/configs/study/level1/level1_config.yaml +++ b/cooperative_cuisine/configs/study/level1/level1_config.yaml @@ -14,8 +14,7 @@ meals: # if all: false -> only orders for these meals are generated # TODO: what if this list is empty? list: - - Salad - - TomatoSoup + - Burger layout_chars: _: Free diff --git a/cooperative_cuisine/orders.py b/cooperative_cuisine/orders.py index 0bb26170726813b31d6e0a2becfec3880fb61cb2..71c3d0fee28c966e1e799b165b356e43c5ea47e7 100644 --- a/cooperative_cuisine/orders.py +++ b/cooperative_cuisine/orders.py @@ -379,11 +379,15 @@ class RandomOrderGeneration(OrderGeneration): self.number_cur_orders = self.kwargs.num_start_meals if not self.kwargs.sample_on_serving: self.create_random_next_time_delta(now) - return self.create_orders_for_meals( - self.random.choices(self.available_meals, k=self.kwargs.num_start_meals), - now, - self.kwargs.sample_on_serving, - ) + if self.available_meals: + return self.create_orders_for_meals( + self.random.choices( + self.available_meals, k=self.kwargs.num_start_meals + ), + now, + self.kwargs.sample_on_serving, + ) + return [] def get_orders( self, @@ -392,6 +396,8 @@ class RandomOrderGeneration(OrderGeneration): new_finished_orders: list[Order], expired_orders: list[Order], ) -> list[Order]: + if not self.available_meals: + return [] self.number_cur_orders -= len(new_finished_orders) self.number_cur_orders -= len(expired_orders) if self.kwargs.sample_on_serving: diff --git a/cooperative_cuisine/validation.py b/cooperative_cuisine/validation.py index f4e8420435b89b03b3df85e3a6bc5a2b36a2d216..07c4f6617b45f87af38de69bd7f1423a8db9e4a2 100644 --- a/cooperative_cuisine/validation.py +++ b/cooperative_cuisine/validation.py @@ -265,6 +265,8 @@ class Validation: # print("FINAL MEALS:", meals_to_be_ordered) def get_recipe_graphs(self) -> list[MealGraphDict]: + if not self.order_manager.available_meals: + return [] os.makedirs(ROOT_DIR / "generated", exist_ok=True) # time_start = time.time()