diff --git a/API_accessor.py b/API_accessor.py index 5880d77..94365f3 100755 --- a/API_accessor.py +++ b/API_accessor.py @@ -61,7 +61,8 @@ try: # Import the rust bindings - from ltd import LTD, CrossSection + #from ltd import LTD, CrossSection + from ltd import CrossSection except ImportError: print("ERROR: Could not import the rust back-end 'ltd' module. Compile it first with:" " ./make_lib from within the pyNLoop directory.") @@ -71,6 +72,8 @@ _MODEs.append(args.mode) if args.mode=='LTD': + print("ERROR: LTD functionality deprecated.") + raise rust_instance = LTD( settings_file = pjoin(root_path, args.hyperparameter_path), topology_file = pjoin(root_path, args.topologies_path), @@ -110,7 +113,8 @@ def API_initialise( try: # Import the rust bindings - from ltd import LTD, CrossSection + #from ltd import LTD, CrossSection + from ltd import CrossSection except ImportError as e: print("PYTHONPATH:\n%s"%str(sys.path)) print("DYLD_LIBRARY_PATH:\n%s"%os.environ.get('DYLD_LIBRARY_PATH','')) diff --git a/TOPT_LTD/topt_ltd.py b/TOPT_LTD/topt_ltd.py index 736de51..e5cc05a 100755 --- a/TOPT_LTD/topt_ltd.py +++ b/TOPT_LTD/topt_ltd.py @@ -419,13 +419,6 @@ def get_index_of_first_different_element(listA, listB): def NEW_merge_topt_terms_without_numerators(self, topt_terms, debug=False): - topt_terms = sorted(topt_terms, key=lambda t: t[0][1][0]) - node_map = { v : i for i, v in enumerate(topt_terms[0][0][1][0]) } - inv_node_map = {v : k for k, v in node_map.items()} - topt_terms = [ [(n, (tuple([node_map[o_i] for o_i in o[0]]),)), t ] for (n, o), t in topt_terms] - - orderings_representatives = { orderings: orderings[0] for (num, orderings), terms in topt_terms} - def get_index_of_first_different_element(listA, listB): for i,(a,b) in enumerate(zip(listA,listB)): if a!=b: @@ -448,6 +441,16 @@ def get_permutations(listA,listB): else: return tuple(permutations) + #topt_terms = sorted(topt_terms, key=lambda t: t[0][1][0]) + node_map = { v : i for i, v in enumerate(topt_terms[0][0][1][0]) } + inv_node_map = {v : k for k, v in node_map.items()} + topt_terms = [ [(n, (tuple([node_map[o_i] for o_i in o[0]]),)), t ] for (n, o), t in topt_terms] + # One try if there are still some fail here is to order the terms so as to have the maximal number of perms w.r.t first (i.e. 0,1,2,3...) + # Still not clear what the tie breaker needs to be though + # defining_term = topt_terms[0] + # topt_terms = sorted(topt_terms, key=lambda t: len(get_permutations( defining_term[0][1][0], t[0][1][0] )) ) + + orderings_representatives = { orderings: orderings[0] for (num, orderings), terms in topt_terms} def ordering_metric(a,b,merged_e_surf_in_num,common_e_surfs,non_common_e_surfs): @@ -833,6 +836,9 @@ def process_topt_terms(self, topt_terms): # orientations_to_consider = [ # (-1, -1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1), # ] + # orientations_to_consider = [ + # (-1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1), + # ] orientations_to_consider = None topt_terms = ({ o : topt_terms[o] for o in orientations_to_consider } if orientations_to_consider is not None else topt_terms)