46 using namespace Gecode;
66 n(example_size(examples[
opt.
size()])),
73 for (
int i=0;
i<nn;
i++) {
79 for (
int i=0;
i<nn;
i+=
n) {
80 for (
int j=0; j<nn; j+=
n) {
86 for (
int i=0;
i<nn;
i++)
87 for (
int j=0; j<nn; j++)
88 if (
int v = sudokuField(examples[
opt.size()], nn,
i, j))
109 for (
int i = 0;
i<
n*
n*
n*
n;
i++) {
114 os << (char)(
x[
i].val()+
'A'-10) <<
" ";
119 os << std::endl <<
" ";
130 main(
int argc,
char* argv[]) {
136 if (
opt.size() >= n_examples) {
137 std::cerr <<
"Error: size must be between 0 and "
138 << n_examples-1 << std::endl;
141 Script::run<Sudoku,DFS,SizeOptions>(
opt);
int n
Number of negative literals for node type.
Node * x
Pointer to corresponding Boolean expression node.
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
Parametric base-class for scripts.
Matrix-interface for arrays.
Slice< A > slice(int fc, int tc, int fr, int tr) const
Access slice of the matrix.
Slice< A > col(int c) const
Access column c.
Slice< A > row(int r) const
Access row r.
void solutions(unsigned int n)
Set default number of solutions to search for.
void ipl(IntPropLevel i)
Set default integer propagation level.
Options for scripts with additional size parameter
Base class for Sudoku puzzles.
virtual Space * copy(void)
Perform copying during cloning.
Sudoku(const SizeOptions &opt)
Constructor.
IntVarArray x
Values for the fields.
virtual void print(std::ostream &os) const
Print solution.
Sudoku(Sudoku &s)
Constructor for cloning s.
void distinct(Home home, const IntVarArgs &x, IntPropLevel ipl)
Post propagator for for all .
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
@ IPL_DOM
Domain propagation Options: basic versus advanced propagation.
IntValBranch INT_VAL_MIN(void)
Select smallest value.
IntVarBranch INT_VAR_AFC_SIZE_MAX(double d, BranchTbl tbl)
Select variable with largest accumulated failure count divided by domain size with decay factor d.
bool assigned(View x, int v)
Whether x is assigned to value v.
unsigned int size(I &i)
Size of all ranges of range iterator i.
Gecode::IntArgs i({1, 2, 3, 4})
int main(int argc, char *argv[])