SUDOKU (MATHEMATICAL SOLUTION)

You can share your experience with HMG. Share with some screenshots/project details so that others will also be benefited.

Moderator: Rathinagiri

Post Reply
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

SUDOKU (MATHEMATICAL SOLUTION)

Post by srvet_claudio »

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.
Attachments
PL_SUDOKU.rar
(714.36 KiB) Downloaded 990 times
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: SUDOKU (MATHEMATICAL SOLUTION)

Post by Rathinagiri »

Great Claudio Soto!

I like your code a lot.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: SUDOKU (MATHEMATICAL SOLUTION)

Post by esgici »

Thanks Dr. :)

Saludos

--

Esgici
Viva INTERNATIONAL HMG :D
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: SUDOKU (MATHEMATICAL SOLUTION)

Post by srvet_claudio »

Thanks Rathinagiri and Esgici.

Best Regards,
Claudio Soto
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
Post Reply