05 / 07 — Selected work
Neural A* Heuristic
A PyTorch network learns to estimate distance-to-solution and becomes the heuristic inside A* search.
Updated 26 Nov 2026PythonMIT
PurposeReplace a hand-written heuristic with a learned value function without leaving classical search.
What I builtSolved states are walked backward into a training set. A neural value function V(s) estimates distance-to-solution and guides A*.
Engineering
- Solved state → backward walks
- Training dataset
- Neural value function V(s)
- A* search
- Solution
Technology
PythonPyTorchNumPyA*Docker
Architecture
- One value network V(s) is trained on solved states and used as the A* heuristic: f = g + V.
- The network holds no puzzle-specific logic; every environment implements encode_state, valid_actions and step.
- The same training and search code runs on 15 Puzzle, Toggle Lights and Cylinder.
Decisions
- A shared environment API instead of per-puzzle models: one architecture covers three different state spaces.
- A learned heuristic instead of a hand-tuned one: the training loop generalises to new puzzles without new heuristics.