|
42 | 42 | `(s, wex, fix) \sim (llis, des, adj)`::
|
43 | 43 |
|
44 | 44 | sage: N = 3
|
45 |
| - sage: As = [list(Permutations(n)) for n in range(N+1)] |
46 |
| - sage: A = B = sum(As, []) |
| 45 | + sage: A = B = [pi for n in range(N+1) for pi in Permutations(n)] |
47 | 46 | sage: alpha1 = lambda p: len(p.weak_excedences())
|
48 | 47 | sage: alpha2 = lambda p: len(p.fixed_points())
|
49 | 48 | sage: beta1 = lambda p: len(p.descents(final_descent=True)) if p else 0
|
|
106 | 105 | +-----------+---+--------+--------+--------+
|
107 | 106 |
|
108 | 107 | sage: from sage.combinat.cyclic_sieving_phenomenon import orbit_decomposition
|
109 |
| - sage: bij.set_constant_blocks(sum([orbit_decomposition(A, rotate_permutation) for A in As], [])) |
| 108 | + sage: bij.set_constant_blocks(orbit_decomposition(A, rotate_permutation)) |
110 | 109 | sage: bij.constant_blocks()
|
111 | 110 | {{[1, 3, 2], [2, 1, 3], [3, 2, 1]}}
|
112 | 111 | sage: next(bij.solutions_iterator())
|
|
124 | 123 | There is no rotation invariant statistic on non crossing set partitions which is equidistributed
|
125 | 124 | with the Strahler number on ordered trees::
|
126 | 125 |
|
127 |
| - sage: N = 8; As = [[SetPartition(d.to_noncrossing_partition()) for d in DyckWords(n)] for n in range(N)] |
128 |
| - sage: A = sum(As, []) |
129 |
| - sage: B = sum([list(OrderedTrees(n)) for n in range(1, N+1)], []) |
| 126 | + sage: N = 8; |
| 127 | + sage: A = [SetPartition(d.to_noncrossing_partition()) for n in range(N) for d in DyckWords(n)] |
| 128 | + sage: B = [t for n in range(1, N+1) for t in OrderedTrees(n)] |
130 | 129 | sage: theta = lambda m: SetPartition([[i % m.size() + 1 for i in b] for b in m])
|
131 | 130 |
|
132 | 131 | The following code is equivalent to ``tau = findstat(397)``::
|
|
144 | 143 | sage: bij = Bijectionist(A, B, tau)
|
145 | 144 | sage: bij.set_statistics((lambda a: a.size(), lambda b: b.node_number()-1))
|
146 | 145 | sage: from sage.combinat.cyclic_sieving_phenomenon import orbit_decomposition
|
147 |
| - sage: bij.set_constant_blocks(sum([orbit_decomposition(A_n, theta) for A_n in As], [])) |
| 146 | + sage: bij.set_constant_blocks(orbit_decomposition(A, theta)) |
148 | 147 | sage: list(bij.solutions_iterator())
|
149 | 148 | []
|
150 | 149 |
|
|
279 | 278 |
|
280 | 279 | Constant blocks::
|
281 | 280 |
|
282 |
| - sage: A = B = list('abcd') |
| 281 | + sage: A = B = 'abcd' |
283 | 282 | sage: pi = lambda p1, p2: 'abcdefgh'[A.index(p1) + A.index(p2)]
|
284 | 283 | sage: rho = lambda s1, s2: (s1 + s2) % 2
|
285 | 284 | sage: bij = Bijectionist(A, B, lambda x: B.index(x) % 2, P=[['a', 'c']], pi_rho=((2, pi, rho),))
|
@@ -492,7 +491,7 @@ def __init__(self, A, B, tau=None, alpha_beta=tuple(), P=[],
|
492 | 491 |
|
493 | 492 | Check that large input sets are handled well::
|
494 | 493 |
|
495 |
| - sage: A = B = list(range(20000)) |
| 494 | + sage: A = B = range(20000) |
496 | 495 | sage: bij = Bijectionist(A, B) # long time
|
497 | 496 | """
|
498 | 497 | # glossary of standard letters:
|
@@ -569,7 +568,7 @@ def set_constant_blocks(self, P):
|
569 | 568 | current partition can be reviewed using
|
570 | 569 | :meth:`constant_blocks`::
|
571 | 570 |
|
572 |
| - sage: A = B = list('abcd') |
| 571 | + sage: A = B = 'abcd' |
573 | 572 | sage: bij = Bijectionist(A, B, lambda x: B.index(x) % 2)
|
574 | 573 | sage: bij.constant_blocks()
|
575 | 574 | {}
|
@@ -1766,7 +1765,7 @@ def possible_values(self, p=None, optimal=False):
|
1766 | 1765 |
|
1767 | 1766 | Test an unfeasible problem::
|
1768 | 1767 |
|
1769 |
| - sage: A = B = list('ab') |
| 1768 | + sage: A = B = 'ab' |
1770 | 1769 | sage: bij = Bijectionist(A, B, lambda x: B.index(x) % 2)
|
1771 | 1770 | sage: bij.set_constant_blocks([['a', 'b']])
|
1772 | 1771 | sage: bij.possible_values(p="a")
|
@@ -2147,11 +2146,11 @@ def _preprocess_intertwining_relations(self):
|
2147 | 2146 |
|
2148 | 2147 | .. TODO::
|
2149 | 2148 |
|
2150 |
| - it is not clear, whether this method makes sense |
| 2149 | + it is not clear whether this method makes sense |
2151 | 2150 |
|
2152 | 2151 | EXAMPLES::
|
2153 | 2152 |
|
2154 |
| - sage: A = B = list('abcd') |
| 2153 | + sage: A = B = 'abcd' |
2155 | 2154 | sage: bij = Bijectionist(A, B, lambda x: B.index(x) % 2)
|
2156 | 2155 | sage: pi = lambda p1, p2: 'abcdefgh'[A.index(p1) + A.index(p2)]
|
2157 | 2156 | sage: rho = lambda s1, s2: (s1 + s2) % 2
|
@@ -2273,7 +2272,7 @@ def solutions_iterator(self):
|
2273 | 2272 |
|
2274 | 2273 | EXAMPLES::
|
2275 | 2274 |
|
2276 |
| - sage: A = B = list('abc') |
| 2275 | + sage: A = B = 'abc' |
2277 | 2276 | sage: bij = Bijectionist(A, B, lambda x: B.index(x) % 2, solver="GLPK")
|
2278 | 2277 | sage: next(bij.solutions_iterator())
|
2279 | 2278 | {'a': 0, 'b': 1, 'c': 0}
|
@@ -2362,8 +2361,7 @@ def solutions_iterator(self):
|
2362 | 2361 | veto: x_0 + x_1 + x_3 + x_4 + x_6 + x_10 + x_14 <= 6
|
2363 | 2362 | veto: x_0 + x_1 + x_2 + x_5 + x_6 + x_10 + x_14 <= 6
|
2364 | 2363 |
|
2365 |
| - Changing or re-setting problem parameters clears the internal cache and |
2366 |
| - prints even more information:: |
| 2364 | + Changing or re-setting problem parameters clears the internal cache:: |
2367 | 2365 |
|
2368 | 2366 | sage: bij.set_constant_blocks(P)
|
2369 | 2367 | sage: _ = list(bij.solutions_iterator())
|
@@ -2519,7 +2517,6 @@ class _BijectionistMILP():
|
2519 | 2517 | Wrapper class for the MixedIntegerLinearProgram (MILP). This
|
2520 | 2518 | class is used to manage the MILP, add constraints, solve the
|
2521 | 2519 | problem and check for uniqueness of solution values.
|
2522 |
| -
|
2523 | 2520 | """
|
2524 | 2521 | def __init__(self, bijectionist: Bijectionist, solutions=None):
|
2525 | 2522 | r"""
|
@@ -2987,7 +2984,7 @@ def add_intertwining_relation_constraints(self):
|
2987 | 2984 |
|
2988 | 2985 | EXAMPLES::
|
2989 | 2986 |
|
2990 |
| - sage: A = B = list('abcd') |
| 2987 | + sage: A = B = 'abcd' |
2991 | 2988 | sage: bij = Bijectionist(A, B, lambda x: B.index(x) % 2)
|
2992 | 2989 | sage: pi = lambda p1, p2: 'abcdefgh'[A.index(p1) + A.index(p2)]
|
2993 | 2990 | sage: rho = lambda s1, s2: (s1 + s2) % 2
|
|
0 commit comments