Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SAT mapper fix #28

Merged
merged 2 commits into from
Mar 15, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
* Improved docs.
eggerdj committed Mar 9, 2024
commit bc303096ed3d2730e867fa2fcc599eac68f751d7
4 changes: 4 additions & 0 deletions qopt_best_practices/sat_mapping/sat_mapper.py
Original file line number Diff line number Diff line change
@@ -119,6 +119,10 @@ def interrupt(solver):
# number of swap layers that satisfies the subgraph isomorphism problem.
while min_layers < max_layers:
num_layers = (min_layers + max_layers) // 2

# Create the connectivity matrix. Note that if the swap strategy cannot reach
# full connectivity then its distance matrix will have entries with -1. These
# entries must be treated as False.
d_matrix = swap_strategy.distance_matrix
connectivity_matrix = ((-1 < d_matrix) & (d_matrix <= num_layers)).astype(int)
# Make a cnf for the adjacency constraint