FICO
FICO Xpress Optimization Examples Repository
FICO Optimization Community FICO Xpress Optimization Home
Back to examples browserNext example

Sudoku (CP and MIP models)

Description
Playing Sudoku: fill in the 9x9 grid so that every row, every column and every 3x3 box contains the numbers 1-9.
  • The models sudoku.mos and sudoku2_ka.mos solve a given Sudoku grid with Mixed Integer Programming and Constraint Programming respectively.
  • The model versions sudoku*_graph.mos add repeated display of the Sudoku board to show the progress of the solving.


Source Files
By clicking on a file name, a preview is opened at the bottom of this page.
sudoku.mos[download]
sudoku_graph.mos[download]
sudoku2_ka.mos[download]
sudoku2_ka_graph.mos[download]

Data Files





sudokug290705.dat

! Data set from "The Guardian", 29 July, 2005. http://www.guardian.co.uk/sudoku

VALUE: [
 ('A' 1) 8  ('F' 1) 3
 ('B' 2) 5  ('G' 2) 4
 ('A' 3) 2  ('E' 3) 7  ('H' 3) 6
 ('D' 4) 1  ('I' 4) 5
 ('C' 5) 3  ('G' 5) 9
 ('A' 6) 6  ('F' 6) 4
 ('B' 7) 7  ('E' 7) 2  ('I' 7) 3
 ('C' 8) 4  ('H' 8) 1 
 ('D' 9) 9  ('I' 9) 8 ]

Back to examples browserNext example