Skip to content

Commit

Permalink
#60: Working commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lollospadalaser committed Aug 16, 2024
1 parent 22bb8a7 commit edabe9e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sxpat/template_manager/template_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@ def comparator_greater_than(a : list, e : int):
SOP_QBF_Manager.output.write(')\n#\n')
return res



def sort_key(value):
prefix = 0 if value.startswith('in') else 1
number = int(value[2:] if value.startswith('in') else value[1:])
Expand All @@ -282,6 +284,9 @@ def run(self) -> Sequence[Result]:
nodes_exact = graph_exact.nodes
graph_current = self._current_graph.graph
nodes_current = graph_current.nodes

# here I sort the sugraph input dict, because during XPAT/SubXPAT it is sorted and if I don't do this before then the results that I give could be based on a
# different permutation
sorted_items = sorted(self._current_graph.subgraph_input_dict.items(), key=lambda item: SOP_QBF_Manager.sort_key(item[1]))
self._current_graph.subgraph_input_dict = {i: v for i, (k, v) in enumerate(sorted_items)}
# 1,2,30 is for the input, and, output gates of the exact circuit, 40 for intermidiate and gates of the multiplexer, 41 for the output of the multiplexer,
Expand Down

0 comments on commit edabe9e

Please sign in to comment.