-
Notifications
You must be signed in to change notification settings - Fork 73
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
random seeds in solvers #83
Comments
Currently, all the randomness is intentionally disabled in PySAT, to ensure deterministic behaviour of the solvers. It could be indeed helpful to have a way to set it in some particular cases, using additional functionality. Note that PRs are more than welcome. |
I've been using pysat (along with the package sacred, to run, and save experiments) to test various encodings in a class of combinatorial problems. The package sacred sets the seeds of the python random and numpy.random generators, to some "randomish" value if you don't specify it explicitly (but it records the setting in a file). I ran exactly the same problem with the same sat encodings a number of times with cadical. About 80% of the time, with the particular encoding it solved in about 2 seconds. However, about 20% of the time it took 120 seconds. So, clearly, the random seed has some significant effect. In those encodings I'm using the seqcounter cardinality encoding. I'm assuming (am I right?) that you don't use any randomness in the cardinality encodings. |
@algebravic, yes, you are right that CaDiCaL may still be using some of the randomness-tweaking parameters. In practice, I tend not to use CaDiCaL a lot because in incremental settings it is usually outperformed by MiniSat-like solvers. Regarding randomness in cardinality encodings, your assumption is correct that there should be none. |
I'm looking into this matter, although I am attacking Glucose first because I am more familiar with the MiniSat family of solvers. I actually seem to have a workable proof of concept, but before I submit a PR I would like to discuss the API with you. The relevant members of the
(This is Glucose 4.2.1 but other Glucoses and MiniSat are pretty similar).
In my proof of concept I instead added extra arguments to the |
Thanks, @lou1306. It would be preferable to implement this via a number of setters rather than a list of additional parameters to the initialiser. This way it would not complicate the generic solver's constructor. |
See pysathq#83. This is a proof of concept, currently limited to Glucose42. Support for other MiniSat-based solvers should be straightforward.
See pysathq#83. This is a proof of concept, currently limited to Glucose42. Support for other MiniSat-based solvers should be straightforward.
Most (all?) of the solvers use randomness, and have a command option to set the random seed, for reproducibility. What does pysat do about that? It would be nice to be able to specify this.
The text was updated successfully, but these errors were encountered: