-
Notifications
You must be signed in to change notification settings - Fork 7
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
Implemented an interface to BatSat #84
Conversation
7332e03
to
31d7e1c
Compare
Without having time to look at this closely right now, for a solver that is purely written in rust, I wonder whether it makes more sense to implement the RustSAT traits either in the main RustSAT crate (behind a feature switch) or in the original solver crate. That would eliminate an additional crate in the dependency graph, enable more optimizations for the compiler and make the implementation a bit nicer by, e.g., allowing implementations of the |
@nfbruns, do you have where this implementation would make the most sense? Are there any specific reasons why you implemented this as a separate crate other than that that's what I did so far for solvers?
|
I went directly with implementing it using the
I hope that helps, let me know what your thoughts are. |
Thanks for laying out your thoughts. I agree that having all solvers structured in the same way has its advantages. Here are some more thoughts.
Another open question about doing it this way that I still have is related to authorship and ownership on crates.io. In this PR you specified yourself as the author of the crate, which is definitely valid, since you wrote the code. If this makes it into the main repository, releases will be done through the CI and crates.io ownership will therefore have to be under my account. Are you find with that? I guess I might have to add something like that to the contribution guideline as well. Related to your question about why you cannot extend foreign types with foreign traits: as explained here this might lead to conflicts if a crate depends on two traits that define a trait differently for the same type. Let me know if you hear back from the BatSat devs, but as mentioned above, I guess we'll more likely end up with one of the different options. |
It's been a while now. I think by now I'm settled on it being a pragmatic solution to go with the |
Hi Christoph, And yes, I am up for putting in the work to get this merged! I will start to implement your new testing api and make it compatible for the |
I added the new Test interface -which is a lot simpler to use-! In terms of the workshop dependencies, should I address this with this PR already or should this be merged to the current main and then upgraded to |
Even though I don't know yet when the next major release will happen, I think it would make sense to directly target |
I am fine with that! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for continuing to work on this. There are some more things that I hadn't spelled out in detail before, most of them to do with the CI. In addition to the changes I marked here, please make the following changes in files that GitHub won't let me mark changes in:
- In
.github/workflows/docs.yml
, change line 35 tofor dir in tools cadical kissat minisat glucose batsat ipasir capi pyapi; do
- In
.github/workflows/semver-checks.yml
add the following block at the bottom- name: BatSat uses: obi1kenobi/cargo-semver-checks-action@v2 with: package: rustsat-batsat
- In
release-plz.toml
add the following at the bottom so that the crate isn't immediately release when this hits main. I'll remove this when it should be released. (I unfortunately don't know a nicer way of dealing with this.)[[package]] name = "rustsat-batsat" release = false git_release_enable = false
Thank you for the comments and suggestions to get the CI to work! I tried to address all the CI changes and also the clippy warnings and hope that it will work now. If there is anything left to change or not documented well, please let me know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more small thing, I forgot to tell you to add "BatSat" in the list of ignored named in clippy.toml
.
Just so you know, the semver check failing is to be expected for the next-major branch. The failing doc test points out that the readme is not up-to-date with the crate documentation. |
Oh yes, i forgot to run cargo rdme after i added a comment! I pushed a now commit that shoud fix this issue. |
Great. If you address the requested changes above, I think we should be pretty much ready to merge. |
Co-authored-by: Christoph Jabs <[email protected]>
Co-authored-by: Christoph Jabs <[email protected]>
I addressed the clippy and documentation issues. I hope that it is so far ready to ship now! |
Great. Thanks for sticking with this through all the details. I'll merge this soon, but I'll probably squash it down into fewer commits. |
Thank you very much for taking the time to review and also for the interesting discussions along the way about how to approach the integration, how to deal with rust specifics and how to code certain parts! |
interface to the [BatSat](https://github.com/c-cube/batsat) solver closes #84 Squashed commit of the following: commit 25bea4d Author: Noah Bruns <[email protected]> Date: Thu Jul 4 16:01:43 2024 +0200 refactor: reorder clippy valid idents list Co-authored-by: Christoph Jabs <[email protected]> commit adbe43e Author: Noah Bruns <[email protected]> Date: Thu Jul 4 12:03:33 2024 +0200 lint: Batsat added as valid ident commit 80db5aa Author: Noah Bruns <[email protected]> Date: Thu Jul 4 09:42:01 2024 +0200 ci: run cargo rdme commit 3a3bd46 Author: Noah Bruns <[email protected]> Date: Thu Jul 4 09:41:02 2024 +0200 docu: remove code blocks for names Co-authored-by: Christoph Jabs <[email protected]> commit e0a9cd2 Author: Noah Bruns <[email protected]> Date: Wed Jul 3 11:03:56 2024 +0200 ci: run cargo rdme after comments changed commit 0aeac45 Author: Noah Bruns <[email protected]> Date: Mon Jul 1 18:09:57 2024 +0200 docu: more comments and restructuring commit a549dda Author: Noah Bruns <[email protected]> Date: Mon Jul 1 17:51:42 2024 +0200 docu: cargo rdme run commit a1e4498 Author: Noah Bruns <[email protected]> Date: Mon Jul 1 17:48:15 2024 +0200 lint: clippy fixes and docu commit fcfa9df Author: Noah Bruns <[email protected]> Date: Mon Jul 1 17:32:42 2024 +0200 PR: implemented suggestions and applied reviews commit 1544980 Author: Noah Bruns <[email protected]> Date: Wed Jun 26 11:17:22 2024 +0200 fix: clippy linting issues addressed commit 727e42c Author: Noah Bruns <[email protected]> Date: Fri Jun 21 19:19:21 2024 +0200 fix: use workspace dependencies commit 707e207 Merge: 4649148 1e6aa6b Author: Noah Bruns <[email protected]> Date: Wed Jun 26 11:08:55 2024 +0200 Merge branch 'feat-batsat-solver' of github.com:nfbruns/rustsat into feat-batsat-solver commit 4649148 Author: Noah Bruns <[email protected]> Date: Wed Jun 26 11:08:40 2024 +0200 compatability to 0.5.1 and solvertests implemented commit ed21c4f Author: Noah Bruns <[email protected]> Date: Wed Jun 26 11:08:40 2024 +0200 test: cleanup and renaming commit 8ecd6ad Author: Noah Bruns <[email protected]> Date: Wed Jun 26 11:08:40 2024 +0200 fix: return of ok if clause not added commit a0e84a1 Author: Noah Bruns <[email protected]> Date: Wed Jun 26 11:08:40 2024 +0200 docs: fixed comments commit 4acddcd Author: Noah Bruns <[email protected]> Date: Wed Jun 26 11:08:40 2024 +0200 ci: running github workflows commit 2ccc905 Author: Noah Bruns <[email protected]> Date: Wed Jun 26 11:08:40 2024 +0200 docs: changelog and readme added commit 9f59fdd Author: Noah Bruns <[email protected]> Date: Wed Jun 26 11:08:40 2024 +0200 feat:implemented batsat api commit 1e6aa6b Author: Noah Bruns <[email protected]> Date: Fri Jun 14 17:21:51 2024 +0200 compatability to 0.5.1 and solvertests implemented commit cf6dd71 Merge: 31d7e1c ff1a3d6 Author: Noah Bruns <[email protected]> Date: Fri Jun 14 16:48:35 2024 +0200 Merge branch 'main' into feat-batsat-solver commit 31d7e1c Author: Noah Bruns <[email protected]> Date: Wed Apr 10 16:25:51 2024 +0200 test: cleanup and renaming commit 46b2c27 Author: Noah Bruns <[email protected]> Date: Wed Apr 10 17:10:03 2024 +0200 fix: return of ok if clause not added commit 4b58cc8 Author: Noah Bruns <[email protected]> Date: Wed Apr 10 17:08:58 2024 +0200 docs: fixed comments commit ae01e17 Author: Noah Bruns <[email protected]> Date: Wed Apr 10 15:56:36 2024 +0200 ci: running github workflows commit b8326be Author: Noah Bruns <[email protected]> Date: Wed Apr 10 15:55:25 2024 +0200 docs: changelog and readme added commit 5b78bd2 Author: Noah Bruns <[email protected]> Date: Wed Apr 10 15:17:41 2024 +0200 feat:implemented batsat api
I now (manually) merged this in 4d15c0f. I also did a little bit more work (98af54b) to generalize the interface to generic BatSat callbacks and to implement |
For completeness, I now finally got to some housekeeping and this is now finally officially published. Thanks again for working on this. |
Description of the Contribution
Implemented an interface to the BatSat solver (https://github.com/c-cube/batsat)
Questions / Considerations
The
add_clause_reuse(&mut c)
function infn add_clause(&mut self, clause: Clause)
returns false if the Solver is in an UNSAT state. Should we handle that with an error message or just returnOk(())
as it is now?My suggestion is that since we have no way to remove clauses from this solver, there cannot be a way to get the solver out of the UNSAT state, therefor, the return of
Ok(())
is fine, even if the clause was not added.PR Checklist
CONTRIBUTING.md
rustfmt
/cargo fmt --all