I am quite proud of having figured out a clean SAT formulation of this problem that could be solved using common optimization packages in python. Here's my cleaned up code for solving with PuLP/CBC (comment out the triviality check at the top to force solving using pulp - like I did on the weekend 😅 ).
https://github.com/johnpmay/AdventOfCode2025/blob/main/Day12/Day12-clean.ipynb
Tips welcome from any optimization gurus with more experience with Z3 / PuLP / ORtools for how this might be made better.
