Generated on Tue Feb 11 2025 17:33:26 for Gecode by doxygen 1.12.0

Base class for Sudoku puzzles. More...

Public Types

enum  { MODEL_INT , MODEL_SET , MODEL_MIXED }
 Model variants. More...
 
enum  {
  BRANCH_NONE , BRANCH_SIZE , BRANCH_SIZE_DEGREE , BRANCH_SIZE_AFC ,
  BRANCH_AFC
}
 

Public Member Functions

 Sudoku (const SizeOptions &opt)
 Constructor.
 
 Sudoku (Sudoku &s)
 Constructor for cloning s.
 
 Sudoku (const SizeOptions &opt)
 Constructor.
 
 Sudoku (Sudoku &s)
 Constructor for cloning s.
 
virtual Spacecopy (void)
 Perform copying during cloning.
 
virtual void print (std::ostream &os) const
 Print solution.
 
- Public Member Functions inherited from Gecode::Driver::ScriptBase< BaseSpace >
 ScriptBase (const Options &opt)
 Constructor.
 
 ScriptBase (ScriptBase &e)
 Constructor used for cloning.
 
virtual void compare (const Space &home, std::ostream &os) const
 Compare with s.
 

Protected Attributes

const int n
 The size of the problem.
 
IntVarArray x
 Values for the fields.
 

Related Symbols

(Note that these are not member symbols.)

int main (int argc, char *argv[])
 Main-function.
 

Sudoku specifications

Each specification gives the initial positions that are filled in, with blank squares represented as zeroes.

const char * examples []
 The specifications.
 
const unsigned int n_examples = sizeof(examples)/sizeof(char*)
 The number of instances.
 
int example_size (const char *s)
 The size of an instance.
 
int sudokuField (const char *s, int n, int i, int j)
 Return value at position (i,j) in the example s of size n.
 

Additional Inherited Members

- Static Public Member Functions inherited from Gecode::Driver::ScriptBase< BaseSpace >
static std::ostream & select_ostream (const char *sn, std::ofstream &ofs)
 Choose output stream according to sn.
 
template<class Script , template< class > class Engine, class Options >
static void run (const Options &opt, Script *s=NULL)
 

Detailed Description

Base class for Sudoku puzzles.

Example: Solving Sudoku puzzles using integer constraints

Definition at line 55 of file sudoku-advanced.cpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Model variants.

Enumerator
MODEL_INT 

Use integer constraints.

MODEL_SET 

Use set constraints.

MODEL_MIXED 

Use both integer and set constraints.

Definition at line 62 of file sudoku-advanced.cpp.

◆ anonymous enum

anonymous enum
Enumerator
BRANCH_NONE 

Use lexicographic ordering.

BRANCH_SIZE 

Use minimum size.

BRANCH_SIZE_DEGREE 

Use minimum size over degree.

BRANCH_SIZE_AFC 

Use minimum size over afc.

BRANCH_AFC 

Use maximum afc.

Definition at line 69 of file sudoku-advanced.cpp.

Constructor & Destructor Documentation

◆ Sudoku() [1/4]

Sudoku::Sudoku ( const SizeOptions & opt)
inline

Constructor.

Definition at line 78 of file sudoku-advanced.cpp.

◆ Sudoku() [2/4]

Sudoku::Sudoku ( Sudoku & s)
inline

Constructor for cloning s.

Definition at line 83 of file sudoku-advanced.cpp.

◆ Sudoku() [3/4]

Sudoku::Sudoku ( const SizeOptions & opt)
inline

Constructor.

Definition at line 64 of file sudoku.cpp.

◆ Sudoku() [4/4]

Sudoku::Sudoku ( Sudoku & s)
inline

Constructor for cloning s.

Definition at line 95 of file sudoku.cpp.

Member Function Documentation

◆ copy()

virtual Space * Sudoku::copy ( void )
inlinevirtual

Perform copying during cloning.

Reimplemented in SudokuInt, SudokuMixed, and SudokuSet.

Definition at line 101 of file sudoku.cpp.

◆ print()

virtual void Sudoku::print ( std::ostream & os) const
inlinevirtual

Print solution.

Reimplemented from Gecode::Driver::ScriptBase< BaseSpace >.

Reimplemented in SudokuInt, SudokuMixed, and SudokuSet.

Definition at line 107 of file sudoku.cpp.

Friends And Related Symbol Documentation

◆ examples

const char* examples[]
related

The specifications.

Definition at line 54 of file sudoku-instances.hh.

◆ n_examples

const unsigned int n_examples = sizeof(examples)/sizeof(char*)
related

The number of instances.

Definition at line 1849 of file sudoku-instances.hh.

◆ main()

int main ( int argc,
char * argv[] )
related

Main-function.

Definition at line 405 of file sudoku-advanced.cpp.

◆ example_size()

int example_size ( const char * s)
related

The size of an instance.

Definition at line 1852 of file sudoku-instances.hh.

◆ sudokuField()

int sudokuField ( const char * s,
int n,
int i,
int j )
related

Return value at position (i,j) in the example s of size n.

Definition at line 1860 of file sudoku-instances.hh.

Member Data Documentation

◆ n

const int Sudoku::n
protected

The size of the problem.

Definition at line 58 of file sudoku-advanced.cpp.

◆ x

IntVarArray Sudoku::x
protected

Values for the fields.

Definition at line 60 of file sudoku.cpp.


The documentation for this class was generated from the following files: