Problem: Solving Sudoku Using PuLP, Part II
Learn how to solve the Sudoku problem in linear programming given a set of constraints.
We'll cover the following...
Specifying the constraints
1. Each box can only have one value.
To ensure that each box has only one value, we can keep row
and col
constant and vary values
from 1 to 9. The sum of the binary values should be equal to 1 since only one variable will be equal to 1 and others must be 0, like this:
(value = 1, row =1, col =1) + (value = 2, row =1, col =1) + (value = 3, row =1, col =1) ...
Access this course and 1400+ top-rated courses and projects.