@@ -2456,6 +2456,7 @@ def solutions_iterator(self):
2456
2456
self ._bmilp = _BijectionistMILP (self )
2457
2457
yield from self ._bmilp .solutions_iterator (False , [])
2458
2458
2459
+
2459
2460
class _BijectionistMILP ():
2460
2461
r"""
2461
2462
Wrapper class for the MixedIntegerLinearProgram (MILP). This
@@ -2590,7 +2591,6 @@ def show(self, variables=True):
2590
2591
print (f" { v } : " + "" .join ([f"s({ a } ) = "
2591
2592
for a in P [p ]]) + f"{ z } " )
2592
2593
2593
-
2594
2594
def _prepare_solution (self , on_blocks , solution ):
2595
2595
r"""
2596
2596
Return the solution as a dictionary from `A` (or `P`) to
@@ -2766,9 +2766,10 @@ def _is_solution(self, constraint, values):
2766
2766
variable_index = next (iter (v .dict ().keys ()))
2767
2767
index_block_value_dict [variable_index ] = (p , z )
2768
2768
2769
- evaluate = lambda f : sum (coeff if index == - 1 else
2770
- coeff * values [index_block_value_dict [index ]]
2771
- for index , coeff in f .dict ().items ())
2769
+ def evaluate (f ):
2770
+ return sum (coeff if index == - 1 else
2771
+ coeff * values [index_block_value_dict [index ]]
2772
+ for index , coeff in f .dict ().items ())
2772
2773
2773
2774
for lhs , rhs in constraint .equations ():
2774
2775
if evaluate (lhs - rhs ):
@@ -3052,6 +3053,7 @@ def sum_q(q):
3052
3053
for q in Q [1 :]:
3053
3054
self .milp .add_constraint (len (q0 )* sum_q (q ) == len (q )* v0 , name = f"h: ({ q } )~({ q0 } )" )
3054
3055
3056
+
3055
3057
def _invert_dict (d ):
3056
3058
"""
3057
3059
Return the dictionary whose keys are the values of the input and
@@ -3126,6 +3128,7 @@ def _non_copying_intersection(sets):
3126
3128
if s == result :
3127
3129
return s
3128
3130
3131
+
3129
3132
"""
3130
3133
TESTS::
3131
3134
0 commit comments