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





sudokut260105.dat

! Data set from "The Times", 26 January, 2005

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

Back to examples browserNext example