Skip to content
0:00 / 0:00

#satsolver#raymondhettinger#puzzlesolving

Raymond Hettinger - Modern solvers: Problems well-defined are problems solved - PyCon 2019

PyCon 2019

13K subscribers • 3 videos on Hallway

YouTube
  • Recommended by 2 people: 2 in engineering communities.
  • Presented by Raymond Hettinger, Python Core Developer

Intermediate. Assumes working knowledge.

63K views7 years ago2 recommendations

Computer scienceProgramming languagesAlgorithmsPythonComputation and complexity

Raymond Hettinger demonstrates how to use tree search and SAT solvers in Python to solve complex logic puzzles.

Speaker: Raymond Hettinger Every programmer should learn to use solvers, tools that reason directly from a description of a problem to its solution. Tools like AlphaZero can formulate winning strategies for games given only a description of the rules of the game. For certain classes of problems, we really can just let the computer do the work. In this talk, we learn principles, techniques, and multiple examples for three solvers available in Python. The first tool is a generic puzzle-solving framework that employs tree search strategies. We apply it to a simple sequencing problem and then to a harder sliding-block puzzle. Next, we'll look at the solver code to learn how it works. I'll also show an essential optimization technique and how to humanize the output. We demonstrate our skills by solving another famous puzzle. The second tool is called a SAT solver. It is one of the miracles of the 21st century. From first principles, I'll show you what problems it solves and the way problems need to be described for modules like *PycoSAT*. I'll provide helper functions to humanize our interactions with this great tool. Then, we'll demonstrate our skills by creating a Sudoku solver and a readable logic problem solver. The third tool is the ""multi-armed bandit"". It is a generic reinforcement learning algorithm that is easy to learn, powerful, and applicable to a broad class of problems. We apply it to winning rock-paper-scissors using pattern recognition. Lastly, I'll summarize DeepMind's paper on AlphaZero which was published in the December 2018 edition of *Science*. This gives us hints at the full potential of these techniques. Pure Python source code and examples are provided for all of the tools. Slides can be found at: rhettinger.github.io

Why it's here

2 people recommend this

What people say. Recommended as an excellent introduction to using SAT solvers and tree search to solve complex problems.

Moments people linked to

u/tomekancoin r/compsci • Recommends

On “The P = NP Problem”

SAT, for example 15:56 - 17:55
3View on Reddit

u/casual__addictin r/programming • Recommends

On “Story: Making a brute-force algorithm viable with a nudge”

This sounds like a good use case for SAT solver. I liked this video: link to this video I’ve made two solvers with these ideas and I think you could do the same for this one. If I have time maybe I’ll look into it. It seems pretty straightforward. The idea is pretty simple: you want to manage a stack of state. The initial state is all he seats empty. Then push on to the stack all valid choices for the first seat. Now pop from the stack and then treat that as a state and push on to the stack all valid choices from that state. So on and so on. At each choice check if you have satisfied constraints or if the problem is solved (in this case, are all the seats filled). This winds up being a depth first s…

u/dbramucciin r/programming • Mentions

On “"People ask about bigger examples of Prolog. While lots of big Prolog tends to be a 'silver bullet' (read proprietary) here's some mid sized OS you can feast your eyes on"”

I can't find a link to it, but I remember hearing a story about implementing scheme in prolog. They gave a talk where they showed this scheme-in-prolog and how it could create programs automatically that fit a specification. i.e. In prolog you would write evaluates(Prog, "(f 3)", "8"). evaluates(Prog, "(f (f 3))", "13"). evaluates(Prog, "(f 1)", "6"). and it would reply that `Prog` could be (define (f x) (+ x 5)) or (define (f x) (cond (== x 3) 8 (== x 8) 13 (== x 1) 6 0)) or ... (please forgive the bad prolog/scheme, I'm a bit rusty on both) And sometimes you would get the happy accident that one of the simplest…