def leon_rbase6(): from permutation import Permutation from refinement import SubgroupFamily, PartitionStabaliserFamily, Refinement from partition import Partition from group import PermGroup from leon_search import PartitionBacktrackWorkhorse as PBW cf = Permutation.read_cycle_form a = cf([[2, 3], [4, 6], [5, 8], [9, 11]], 13) b = cf([[1, 2, 4, 7, 9, 3, 5, 6, 8, 10, 11, 12, 13]], 13) fam_subgroup = SubgroupFamily(PermGroup([a, b])) stab = Partition([[1, 3, 5, 7, 9, 11], [2, 4, 6, 8, 10, 12, 13]]) fam_part_stab = PartitionStabaliserFamily(stab) size = 13 print("Refinements: partition stabaliser refinement and subgroup refinement") print( "Desired property: partition stabaliser of [[1,3,5,7,9,11],[2,4,6,8,10,12,13]] and subgroup of <[[2,3],[4,6],[5,8],[9,11]], [[1,2,4,7,9,3,5,6,8,10,11,12,13]]>" ) print("Heuristics: multi-backtrack") print("Search space: Sym(13)") fam = Refinement([fam_subgroup, fam_part_stab]) pbw = PBW(None, fam, size) pbw.printing = True r_base = pbw._r_base() lookup = pbw._special_lookup special_levels = sorted(list(lookup.keys()))
def test_r_base(self): cf = Permutation.read_cycle_form a = cf([[2,3],[4,6],[5,8],[9,11]], 13) b = cf([[1,2,4,7,9,3,5,6,8,10,11,12,13]], 13) fam_subgroup = SubgroupFamily(PermGroup([a,b])) stab = Partition([[1,3,5,7,9,11],[2,4,6,8,10,12,13]]) fam_part_stab = PartitionStabaliserFamily(stab) size = 13 fam = Refinement([fam_subgroup, fam_part_stab]) pbw = PBW(None, fam, size) r_base = pbw._r_base() lookup = pbw._special_lookup special_levels = sorted(list(lookup.keys())) special_cells = [lookup[level][0] for level in special_levels] special_vals = [lookup[level][1] for level in special_levels] self.assertTrue(pbw.left.discrete()) self.assertEqual(special_levels, [1,2,4]) self.assertEqual(special_cells, [1,1,1]) self.assertEqual(special_vals, [1,3,5]) f = pbw.left.fix() b = fam_subgroup._group.base self.assertEqual(f[:len(b)], b)