From c0f746ec82676438239ccc7334a75dd0adaa69ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cem=20G=C3=B6kmen?= Date: Tue, 12 Mar 2024 01:26:58 -0700 Subject: [PATCH] Fully remove the assembled predicate --- .../domain_omnigibson.bddl | 1 - bddl/bddl_verification.py | 3 --- .../get_syn_prop_annots_canonical.py | 2 +- .../synsets_to_descriptors.json | 20 -------------- bddl/knowledge_base/models.py | 2 +- bddl/trivial_backend.py | 27 ------------------- 6 files changed, 2 insertions(+), 53 deletions(-) diff --git a/bddl/activity_definitions/domain_omnigibson.bddl b/bddl/activity_definitions/domain_omnigibson.bddl index 12e88cf1..30515da5 100644 --- a/bddl/activity_definitions/domain_omnigibson.bddl +++ b/bddl/activity_definitions/domain_omnigibson.bddl @@ -26,7 +26,6 @@ (insource ?obj1 ?obj2) (inroom ?obj1 ?obj2) (broken ?obj1) - (assembled ?obj1) (grasped ?obj1 ?obj2) ) ) diff --git a/bddl/bddl_verification.py b/bddl/bddl_verification.py index ab0f0f5b..d84160ac 100644 --- a/bddl/bddl_verification.py +++ b/bddl/bddl_verification.py @@ -298,9 +298,6 @@ def check_synset_predicate_alignment(atom, syns_to_props): if pred == "on_fire": assert "nonSubstance" in syns_to_props[objects[0]], f"Inapplicable on_fire: {atom}" assert "flammable" in syns_to_props[objects[0]], f"Inapplicable on_fire: {atom}" - if pred == "assembled": - assert "rigidBody" in syns_to_props[objects[0]], f"Inapplicable assembled: {atom}" - assert "assembleable" in syns_to_props[objects[0]], f"Inapplicable assembled: {atom}" if pred == "broken": assert "rigidBody" in syns_to_props[objects[0]], f"Inapplicable broken: {atom}" assert "breakable" in syns_to_props[objects[0]], f"Inapplicable broken: {atom}" diff --git a/bddl/data_generation/get_syn_prop_annots_canonical.py b/bddl/data_generation/get_syn_prop_annots_canonical.py index f426a3dc..c95604a7 100644 --- a/bddl/data_generation/get_syn_prop_annots_canonical.py +++ b/bddl/data_generation/get_syn_prop_annots_canonical.py @@ -47,7 +47,7 @@ "soakable": None, "wetable": "wet", "flammable": "on_fire", - "assembleable": "assembled", + "assembleable": None, "heatable" : "hot", "boilable": "boiling", "meltable" : "melted", diff --git a/bddl/generated_data/synsets_to_descriptors.json b/bddl/generated_data/synsets_to_descriptors.json index 72a6043b..6ff7648b 100644 --- a/bddl/generated_data/synsets_to_descriptors.json +++ b/bddl/generated_data/synsets_to_descriptors.json @@ -25552,10 +25552,6 @@ ] ], "cabinet.n.01": [ - [ - "assembled", - "assembled" - ], [ "disinfected", "disinfected" @@ -35186,10 +35182,6 @@ ] ], "clothesline.n.01": [ - [ - "assembled", - "assembled" - ], [ "disinfected", "disinfected" @@ -47360,10 +47352,6 @@ ] ], "desk.n.01": [ - [ - "assembled", - "assembled" - ], [ "disinfected", "disinfected" @@ -127086,10 +127074,6 @@ ] ], "shelf.n.01": [ - [ - "assembled", - "assembled" - ], [ "disinfected", "disinfected" @@ -144292,10 +144276,6 @@ ] ], "trampoline.n.01": [ - [ - "assembled", - "assembled" - ], [ "disinfected", "disinfected" diff --git a/bddl/knowledge_base/models.py b/bddl/knowledge_base/models.py index 832f74b4..caee806f 100644 --- a/bddl/knowledge_base/models.py +++ b/bddl/knowledge_base/models.py @@ -624,7 +624,7 @@ def uses_physical_substance(self): return any("physicalSubstance" in synset.property_names for synset in self.synsets) def uses_attachment(self): - return any(pred.name in ['assembled', 'attached'] for pred in self.uses_predicates) + return any(pred.name == 'attached' for pred in self.uses_predicates) def uses_cloth(self): return any(pred.name in ['folded', 'draped', 'unfolded'] for pred in self.uses_predicates) diff --git a/bddl/trivial_backend.py b/bddl/trivial_backend.py index 2a1dab3a..aaf49e70 100644 --- a/bddl/trivial_backend.py +++ b/bddl/trivial_backend.py @@ -39,7 +39,6 @@ def get_predicate_class(self, predicate_name): "draped": TrivialDrapedPredicate, "insource": TrivialInsourcePredicate, "broken": TrivialBrokenPredicate, - "assembled": TrivialAssembledPredicate, "grasped": TrivialGraspedPredicate, } return PREDICATE_MAPPING[predicate_name] @@ -61,7 +60,6 @@ def __init__(self): self.real = set() self.broken = set() self.closed = set() - self.assembled = set() # Binaries - populated with 2-tuples of string names self.saturated = set() self.covered = set() @@ -92,7 +90,6 @@ def create_predicate_to_setters(self): "on_fire": self.set_on_fire, "empty": self.set_empty, "broken": self.set_broken, - "assembled": self.set_assembled, "closed": self.set_closed, "future": self.set_future, "real": self.set_real, @@ -249,16 +246,6 @@ def set_broken(self, objs, is_broken): def get_broken(self, objs): return tuple(obj.name for obj in objs) in self.broken - def set_assembled(self, objs, is_assembled): - assert len(objs) == 1, f"`objs` has len other than 1: {objs}" - if is_assembled: - self.assembled.add(objs) - else: - self.assembled.discard(objs) - - def get_assembled(self, objs): - return tuple(obj.name for obj in objs) in self.assembled - def set_future(self, objs, is_future): assert len(objs) == 1, f"`objs` has len other than 1: {objs}" if is_future: @@ -458,9 +445,6 @@ def get_empty(self): def get_broken(self): return self.simulator.get_broken((self,)) - def get_assembled(self): - return self.simulator.get_assembled((self,)) - def get_future(self): return self.simulator.get_future((self,)) @@ -640,17 +624,6 @@ def _sample(self, obj1, binary_state): pass -class TrivialAssembledPredicate(UnaryAtomicFormula): - STATE_NAME = "assembled" - - def _evaluate(self, obj): - print(self.STATE_NAME, obj.name, obj.get_assembled()) - return obj.get_assembled() - - def _sample(self, obj1, binary_state): - pass - - class TrivialFuturePredicate(UnaryAtomicFormula): STATE_NAME = "future"