https://en.wikipedia.org/wiki/AC-3_algorithm
You would need to implement something like forward checking or backtracking algorithm to solve all possible boards with higher cost.
https://github.com/isaksky/sudoku-swift/blob/master/Sudoku-S...
This one solves all 50 from Euler: https://projecteuler.net/problem=96
And here is a classic one in Python from Norvig:
http://norvig.com/sudoku.html
https://en.wikipedia.org/wiki/AC-3_algorithm
You would need to implement something like forward checking or backtracking algorithm to solve all possible boards with higher cost.