2

I'm trying to solve a SAT problem that consists of one-hot constraints only. Right now I'm using the one-hot encoding proposed by Claessen in Sec. 4.2 of [1] and MiniSAT.

I wonder if there is a better way of solving such a problem, e.g. a class of solvers that is a better match for this kind of problems compared to CNF-based SAT solvers. I've searched a bit but can't find much information on SAT and one-hot constraints at all.

[1] Successful SAT Encoding Techniques. Magnus Bjiirk. 25th July 2009

CliffordVienna
  • 7,995
  • 1
  • 37
  • 57

1 Answers1

2

Satisfiability modulo theorem solvers are often a good choice for expressing mathematical problems that would otherwise end up using one-hot CNF encodings. A key insight is that with CNF and DPLL-based solvers alone you're limited to what unit propagation can discover efficiently. At a higher level of abstraction there are theories of numbers and sets that can be used to prune the search space before selectively applying a SAT solver to more appropriate subproblems. That's what SMT gives you, along with more expressive power and a much more pleasant language in which express relationships.

But if you're stuck with one-hot constraints with no associated higher level math problem, there are more efficient ways to encode onehot constraints that require only a linear number of new clauses to express the relation instead of the usual quadratic increase. See

Efficient CNF Encoding for Selecting 1 from N Objects by Klieber and Kwon.

Kyle Jones
  • 5,492
  • 1
  • 21
  • 30
  • Thanks for your answer. I have no underlying mathematical problem; I'm solving a puzzle.. I wrote my own little solver for this kind of one-hot problems now and am over 10x faster than my MiniSAT solution (45 minutes instead of 750 minutes). But I can't tell if this is from different literal ordering or a real speedup. See puzzle3d.cc in http://svn.clifford.at/handicraft/2013/ezsat/ (MiniSAT, using a one-hot encoding with N*log(N) clauses) and http://svn.clifford.at/handicraft/2013/mhslib/ (my solver). My solver does the equivalent of DPLL's unit propagation, but nothing fancy beyond that. – CliffordVienna May 28 '13 at 20:19