diff --git a/bddl/activity_definitions/baking_cookies_for_the_PTA_bake_sale/problem0.bddl b/bddl/activity_definitions/baking_cookies_for_the_PTA_bake_sale/problem0.bddl index 76189d52..cf05f413 100644 --- a/bddl/activity_definitions/baking_cookies_for_the_PTA_bake_sale/problem0.bddl +++ b/bddl/activity_definitions/baking_cookies_for_the_PTA_bake_sale/problem0.bddl @@ -47,9 +47,7 @@ (ontop electric_mixer.n.01_1 countertop.n.01_1) (attached mixing_bowl.n.01_1 electric_mixer.n.01_1) (inroom oven.n.01_1 kitchen) - (inroom countertop.n.01_1 kitchen) - (inroom countertop.n.01_1 kitchen) - (inroom countertop.n.01_1 kitchen) + (inroom countertop.n.01_1 kitchen) (inside bowl.n.01_1 electric_refrigerator.n.01_1) (inroom electric_refrigerator.n.01_1 kitchen) (ontop cookie_sheet.n.01_1 countertop.n.01_1) diff --git a/bddl/activity_definitions/changing_light_bulbs/problem0.bddl b/bddl/activity_definitions/changing_light_bulbs/problem0.bddl index 19d2aa7f..04b45eb3 100644 --- a/bddl/activity_definitions/changing_light_bulbs/problem0.bddl +++ b/bddl/activity_definitions/changing_light_bulbs/problem0.bddl @@ -13,8 +13,8 @@ (:init (ontop table_lamp.n.01_2 floor.n.01_2) (ontop light_bulb.n.01_1 breakfast_table.n.01_1) - (ontop light_bulb.n.01_2 breakfast_table.n.01_1) - (not + (ontop light_bulb.n.01_2 breakfast_table.n.01_1) + (not (toggled_on table_lamp.n.01_1) ) (not diff --git a/bddl/activity_definitions/clean_a_beer_keg/problem0.bddl b/bddl/activity_definitions/clean_a_beer_keg/problem0.bddl index 60f2c4a3..035ed535 100644 --- a/bddl/activity_definitions/clean_a_beer_keg/problem0.bddl +++ b/bddl/activity_definitions/clean_a_beer_keg/problem0.bddl @@ -28,7 +28,6 @@ (inroom countertop.n.01_1 kitchen) (ontop agent.n.01_1 floor.n.01_1) (filled disinfectant__bottle.n.01_1 disinfectant.n.01_1) - (ontop disinfectant__bottle.n.01_1 floor.n.01_1) ) (:goal diff --git a/bddl/activity_definitions/cleaning_driveway/problem0.bddl b/bddl/activity_definitions/cleaning_driveway/problem0.bddl index 531e19f7..2f69fb34 100644 --- a/bddl/activity_definitions/cleaning_driveway/problem0.bddl +++ b/bddl/activity_definitions/cleaning_driveway/problem0.bddl @@ -12,11 +12,9 @@ (:init (covered driveway.n.01_1 bunchgrass.n.01_1) - (covered driveway.n.01_1 dust.n.01_1) - (not - (ontop broom.n.01_1 driveway.n.01_1) - ) - (inroom driveway.n.01_1 garden) + (covered driveway.n.01_1 dust.n.01_1) + (ontop broom.n.01_1 driveway.n.01_1) + (inroom driveway.n.01_1 garden) (inroom floor.n.01_1 garden) (ontop agent.n.01_1 floor.n.01_1) ) diff --git a/bddl/activity_definitions/cleaning_glasses_off_bar/problem0.bddl b/bddl/activity_definitions/cleaning_glasses_off_bar/problem0.bddl index c9b526db..f0f2b346 100644 --- a/bddl/activity_definitions/cleaning_glasses_off_bar/problem0.bddl +++ b/bddl/activity_definitions/cleaning_glasses_off_bar/problem0.bddl @@ -32,7 +32,6 @@ (ontop wineglass.n.01_2 bar.n.02_1) (ontop wineglass.n.01_3 bar.n.02_1) (ontop beer_glass.n.01_1 bar.n.02_1) - (ontop beer_glass.n.01_1 bar.n.02_1) (ontop beer_glass.n.01_2 bar.n.02_1) (inroom bar.n.02_1 bar) (inroom sink.n.01_1 bar) diff --git a/bddl/activity_definitions/clearing_table_after_breakfast/problem0.bddl b/bddl/activity_definitions/clearing_table_after_breakfast/problem0.bddl index 0ed64078..81385009 100644 --- a/bddl/activity_definitions/clearing_table_after_breakfast/problem0.bddl +++ b/bddl/activity_definitions/clearing_table_after_breakfast/problem0.bddl @@ -29,8 +29,7 @@ (ontop pitcher.n.02_1 breakfast_table.n.01_1) (covered mug.n.04_1 chocolate_milk.n.01_1) (filled pitcher.n.02_1 chocolate_milk.n.01_1) - (inside pitcher.n.02_1 electric_refrigerator.n.01_1) - (insource sink.n.01_1 water.n.06_1) + (insource sink.n.01_1 water.n.06_1) (inroom shelf.n.01_1 kitchen) (inroom sink.n.01_1 kitchen) (inroom electric_refrigerator.n.01_1 kitchen) diff --git a/bddl/activity_definitions/cold_brew_coffee/problem0.bddl b/bddl/activity_definitions/cold_brew_coffee/problem0.bddl index cd25db1c..cf5099ae 100644 --- a/bddl/activity_definitions/cold_brew_coffee/problem0.bddl +++ b/bddl/activity_definitions/cold_brew_coffee/problem0.bddl @@ -18,8 +18,7 @@ (ontop mason_jar.n.01_1 countertop.n.01_1) (ontop tablespoon.n.02_1 countertop.n.01_1) (insource sink.n.01_1 water.n.06_1) - (ontop mason_jar.n.01_1 countertop.n.01_1) - (inroom countertop.n.01_1 kitchen) + (inroom countertop.n.01_1 kitchen) (inroom sink.n.01_1 kitchen) (inroom floor.n.01_1 kitchen) (inroom electric_refrigerator.n.01_1 kitchen) diff --git a/bddl/activity_definitions/cook_ground_beef/problem0.bddl b/bddl/activity_definitions/cook_ground_beef/problem0.bddl index fc3026f0..e2f54619 100644 --- a/bddl/activity_definitions/cook_ground_beef/problem0.bddl +++ b/bddl/activity_definitions/cook_ground_beef/problem0.bddl @@ -29,8 +29,7 @@ (insource salt__shaker.n.01_1 salt.n.02_1) (ontop salt__shaker.n.01_1 countertop.n.01_1) (filled bowl.n.01_1 ground_beef.n.01_1) - (inside bowl.n.01_1 electric_refrigerator.n.01_1) - (inroom oven.n.01_1 kitchen) + (inroom oven.n.01_1 kitchen) (inroom electric_refrigerator.n.01_1 kitchen) (inroom countertop.n.01_1 kitchen) (inroom floor.n.01_1 kitchen) diff --git a/bddl/activity_definitions/cook_tofu/problem0.bddl b/bddl/activity_definitions/cook_tofu/problem0.bddl index de1e5b40..36d439bc 100644 --- a/bddl/activity_definitions/cook_tofu/problem0.bddl +++ b/bddl/activity_definitions/cook_tofu/problem0.bddl @@ -33,7 +33,6 @@ (cooked tofu.n.02_4) ) (inside wok.n.01_1 cabinet.n.01_1) - (inside wok.n.01_1 cabinet.n.01_1) (insource sink.n.01_1 water.n.06_1) (inroom electric_refrigerator.n.01_1 kitchen) (inroom floor.n.01_1 kitchen) diff --git a/bddl/activity_definitions/defrosting_freezer/problem0.bddl b/bddl/activity_definitions/defrosting_freezer/problem0.bddl index 518943b4..68af9b96 100644 --- a/bddl/activity_definitions/defrosting_freezer/problem0.bddl +++ b/bddl/activity_definitions/defrosting_freezer/problem0.bddl @@ -2,7 +2,6 @@ (:domain omnigibson) (:objects - stain.n.01_1 - stain.n.01 floor.n.01_1 - floor.n.01 electric_refrigerator.n.01_1 - electric_refrigerator.n.01 sink.n.01_1 - sink.n.01 @@ -16,17 +15,11 @@ agent.n.01_1 - agent.n.01 ) - (:init - (not - (covered sink.n.01_1 stain.n.01_1) - ) + (:init (ontop dustpan.n.02_1 floor.n.01_1) (ontop bucket.n.01_1 floor.n.01_1) (ontop scraper.n.01_1 countertop.n.01_1) - (ontop towel.n.01_1 countertop.n.01_1) - (not - (covered towel.n.01_1 stain.n.01_1) - ) + (ontop towel.n.01_1 countertop.n.01_1) (ontop rag.n.01_1 countertop.n.01_1) (inside crayfish.n.02_1 electric_refrigerator.n.01_1) (inside crayfish.n.02_2 electric_refrigerator.n.01_1) diff --git a/bddl/activity_definitions/drape_window_scarves/problem0.bddl b/bddl/activity_definitions/drape_window_scarves/problem0.bddl index 3e8af415..cfdd08bf 100644 --- a/bddl/activity_definitions/drape_window_scarves/problem0.bddl +++ b/bddl/activity_definitions/drape_window_scarves/problem0.bddl @@ -10,10 +10,9 @@ ) (:init - (ontop curtain.n.01_1 floor.n.01_1) - (attached curtain_rod.n.01_1 wall.n.01_1) - (ontop curtain.n.01_1 floor.n.01_1) - (inroom floor.n.01_1 bedroom) + (ontop curtain.n.01_1 floor.n.01_1) + (attached curtain_rod.n.01_1 wall.n.01_1) + (inroom floor.n.01_1 bedroom) (inroom wall.n.01_1 bedroom) (ontop agent.n.01_1 floor.n.01_1) ) diff --git a/bddl/activity_definitions/make_a_vinegar_cleaning_solution/problem0.bddl b/bddl/activity_definitions/make_a_vinegar_cleaning_solution/problem0.bddl index 6ea028c4..e5388222 100644 --- a/bddl/activity_definitions/make_a_vinegar_cleaning_solution/problem0.bddl +++ b/bddl/activity_definitions/make_a_vinegar_cleaning_solution/problem0.bddl @@ -24,8 +24,7 @@ (ontop lemon_juice__bottle.n.01_1 countertop.n.01_1) (ontop tablespoon.n.02_1 countertop.n.01_1) (ontop erlenmeyer_flask.n.01_1 countertop.n.01_1) - (ontop vinegar__bottle.n.01_1 countertop.n.01_1) - (inroom countertop.n.01_1 kitchen) + (inroom countertop.n.01_1 kitchen) (inroom sink.n.01_1 kitchen) (future vinegar_cleaning_solution.n.01_1) (inroom floor.n.01_1 kitchen) diff --git a/bddl/activity_definitions/make_chicken_fajitas/problem0.bddl b/bddl/activity_definitions/make_chicken_fajitas/problem0.bddl index f617c33b..9bc1c1ca 100644 --- a/bddl/activity_definitions/make_chicken_fajitas/problem0.bddl +++ b/bddl/activity_definitions/make_chicken_fajitas/problem0.bddl @@ -55,12 +55,10 @@ (inside bell_pepper.n.02_1 electric_refrigerator.n.01_1) (inside beefsteak_tomato.n.01_1 electric_refrigerator.n.01_1) (ontop vidalia_onion.n.01_1 countertop.n.01_1) - (ontop beefsteak_tomato.n.01_1 countertop.n.01_1) (ontop pepper__shaker.n.01_1 countertop.n.01_1) (ontop chopping_board.n.01_1 countertop.n.01_1) (ontop carving_knife.n.01_1 countertop.n.01_1) (insource pepper__shaker.n.01_1 black_pepper.n.02_1) - (ontop pepper__shaker.n.01_1 countertop.n.01_1) (insource salt__shaker.n.01_1 salt.n.02_1) (ontop salt__shaker.n.01_1 countertop.n.01_1) (insource marjoram__shaker.n.01_1 marjoram.n.02_1) diff --git a/bddl/activity_definitions/make_cookie_dough/problem0.bddl b/bddl/activity_definitions/make_cookie_dough/problem0.bddl index d27f5b7c..f808c4fa 100644 --- a/bddl/activity_definitions/make_cookie_dough/problem0.bddl +++ b/bddl/activity_definitions/make_cookie_dough/problem0.bddl @@ -37,8 +37,7 @@ (filled vanilla__bottle.n.01_1 vanilla.n.02_1) (inside vanilla__bottle.n.01_1 electric_refrigerator.n.01_1) (inside butter.n.01_1 bowl.n.01_1) - (inside bowl.n.01_1 electric_refrigerator.n.01_1) - (ontop bowl.n.01_1 countertop.n.01_2) + (ontop bowl.n.01_1 countertop.n.01_2) (filled baking_powder__jar.n.01_1 baking_powder.n.01_1) (inside baking_powder__jar.n.01_1 cabinet.n.01_1) (insource salt__shaker.n.01_1 salt.n.02_1) diff --git a/bddl/activity_definitions/make_fish_and_chips/problem0.bddl b/bddl/activity_definitions/make_fish_and_chips/problem0.bddl index f03490b0..214dad17 100644 --- a/bddl/activity_definitions/make_fish_and_chips/problem0.bddl +++ b/bddl/activity_definitions/make_fish_and_chips/problem0.bddl @@ -17,8 +17,7 @@ ) (:init - (ontop trout.n.01_1 countertop.n.01_1) - (not + (not (cooked trout.n.01_1) ) (frozen trout.n.01_1) diff --git a/bddl/activity_definitions/make_limeade/problem0.bddl b/bddl/activity_definitions/make_limeade/problem0.bddl index bb849319..81f27dd2 100644 --- a/bddl/activity_definitions/make_limeade/problem0.bddl +++ b/bddl/activity_definitions/make_limeade/problem0.bddl @@ -27,8 +27,7 @@ (inside lime_juice__bottle.n.01_1 electric_refrigerator.n.01_1) (ontop pitcher.n.02_1 countertop.n.01_1) (ontop wooden_spoon.n.02_1 countertop.n.01_1) - (ontop pitcher.n.02_1 countertop.n.01_1) - (inside ice_cube.n.01_1 bowl.n.01_1) + (inside ice_cube.n.01_1 bowl.n.01_1) (inside ice_cube.n.01_2 bowl.n.01_1) (inside ice_cube.n.01_3 bowl.n.01_1) (inside ice_cube.n.01_4 bowl.n.01_1) diff --git a/bddl/activity_definitions/make_red_beans_and_rice/problem0.bddl b/bddl/activity_definitions/make_red_beans_and_rice/problem0.bddl index 3eaf4286..bc35bc74 100644 --- a/bddl/activity_definitions/make_red_beans_and_rice/problem0.bddl +++ b/bddl/activity_definitions/make_red_beans_and_rice/problem0.bddl @@ -43,7 +43,6 @@ (ontop clove.n.03_1 chopping_board.n.01_1) (ontop clove.n.03_2 chopping_board.n.01_1) (ontop clove.n.03_3 chopping_board.n.01_1) - (ontop chopping_board.n.01_1 countertop.n.01_1) (filled mason_jar.n.01_1 kidney_bean.n.01_1) (ontop mason_jar.n.01_1 countertop.n.01_1) (ontop beefsteak_tomato.n.01_1 countertop.n.01_1) diff --git a/bddl/activity_definitions/make_the_workplace_exciting/problem0.bddl b/bddl/activity_definitions/make_the_workplace_exciting/problem0.bddl index 70ad8f8d..71750c26 100644 --- a/bddl/activity_definitions/make_the_workplace_exciting/problem0.bddl +++ b/bddl/activity_definitions/make_the_workplace_exciting/problem0.bddl @@ -18,7 +18,6 @@ (attached poster.n.01_1 wall.n.01_1) ) (inside board_game.n.01_1 carton.n.02_2) - (inside board_game.n.01_1 carton.n.02_2) (inside coffee_maker.n.01_1 carton.n.02_1) (ontop carton.n.02_1 floor.n.01_1) (ontop carton.n.02_2 floor.n.01_1) diff --git a/bddl/activity_definitions/passing_out_drinks/problem0.bddl b/bddl/activity_definitions/passing_out_drinks/problem0.bddl index 29e134e3..0cb060b0 100644 --- a/bddl/activity_definitions/passing_out_drinks/problem0.bddl +++ b/bddl/activity_definitions/passing_out_drinks/problem0.bddl @@ -18,12 +18,10 @@ (:init (filled beer_bottle.n.01_1 beer.n.01_1) (inside beer_bottle.n.01_1 cabinet.n.01_1) - (inside beer_bottle.n.01_1 cabinet.n.01_1) (inside bottle__of__champagne.n.01_1 cabinet.n.01_1) (filled pitcher.n.02_1 martini.n.01_1) (inside pitcher.n.02_1 cabinet.n.01_1) (inside wineglass.n.01_1 cabinet.n.01_1) - (inside wineglass.n.01_1 cabinet.n.01_1) (inside beer_glass.n.01_1 cabinet.n.01_1) (inroom floor.n.01_1 dining_room) (inroom breakfast_table.n.01_1 dining_room) diff --git a/bddl/activity_definitions/prepare_wine_and_cheese/problem0.bddl b/bddl/activity_definitions/prepare_wine_and_cheese/problem0.bddl index d5f1e1e3..ad67fa21 100644 --- a/bddl/activity_definitions/prepare_wine_and_cheese/problem0.bddl +++ b/bddl/activity_definitions/prepare_wine_and_cheese/problem0.bddl @@ -28,8 +28,7 @@ (:init (ontop cheddar.n.02_1 plate.n.04_1) (ontop feta.n.01_1 plate.n.04_1) - (inside plate.n.04_1 electric_refrigerator.n.01_1) - (filled wine_bottle.n.01_1 white_wine.n.01_1) + (filled wine_bottle.n.01_1 white_wine.n.01_1) (filled wine_bottle.n.01_2 champagne.n.01_1) (inside wine_bottle.n.01_1 electric_refrigerator.n.01_1) (inside wine_bottle.n.01_2 electric_refrigerator.n.01_1) diff --git a/bddl/activity_definitions/putting_up_outdoor_holiday_decorations/problem0.bddl b/bddl/activity_definitions/putting_up_outdoor_holiday_decorations/problem0.bddl index 4cdb85a6..aace4d5c 100644 --- a/bddl/activity_definitions/putting_up_outdoor_holiday_decorations/problem0.bddl +++ b/bddl/activity_definitions/putting_up_outdoor_holiday_decorations/problem0.bddl @@ -31,7 +31,6 @@ (inroom wall.n.01_1 garden) (inroom floor.n.01_2 living_room) (inroom rail_fence.n.01_1 garden) - (ontop pot_plant.n.01_1 floor.n.01_1) (ontop agent.n.01_1 floor.n.01_2) ) diff --git a/bddl/activity_definitions/removing_ice_from_walkways/problem0.bddl b/bddl/activity_definitions/removing_ice_from_walkways/problem0.bddl index f3a19769..a3114871 100644 --- a/bddl/activity_definitions/removing_ice_from_walkways/problem0.bddl +++ b/bddl/activity_definitions/removing_ice_from_walkways/problem0.bddl @@ -26,8 +26,7 @@ (ontop shovel.n.01_1 driveway.n.01_1) (filled bucket.n.01_1 water.n.06_1) (filled bucket.n.01_1 rubbing_alcohol.n.01_1) - (ontop shovel.n.01_1 wall.n.01_1) - (ontop bucket.n.01_1 driveway.n.01_1) + (ontop bucket.n.01_1 driveway.n.01_1) (inroom driveway.n.01_1 garden) (inroom wall.n.01_1 garden) (inroom floor.n.01_1 garden) diff --git a/bddl/activity_definitions/set_a_fancy_table/problem0.bddl b/bddl/activity_definitions/set_a_fancy_table/problem0.bddl index d12dd295..0ed793d4 100644 --- a/bddl/activity_definitions/set_a_fancy_table/problem0.bddl +++ b/bddl/activity_definitions/set_a_fancy_table/problem0.bddl @@ -33,7 +33,6 @@ (ontop table_knife.n.01_1 console_table.n.01_1) (ontop tablefork.n.01_1 console_table.n.01_1) (ontop wine_bottle.n.01_1 console_table.n.01_1) - (ontop tablespoon.n.02_1 console_table.n.01_1) (ontop saucer.n.02_1 console_table.n.01_1) (ontop plate.n.04_1 console_table.n.01_1) (ontop bouquet.n.01_1 console_table.n.01_1) diff --git a/bddl/activity_definitions/store_silver_coins/problem0.bddl b/bddl/activity_definitions/store_silver_coins/problem0.bddl index 7650e118..41e8545f 100644 --- a/bddl/activity_definitions/store_silver_coins/problem0.bddl +++ b/bddl/activity_definitions/store_silver_coins/problem0.bddl @@ -2,7 +2,7 @@ (:domain omnigibson) (:objects - silver.n.02_1 silver.n.02_3 - silver.n.02 + silver.n.02_1 silver.n.02_2 - silver.n.02 hand_towel.n.01_1 - hand_towel.n.01 breakfast_table.n.01_1 - breakfast_table.n.01 cup.n.01_1 - cup.n.01 @@ -13,9 +13,8 @@ (:init (ontop silver.n.02_1 breakfast_table.n.01_1) - (ontop silver.n.02_1 breakfast_table.n.01_1) - (ontop silver.n.02_3 breakfast_table.n.01_1) - (ontop hand_towel.n.01_1 breakfast_table.n.01_1) + (ontop silver.n.02_2 breakfast_table.n.01_1) + (ontop hand_towel.n.01_1 breakfast_table.n.01_1) (ontop cup.n.01_1 breakfast_table.n.01_1) (inroom cabinet.n.01_1 private_office) (inroom breakfast_table.n.01_1 private_office) diff --git a/bddl/activity_definitions/wash_towels/problem0.bddl b/bddl/activity_definitions/wash_towels/problem0.bddl index 8e4ce0bc..01479811 100644 --- a/bddl/activity_definitions/wash_towels/problem0.bddl +++ b/bddl/activity_definitions/wash_towels/problem0.bddl @@ -16,7 +16,6 @@ (ontop bath_towel.n.01_2 washer.n.03_1) (ontop bath_towel.n.01_1 floor.n.01_1) (covered bath_towel.n.01_1 dirt.n.02_1) - (ontop bath_towel.n.01_2 floor.n.01_1) (covered bath_towel.n.01_2 dirt.n.02_1) (ontop detergent__bottle.n.01_1 floor.n.01_1) (filled detergent__bottle.n.01_1 detergent.n.02_1) diff --git a/bddl/bddl_verification.py b/bddl/bddl_verification.py index f1260565..698778b6 100644 --- a/bddl/bddl_verification.py +++ b/bddl/bddl_verification.py @@ -116,21 +116,13 @@ "lobby" ]) PLACEMENTS = set([ - # "connected", - "ontop", + "ontop", "inside", "under", - "filled", - "covered", - "overlaid", - "saturated", - "inroom", - "insource", - # "hung", + "overlaid", "future", "attached", "draped", - "contains" ]) SUBSTANCE_PLACEMENTS = set(["saturated", "filled", "covered", "insource", "contains"]) FUTURE_PREDICATE = "future" @@ -482,24 +474,52 @@ def all_objects_placed(init): insts = _get_instances_in_init(init) insts = set([inst for inst in insts if ["future", inst] not in init]) - # Make sure everything not set to `future` is placed relative to a ROOM - placed_insts = set() - old_placed_insts = set() - saturated = False - while not saturated: - for inst in insts: - if inst in placed_insts: + in_room_check = True + last_placed = None + while True: + newly_placed = set() + for literal in init: + # Skip not literals + if literal[0] == "not": continue - for literal in init: - formula = literal[1] if literal[0] == "not" else literal - # NOTE only uncomment below line suffix when dealing with situations where substance and object have been flipped - if (formula[0] == FUTURE_PREDICATE and formula[1] == inst) or ((formula[0] in PLACEMENTS) and (formula[1] == inst) and ((formula[2] in ROOMS) or (formula[2] in placed_insts))) or ((formula[0] in SUBSTANCE_PLACEMENTS) and (formula[1] in placed_insts) and (formula[2] == inst)): - placed_insts.add(inst) - saturated = old_placed_insts == placed_insts - old_placed_insts = copy.deepcopy(placed_insts) - assert not placed_insts.difference(insts), "There are somehow placed insts that are not in the overall set of insts." - assert placed_insts == insts, f"Unplaced object instances: {insts.difference(placed_insts)}" + formula = literal + # Skip future literals + if formula[0] == "future": + continue + inst = None + substance_placement = False + if in_room_check: + # For the first round, check for inroom + if (formula[0] == "inroom") and (formula[2] in ROOMS): + inst = formula[1] + else: + # For the following rounds, check for placements w.r.t last placed objects + if (formula[0] in PLACEMENTS) and (formula[2] in last_placed): + inst = formula[1] + # Or substasnce placements w.r.t last placed objects + elif (formula[0] in SUBSTANCE_PLACEMENTS) and (formula[1] in last_placed): + inst = formula[2] + substance_placement = True + + if inst is not None: + # If it's not a substance placement, we make sure it's only placed once (e.g. we should not place the + # same eapple on table1 and on table2). If it's a substance placement, it's fine (e.g. we can do stain + # covering table1 and table2) + if not substance_placement: + assert inst not in newly_placed, f"Object {inst} is placed twice" + newly_placed.add(inst) + + # If no new objects were placed, we're done + if len(newly_placed) == 0: + break + + # Otherwise, we remove the newly placed objects from the list of objects to place and continue + insts -= newly_placed + last_placed = newly_placed + in_room_check = False + # If there are any objects left, they are unplaced + assert len(insts) == 0, f"Unplaced object instances: {insts}" def no_invalid_synsets(objects, init, goal, syns_to_props): instances, categories = _get_objects_from_object_list(objects)