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

Exact Qrisp SAT Solver #126

Merged
merged 14 commits into from
Feb 14, 2025
Merged

Exact Qrisp SAT Solver #126

merged 14 commits into from
Feb 14, 2025

Conversation

tubadzin
Copy link
Contributor

@tubadzin tubadzin commented Feb 2, 2025

exact_sat.py and the corresponding ExactQrispSatSolver class

This variant utilizes (almost) the same logic as the default QrispSatSolver. The key difference is that this version (in theory) avoids considering impossible variable assignments. For this, the Oracle needs to know the size of the solution space.

sharp-sat-solver

As mentioned above, exact_sat.py requires the size of the solution space to function correctly. To address this, I have added a Linux binary that, given a .cnf file, approximates the number of solutions. Unfortunately, this approximation fails in trivial cases where the .cnf file is unsatisfiable, such as:

p cnf 1 2
1 0
-1 0

This case should obviously return 0, but the solver instead returns 1 or 2 (if pre-processing is disabled). The issue arises because the solver simplifies contradictory clauses, and once removed, the remaining formula is interpreted as having no constraints, allowing x to take any value (both true and false).

Additionally, I attempted to compile this program for Windows, but to no avail. Both cross-compiling and building it on my Windows machine failed. This led me down a long rabbit hole where I replaced platform-dependent code iteratively. While I eventually managed to build an .exe, it still produced errors when running. I have yet to find another SharpSAT solver that works on Windows. Some alternatives I considered are:

@tubadzin tubadzin linked an issue Feb 2, 2025 that may be closed by this pull request
@tubadzin tubadzin self-assigned this Feb 2, 2025
@tubadzin tubadzin force-pushed the feat/exact-grover-sat branch 3 times, most recently from 5726315 to 54a078d Compare February 10, 2025 10:20
@Elscrux Elscrux marked this pull request as ready for review February 10, 2025 12:12
@tubadzin tubadzin force-pushed the feat/exact-grover-sat branch from 66ddae6 to 86ac2bb Compare February 10, 2025 12:27
Copy link
Member

@Elscrux Elscrux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just one small request.

@Elscrux Elscrux merged commit 8cfc420 into develop Feb 14, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add exact qrisp SAT solver
2 participants