7 ms·
Accidentally writing a SAT solver
- JimmyWilliams1 2y ago[dead]
- dang 2y ago[stub for offtopicness]
- thimkerbell 2y ago"* SAT solver * is a computer program which aims to solve the Boolean satisfiability problem", has nothing to do with the SAT aptitude tests.
- IshKebab 2y agoBacktracking is not a fast SAT solver.
- efangs 2y agosorry this is not fast
- dang 2y agohttps://news.ycombinator.com/item?id=42343678 https://news.ycombinator.com/item?id=42343678
- Neywiny 2y agoHuh. As a UMD grad who faced this same problem, it's an interesting post. What I'll say is that their ECE (which CS does not fall into, idk how they do it) department advisors gave us updated 4 year plans every semester or so. It meant I never had to worry about not having the right classes to graduate. And we had to get permission for every class which while annoying meant my advisor looked over every major-specific class. I can't even count how many people I know or know who know that wasted upwards of years on classes that didn't count. None of that for me. On the other hand, I remember for my acceptance (which wasn't too the ECE program) I had to pick classes before I could confirm going to UMD? I don't remember why but I remember panicking because here I am, a high schooler still, picking college classes that would set my next 4 years. I was even more terrified when my first ever class not only was I late because it was in the back of a basement, but the instructor made some comment about it not being the right class for engineers or something. It was, though. You fix this and other problems: 1. I started using the UMD provided schedule planner and some 3rd party ones, with multiple backups for when they'd fill up 2. I made an app that showed most buildings' floor plans completely offline. No more wandering around during stressful times. 3. I did try and make a tree of classes using prerequisite days scraped from the SoC, but it wasn't a regular expression so I gave up immediately. The blogger like CMSC430 and I agree it was a good class though I had a different professor.
- Halian 2y agoFor some reason, I thought this would have to do with the standardized test, lol.
- anonymousDan 2y agoOn a related note, anyone have any advice for getting started with something like Z3?
- constructum 2y agoIf you want to use Z3 with a .NET language, there is also this very useful file with examples of how to use the bindings: https://github.com/Z3Prover/z3/blob/master/examples/dotnet/Program.cs https://github.com/Z3Prover/z3/blob/master/examples/dotnet/P... The examples are in C#, but easy to adapt to other languages. I found them quite useful to write a program for symbolic execution in F# that calls Z3 to simplify conditionals, here is its interface to Z3: https://github.com/constructum/asm-symbolic-execution/blob/main/SmtInterface.fs https://github.com/constructum/asm-symbolic-execution/blob/m... The bindings are perhaps a bit cumbersome, but rather easy to understand and work very well. Once you appropriately wrap what you need, you can forget about the bindings as well as avoiding SMT-LIB completely.
- porcoda 2y agoRead up on smt-lib: learning how to encode problems in that is a good way to start. The Python z3 bindings are a good starting point to play with it too.
- Jtsummers 2y agohttps://theory.stanford.edu/~nikolaj/programmingz3.html https://theory.stanford.edu/~nikolaj/programmingz3.html - This one was useful for me to get started with it a while ago.
- Klaus23 2y agohttps://smt.st/SAT_SMT_by_example.pdf https://smt.st/SAT_SMT_by_example.pdf
- drdrey 2y agohttps://microsoft.github.io/z3guide/docs/logic/intro/ https://microsoft.github.io/z3guide/docs/logic/intro/
- sevensor 2y ago
- porcoda 2y agoInteresting post, but I’m not sure this really speaks to what goes into actually writing what would be considered a “fast” SAT solver. It seems more like a post about how SAT pops up in a lot of places if you look at them right. For the state of the art in what constitutes fast solvers, the annual SAT competition papers are quite interesting to read if you’re interested in the techniques people come up with to make them fast. A few years ago I was working through Knuth’s satisfiability book and writing my own solvers, and was always amazed how stunningly fast the SAT competition winners were compared to the ones I’d code up.
- dang 2y agoOk, we've taken the fast bit out of the title above. It's still a good post!
- ComplexSystems 2y agoSAT turns up everywhere because it's almost universal kind of problem. Since it is NP complete, everything in NP can be transformed into an instance of SAT. Since P is a subset of NP, everything in P can be also be turned into an instance of SAT. Nobody knows if things in PSPACE can be, though.
- butokai 2y agoAdd to this that propositional logic (the language in which we express SAT) is a versatile language to code problems in. Finding cliques in a graph is also NP complete, but it is less natural to use it as a language to code other problems.
- RestartKernel 2y agoI really like the styling of this blog. It's nice on the eyes, gets out of the way, and the collapsed containers for extra info is a nice touch. There's a bit of layout shift though, but that's about it.
- andai 2y agoI'm on mobile too, I disabled JS in my browser to test it out, the site loads fine and the expanding boxes work too (I think it's the <details> tag).
- jkaptur 2y ago> As a result, in order to determine if a formula is satisfiable, first convert it to conjunctive normal form, then convert the new formula into a course catalog. I know this is a consequence of NP-completeness and so on and so forth, but I also find it a funny and charming way to phrase it. Once we've solved the fundamental problem (what courses to take), we're able to solve simple specializations and derivatives (boolean satisfiability).
- accurrent 2y agoSAT shows up in a lot of problems. Im doing my PhD in multi-agent robotics after spending some time working on real life multirobot deployments. Ive been frustrated because most roboticists I talk to think SAT is a dead end, but we have been having insane advances in solver speeds over the years. I guess everyone is obsessed about the ML hypetrain right now, but where sat shines is when we need to orchestrate at a task level. I feel theres defintely work to be done to bridge both worlds.
- imtringued 2y agoActually quadratic programming is all the rage these days since computers have gotten fast enough that you can run QP solvers in your control loop.
- baol 2y agoProbably worth mentioning that there are well-known linear time algorithms to construct a solution for n-queen problem https://en.wikipedia.org/wiki/Eight_queens_puzzle#Existence_of_solutions https://en.wikipedia.org/wiki/Eight_queens_puzzle#Existence_...
- Arcuru 2y agoTrue, finding one solution is easy but finding all the solutions can be a fun little optimization challenge. I made a repo many years ago with a bunch of grab bag solutions for comparisons [1]; from dumb brute force to DLX (Knuth's Dancing Links) and a multithreaded bitwise backtracking algorithm. And one where I just hardcoded the answers because all the counts up to 27 are known. So I'm all for just jumping to the existing known solutions, but it seems like the OP is having fun while they learn a little bit. They seem to just be a college freshman. [1] - https://github.com/arcuru/nqueens https://github.com/arcuru/nqueens