Recently I've been working on a little logic solver hobby project. The idea is to apply generic* solvers on various problems like Sudoku or Kakuro puzzles, or the N-Queens problem.
While being generic, these solvers do use heuristics to arrive at a solution in a timely manner. These heuristics align with the way a human would solve for example a Sudoku puzzle. And there you have it, I want to dedicate this blog to explaining how these Human Heuristics can be applied to computer programs.
While looking for example puzzles in a computer friendly format, I've come across sources where a computer program would take more than 10 minutes to solve a Sudoku or Kakuro. The algorithms there don't incorporate these Human Heuristics, making them orders of magnitude slower. For reference, the same problems can easily be solved by a computer in less than 10 milliseconds.
And that's really the reason why I want to explain the use of Human Heuristics in computer programs. Because computers are so fast, they are often fast enough even when the problem is solved in a simple way. But the human equivalent to a computer program solving a Sudoku in 10 minutes, is just checking whether the sudoku is correct after trying every number for every location and taking years to solve a single Sudoku.
I hope to inspire other programmers with the way heuristics in computer programs align with the heuristics we use as humans. So when solving a problem, stop thinking about how you would solve the problem with a computer, but instead focus on translating the way you solve the problem as a human into a computer program.
*While you could of course make a solver specifically for a 9 by 9 Sudoku, my hobby project aims at using the same solver(s) for multiple problems. So not just Sudoku puzzles of any size, but also the N-Queens problem can be solved with exactly the same solver.
No comments:
Post a Comment