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

[wip] major refactoring for perf and modularity #11

Merged
merged 102 commits into from
Feb 11, 2019
Merged

[wip] major refactoring for perf and modularity #11

merged 102 commits into from
Feb 11, 2019

Conversation

c-cube
Copy link
Collaborator

@c-cube c-cube commented Dec 28, 2017

  • move to jbuilder dune
  • style stuff
  • migrate to 4.03
  • cut into small sub-libraries
  • use sequence
  • make state explicit, remove stateful functors
  • heavy perf improvements
  • remove smt-related libs
  • add sudoku solver to test the functor
  • remove push/pop, replaced by faster assumptions-powered unsat-core

@c-cube c-cube requested a review from Gbury December 28, 2017 13:08
@c-cube c-cube self-assigned this Dec 28, 2017
@Gbury
Copy link
Owner

Gbury commented Dec 28, 2017

Looks good (as long as the Travis check pass). Is there a reason for having filenames capitalized ? I usually keep all my folders/filenames lowcase because it's easier to type in the terminal (but it's not an absolute rule).

@Gbury
Copy link
Owner

Gbury commented Dec 28, 2017

Travis configuration and opam file should be updated to reflect the changes in ocaml versions

@c-cube
Copy link
Collaborator Author

c-cube commented Dec 28, 2017

I use capitalized file names these days, because it maps exactly to the module name. When using acronyms, if avoids having files named cNF.ml.

@c-cube
Copy link
Collaborator Author

c-cube commented Dec 28, 2017

Questions:

  • why, in External, is solve calling pop then push? If there were local assumptions they will be lost…
  • should we move all the test stuff into a new library msmt, with corresponding opam file? or is it just hidden?
    • if so, should we have a proper internal AST with hashconsing (I have several of those already)?

@c-cube c-cube added this to the 1.0 milestone Dec 28, 2017
@Gbury
Copy link
Owner

Gbury commented Dec 29, 2017

In External, since the functions returned in the sat_state and unsat_state use the mutable state of the solver, if you pop after solving, these function will not work anymore. The curreent approach is correct because there are really only two states the solver should be in when using external:

  • nothing happened, the solver is at level 0, thus popping does not do anything
  • External.solve has been called previously, which left exactly one level of local assumptions to be popped.
    The assumption was that a user of External wouldn't use functions from Internal that could change the state of the solver. If you find a way to make it work without this assumption then all the better, that that would probably require some additional state to be remembered.

The test stuff is currently hidden (and ideally not part of what is installed), but it could indeed be moved to a separate library. I didn't make it visible because I felt the code wasn't really good enough, but feel free to improve it.

@c-cube
Copy link
Collaborator Author

c-cube commented Dec 30, 2017

I think the major changes are there. You might want to start by looking at the API changes, and if it's ok, then look into the code itself.

Note that in mc2 there are still some parts that I consider more elegant:

@Gbury Gbury mentioned this pull request May 25, 2018
@timothee-haudebourg
Copy link

You have a msat.exe file that appeared and I don't think its supposed to be there.

@c-cube
Copy link
Collaborator Author

c-cube commented May 25, 2018

The msat.exe is convenient for running msat, is all.

Otherwise: this PR is a bit old, another pass might be useful to get it ready ot be merged I think.

@Gbury
Copy link
Owner

Gbury commented May 25, 2018

I'll try and do a serious review soon (as in in a few days, one week max). @c-cube do you think you'll have some time to address the potential comments ?

@c-cube
Copy link
Collaborator Author

c-cube commented May 25, 2018

I think so, yes. I'm spending too much time on my own fork (sidekick) but well.

@c-cube
Copy link
Collaborator Author

c-cube commented May 31, 2018

rebased

@c-cube
Copy link
Collaborator Author

c-cube commented May 31, 2018

Ugh, I hate travis -_-

Copy link
Owner

@Gbury Gbury left a comment

Choose a reason for hiding this comment

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

Looks very good overall ! Some small comments here and there, but this is already mergeable, and we can fix things later.

Last question: why is Backtrackable_ref part of core and not sudoku ? It seems to only be used in the sudoku example, and even though it is very convenient for SMT solvers, I don't know if it really needs to be part of the core of msat.

src/core/Internal.ml Outdated Show resolved Hide resolved
(* inverse of the activity factor for variables. Default 1/0.999 *)

let clause_decay : float = 1. /. 0.999
(* inverse of the activity factor for clauses. Default 1/0.95 *)
Copy link
Owner

Choose a reason for hiding this comment

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

Defaults values in the comments are out of sync for var_decay and clause_decay.

src/core/Solver_types_intf.ml Outdated Show resolved Hide resolved
src/core/Solver_types_intf.ml Outdated Show resolved Hide resolved
src/core/Vec.mli Outdated Show resolved Hide resolved
src/core/Internal.ml Outdated Show resolved Hide resolved
src/core/Internal.ml Outdated Show resolved Hide resolved
src/core/Internal.ml Outdated Show resolved Hide resolved
) hyps);
let export st fmt ~hyps ~history ~local =
assert false
(* FIXME
Copy link
Owner

Choose a reason for hiding this comment

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

Why is this commented out ? I mean, did you encounter some example that made the assertions fail ?

Copy link
Collaborator Author

@c-cube c-cube Feb 5, 2019

Choose a reason for hiding this comment

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

it's because the vecs have changed, and stuff was hidden (in particular, the premises, I think).

edit: clauses are not stored as faithfully now (no more local assumptions, no storage of unit hypothesis, etc.) so this makes less sense imho

) hyps);
assert false
(* FIXME
assert (Vec.for_all (fun c -> St.Clause.premise c = St.Hyp) hyps);
Copy link
Owner

Choose a reason for hiding this comment

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

Same question. Do the changes to clauses require these functions to be changed significantly ?

@Gbury Gbury merged commit 4127db2 into master Feb 11, 2019
@c-cube
Copy link
Collaborator Author

c-cube commented Feb 11, 2019

🎉 🎉 🎉 🌮 🎆

This was referenced Feb 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants