diff --git a/CHANGELOG.md b/CHANGELOG.md index e4588eeeee80e1ec95ab93b73bada06d73aa088b..74397a3636be258418142eec3079aa0b28e3d3fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ ### Added +- Recipe graphs contain the names of the interactive counters and equipment +- Random agent also gets the recipe graph information. + ### Changed - `CooperativeCuisine` occurrences to `Cooperative Cuisine` @@ -23,6 +26,8 @@ ### Fixed +- Random Order generation does not depend on other sampling of random numbers. + ### Security ## [1.1.1] (2024-04-03) diff --git a/cooperative_cuisine/configs/agents/random_agent.py b/cooperative_cuisine/configs/agents/random_agent.py index 6d8830d94c5570bc6642936a0f34b47b94a8c8bc..506f2a633a6baf42733f8cc9bdfa39fa8bf48a0c 100644 --- a/cooperative_cuisine/configs/agents/random_agent.py +++ b/cooperative_cuisine/configs/agents/random_agent.py @@ -50,10 +50,12 @@ async def agent(): parser.add_argument("--player_id", type=str) parser.add_argument("--player_hash", type=str) parser.add_argument("--step_time", type=float, default=0.1) + parser.add_argument("--recipe_graph", type=str, default="") args = parser.parse_args() async with (connect(args.uri) as websocket): + recipe_graph = json.loads(args.recipe_graph) await websocket.send( json.dumps({"type": "ready", "player_hash": args.player_hash}) ) diff --git a/cooperative_cuisine/pygame_2d_vis/gui.py b/cooperative_cuisine/pygame_2d_vis/gui.py index 20ff8d1acd3f2d02e36cb5a2cb33198f0ea8cbca..65619e26e2d6d79235d8c5b47a88d91c1b30bfdc 100644 --- a/cooperative_cuisine/pygame_2d_vis/gui.py +++ b/cooperative_cuisine/pygame_2d_vis/gui.py @@ -1756,6 +1756,7 @@ class PyGameGUI: f'--uri {player_info["websocket_url"]}', f"--player_hash {player_hash}", f"--player_id {player_id}", + f"--recipe_graph '{json.dumps(self.level_info['recipe_graphs'])}'", ] ), shell=True, diff --git a/cooperative_cuisine/validation.py b/cooperative_cuisine/validation.py index 111edaf73d760b87e97e053b6b55b83420ae578c..c87d208a2a320a0aa67fc6535aa1095686926c2d 100644 --- a/cooperative_cuisine/validation.py +++ b/cooperative_cuisine/validation.py @@ -34,6 +34,9 @@ class MealGraphDict(TypedDict): """A dictionary mapping cooking step names to their layout coordinates.""" score: float """The max possible score of the meal.""" + info: dict[str, list[str]] + """The names of the `interactive_counter` and `equipment` (not the ids of the individual). Is not reduced to the + meal.""" class Validation: @@ -70,6 +73,21 @@ class Validation: self.recipe_graph_dicts: dict | None = None """A dictionary containing recipe graphs for each meal. For visualisation of the recipes.""" + self.interactive_counter = [ + c + for c in self.item_info + if self.item_info[c].type == ItemType.Equipment + and not self.item_info[c].equipment + ] + """The list of names of stationary mentioned equipments like stove, cutting board but not pot etc.""" + self.equipments = [ + eq + for eq in self.item_info + if self.item_info[eq].type == ItemType.Equipment + and self.item_info[eq].equipment + ] + """The list of names of the equipments in the environment.""" + @staticmethod def infer_recipe_graph(item_info) -> DiGraph: """Generate a graph from ingredients and meals and their dependencies. @@ -210,6 +228,10 @@ class Validation: "edges": list(graph.edges), "layout": layout, "score": score, + "info": { + "interactive_counter": self.interactive_counter, + "equipment": self.equipments, + }, } with open(generated_graph_layouts_path, "w") as f: self.recipe_graph_dicts[graph_hash] = graph_dict