Skip to content

Commit

Permalink
Change check for non-zero types.
Browse files Browse the repository at this point in the history
  • Loading branch information
ashayathalye committed Oct 31, 2023
1 parent 68f7ac6 commit 1d64baa
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions predicators/approaches/grammar_search_invention_approach.py
Original file line number Diff line number Diff line change
Expand Up @@ -974,14 +974,11 @@ def _select_predicates_by_clustering(
types_in_effects = [
set(a.predicate.types) for a in seg.add_effects
]
if len(types_in_effects) == 0 or len(
set.union(*types_in_effects)) == 0:
# If there are no add effects or if the object
# arguments for all add effects are empty (which would
# happen if the add effects only involved Forall
# predicates that have no object arguments, e.g. in
# repeated_nextto), then don't cluster further.
continue
# To cluster on type, there must be types. That is, there
# must be add effects in the segment and the object
# arguments for at least one add effect must be nonempty.
assert len(types_in_effects) > 0 and len(
set.union(*types_in_effects)) > 0
types = tuple(sorted(list(set.union(*types_in_effects))))
types_to_segments.setdefault(types, []).append(seg)
logging.info(
Expand Down

0 comments on commit 1d64baa

Please sign in to comment.