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: 1911
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Has thanked: 25 times
Been thanked: 92 times
Contact:

SUDOKU (MATHEMATICAL SOLUTION)

Post by srvet_claudio » 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.
Attachments
PL_SUDOKU.rar
(714.36 KiB) Downloaded 685 times
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com

User avatar
Rathinagiri
Posts: 5077
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 89 times
Been thanked: 103 times
Contact:

Post by Rathinagiri » Sat May 01, 2010 4:16 pm

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: 4268
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 145 times
Been thanked: 54 times
Contact:

Post by esgici » Sat May 01, 2010 6:43 pm

Thanks Dr. :)

Saludos

--

Esgici
Viva INTERNATIONAL HMG :D

User avatar
srvet_claudio
Posts: 1911
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Has thanked: 25 times
Been thanked: 92 times
Contact:

Post by srvet_claudio » Sun May 02, 2010 12:31 pm

Thanks Rathinagiri and Esgici.

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

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests