SUDOKU (MATHEMATICAL SOLUTION)
Posted: Sat May 01, 2010 2:41 pm
Hi all.
The Sudoku is a game that can be solved by Mathematical Programming.
You can easily solve any Sudoku through a Linear Programming model
with the use of Binary variables.
I developed a program that generates a linear programming model to
solve any Sudoku for two of the most important software dedicated to solving
linear programming models: LINGO and MPL/CPLEX.
1) Generate the model for a given Sudoku specified by the user with my program.
2) Copy the generated linear programming model by my program to the clipboard.
3) Run LINGO or MPL: creates a new file, paste the clipboard,and runs the option solve the model.
4) In the report of LINGO or MPL that shows the solution of the model,
the only variables of importance to the user are RiCj variables.
Where i (i = 1 ... 9) refer to rows and j (j = 1 ... 9) to the columns of Sudoku.
For example, if in the solution R4C1 = 8, in row 4 column 1 of Sudoku should
write the number 8, and so on for the 81 cells (9 rows * 9 columns).
I have attached some reports of LINGO to verify it.
See the file README.TXT
Greetings everyone,
Claudio Soto.
The Sudoku is a game that can be solved by Mathematical Programming.
You can easily solve any Sudoku through a Linear Programming model
with the use of Binary variables.
I developed a program that generates a linear programming model to
solve any Sudoku for two of the most important software dedicated to solving
linear programming models: LINGO and MPL/CPLEX.
1) Generate the model for a given Sudoku specified by the user with my program.
2) Copy the generated linear programming model by my program to the clipboard.
3) Run LINGO or MPL: creates a new file, paste the clipboard,and runs the option solve the model.
4) In the report of LINGO or MPL that shows the solution of the model,
the only variables of importance to the user are RiCj variables.
Where i (i = 1 ... 9) refer to rows and j (j = 1 ... 9) to the columns of Sudoku.
For example, if in the solution R4C1 = 8, in row 4 column 1 of Sudoku should
write the number 8, and so on for the 81 cells (9 rows * 9 columns).
I have attached some reports of LINGO to verify it.
See the file README.TXT
Greetings everyone,
Claudio Soto.