Skip to content

Commit c75b38d

Browse files
committed
unravel delta before decided which to return
1 parent ea2d69c commit c75b38d

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

pycona/find_constraint/findc2.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,21 @@ def run(self, scope):
7676

7777
restore_scope_values(scope, scope_values)
7878

79+
# Unravel delta nested ands
80+
delta_unraveled = []
81+
for c in delta:
82+
if c.name == 'and':
83+
sub_list = []
84+
for sub_c in c.args:
85+
sub_list.append(sub_c)
86+
delta_unraveled.append(sub_list)
87+
else:
88+
delta_unraveled.append([c])
89+
7990
# Return random c in delta otherwise (if more than one, they are equivalent w.r.t. C_l)
8091
# Choose the constraint with the smallest number of conjunctions
81-
delta = sorted(delta, key=lambda x: len(x.args))
82-
return delta[0]
92+
delta_unraveled = sorted(delta_unraveled, key=lambda x: len(x))
93+
return delta_unraveled[0]
8394

8495
self.ca.metrics.increase_findc_queries()
8596

0 commit comments

Comments
 (0)