-
Notifications
You must be signed in to change notification settings - Fork 11
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
Translation from Conjure-Oxide Model to CNF KissSAT #83
Conversation
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.
From in-person review of the tests with @gskorokhod:
Test cases sometimes fail due to variables being assigned numbers in CNF arbitrarily.
We need some way of storing ordering of variables so we can test this, and we can convert solutions back from CNF to Model.
@gskorokhod suggested doing a sort over the string and integers inside Name, but we would appreciate any ideas @ozgurakgun @lixitrixi .
I think this needs to be represented inside the SymbolTable / AST somehow - I imagine having a cannonical ordering of variables would help with other things too, and should be solver independant? |
Absolutely. The variables have to be called 1..n, so a central function which generates the next name in order makes sense. When we generate the, say, direct encoding for an integer variable we should remember the variables used for this and avoid regenerating the same How are the variables assigned to numbers at the moment? |
One way of structuring this in the code could be giving variables a method to return their direct encoding sat-variable-numbers (creating them if necessary). Example: When converting Also: we can simplify the above to De Morgan CNF-like In pseudo-rust:
And Does this make sense? |
I should have a working implementation now, but there's no documentation yet and no proper error types |
I have also implemented converting from CNF back to an expression - idk if this is actually needed |
I think this looks reasonable -- obviously things to overhaul (like the error types), but none of that stops a MVP merge. Should probably remove the '.idea' directories (and maybe add to .gitignore, to avoid them in future?) |
hi @gskorokhod - if you remove the unnecessary files we can merge this. |
removed the .idea directory! |
We should keep any editor config that is in .gitignore, and remove the rest. |
@ChrisJefferson @ozgurakgun I think this should be ready to merge now! |
We should add parsing of Something like:
With the following solutions:
Maybe we shouldn't block this PR, but do this in another PR? |
I would appreciate it if you could stick this in an issue and tag it with the milestone - I might end up doing a little bit on this inter-semester. @ozgurakgun should be ready to merge if you're happy? |
Needs refactoring. |
Refactored the PR in line with new changes, so this is probably no longer relevant
Should be ready to merge! I've refactored my code to work with the new structure (mostly fixing imports, etc) |
I've also added |
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.
LGTM 🚀
No description provided.