Solving LinkedIn Queens with SMT: Easier Than SAT!

2025-06-12
Solving LinkedIn Queens with SMT: Easier Than SAT!

This post details solving the 'LinkedIn Queens' puzzle—a variation of the classic N-Queens problem with added regional constraints—using the SMT solver Z3. The author demonstrates that expressing the problem in SMT, leveraging integer variables and constraints, is significantly simpler than the equivalent SAT formulation which requires many boolean clauses. While SMT solvers might be slower than highly optimized SAT solvers like Glucose, the ease of encoding makes SMT preferable for many. The post includes complete code and helpful sanity checks to verify the model's correctness. This provides a compelling explanation for the industry's preference for tools that compile to SAT rather than using SAT directly.

Development SMT solver