TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Understanding SAT by Implementing a Simple SAT Solver in Python (2014)

158 点作者 c1ccccc1超过 5 年前

4 条评论

wsxcde超过 5 年前
The practical significance of SAT is that almost all modern verification techniques are based on SAT solvers.<p>The algorithm he describes is not very interesting because it doesn&#x27;t even implement unit-propagation. The idea with unit propagation is that if my current assignment has set a variable A=True and I also have a clause (~A + B) then B must be true for the instance to be satisfiable. Unit propagation is about propagating such implied constraints. If he&#x27;d implemented unit propagation along with his brute force search he&#x27;d have ended up with what is called the DPLL algorithm for SAT.<p>Modern SAT solvers are actually even smarter and have two important improvements over DPLL: (i) Conflict-Driven Clause Learning (CDCL) which introduced a very cool technique called non-chronological backtracking, and (ii) 2-literal watching which is an extremely clever data structure for efficient unit propagation. Both of these ideas are generalizable to many other versions of constraint solving (e.g. sudoko, router search, etc.) so they are well worth learning.<p>CDCL was introduced by this paper: <a href="https:&#x2F;&#x2F;dl.acm.org&#x2F;citation.cfm?id=244560" rel="nofollow">https:&#x2F;&#x2F;dl.acm.org&#x2F;citation.cfm?id=244560</a> while 2-literal watching is from the Chaff solver: <a href="https:&#x2F;&#x2F;www.princeton.edu&#x2F;~chaff&#x2F;publication&#x2F;DAC2001v56.pdf" rel="nofollow">https:&#x2F;&#x2F;www.princeton.edu&#x2F;~chaff&#x2F;publication&#x2F;DAC2001v56.pdf</a>.
评论 #20848693 未加载
评论 #20845612 未加载
评论 #20845594 未加载
maxmunzel超过 5 年前
I wrote a dpll (the standard algorithm for SAT) Implementation in Haskell, that’s also pretty straight forward: <a href="https:&#x2F;&#x2F;github.com&#x2F;maxmunzel&#x2F;dpll&#x2F;blob&#x2F;master&#x2F;README.md" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;maxmunzel&#x2F;dpll&#x2F;blob&#x2F;master&#x2F;README.md</a><p>Feel free to ask any questions.
评论 #20850200 未加载
grecht超过 5 年前
I&#x27;m confused why he brings up the four color theorem, since a 4-coloring of a planar graph can be determined in polynomial time. And he also makes it sound like the theorem hasn&#x27;t been proven yet.
评论 #20845455 未加载
carapace超过 5 年前
If you liked that you might like this. It&#x27;s a DPLL† SAT Solver based on George Spencer-Brown&#x27;s Laws of Form implemented in Python.<p><a href="http:&#x2F;&#x2F;joypy.osdn.io&#x2F;notebooks&#x2F;Correcet_Programming.html#Davis%E2%80%93Putnam%E2%80%93Logemann%E2%80%93Loveland-(DPLL)-algorithm-SAT-Solver" rel="nofollow">http:&#x2F;&#x2F;joypy.osdn.io&#x2F;notebooks&#x2F;Correcet_Programming.html#Dav...</a><p>One of the interesting things about it is that you don&#x27;t have to put formulas into conjunctive normal form.<p>† <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Davis%E2%80%93Putnam%E2%80%93Logemann%E2%80%93Loveland_algorithm" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Davis%E2%80%93Putnam%E2%80%93L...</a>