def first_explore(n): #for n in range(2,7): # ooz_list = build_ooz(n) # print(len(ooz_list)) #n=4 sst_list = bss.build_stacks(n) ooz_list = bss.build_ooz(n) print('num sst', len(sst_list)) print('num ooz', len(ooz_list)) not_sst_list = [] yes_sst_list = [] for ooz in ooz_list: if not ooz in sst_list: not_sst_list.append(ooz) else: yes_sst_list.append(ooz) print('\tooz not sst:', len(not_sst_list)) print('\tooz yes sst:', len(yes_sst_list)) for ooz in not_sst_list: print_triangle(ooz) print('=====================') print('=====================') print('=====================')
def try_one_zero_per_row_factor(): ### really does factor so that each permutation appears at least once in the list. stacks = build.build_stacks(3) first_dict = dict() for s in stacks: print(s) factor_list = factor_one_zero_per_row(s) print('\t', factor_list) if len(factor_list) > 1: key = str(factor_list[0]) else: key = str(factor_list[0]) if not key in first_dict: first_dict[key] = 1 else: first_dict[key] = first_dict[key] + 1 total = 0 for key in first_dict: print(key, first_dict[key]) total = total + first_dict[key] print(total) print(len(first_dict))
def try_fix(n): sst_list = bss.build_stacks(n) ooz_list = bss.build_ooz(n) yes_ooz_list = [] not_ooz_list = [] count = 0 for sst in sst_list: if not sst in ooz_list: count += 1 not_ooz_list.append(sst) #for row in ooz: # print(row) #print("-------") else: yes_ooz_list.append(sst) print('not ooz:', len(not_ooz_list)) print('yes ooz:', len(yes_ooz_list)) # print(len(sst_list) - count) fixed_list = [] for sst in not_ooz_list: fixed = fix_sst(sst) if fixed in fixed_list: print('>>>>>>> already in fixed list') print_triangle(sst) print_triangle(fixed) elif fixed in yes_ooz_list: print('######### doubled up ooz/sst') print_triangle(sst) print_triangle(fixed) else: fixed_list.append(fix_sst(sst)) print('num_fixed', len(fixed_list)) for fixed in fixed_list: if not fixed in ooz_list: print('!!!!!!!!!! not ooz') print_triangle(fixed) print('=========== missing ooz') count = 0 for ooz in ooz_list: if not ooz in fixed_list and not ooz in sst_list: print_triangle(ooz) count += 1 print(count)
from asm import build_asm from stackset import build_stack_sets as build psm_list = build_asm.getPartialSums(4) pst_list = build_asm.getPartialSumTriangles(4) sst_list = build.build_stacks(3) #print('missing from SST list') #for pst in psm_list: for asm in build_asm.asm4: #if pst not in sst_list: #for x in pst: # print(x) #print('-----') if not build_asm.isPermutationMatrix(asm): print(build_asm.toLaTeX(asm)) #print('missing from PST list') #for sst in sst_list: # if sst not in pst_list: # for x in sst: # print(x) # print('-----') # print('mapping count') # hash_map = dict() # # for matrix,triangle in zip(psm_list,pst_list):
def print_triangle(triangle): for row in triangle: print(row) print('----') def print_factor_list(factor_list): for x in factor_list: for y in x: print(y) print('----') print('======') stacks = build.build_stacks(3) my_dict = dict() for stack in stacks: squares = [row_col_swap(stack) for stack in stacks] for square in squares: print('******Start*********') print('triangle') print_triangle(square) factor_list = factor_weakly_incr_row(square) print('factor list') print_factor_list(factor_list) print('******End*********') key = str(factor_list[0])
def get_sst_starbar(n): sst_list = build_stack_sets.build_stacks(n) return [sst_to_starbar(sst) for sst in sst_list]