66 n(example_size(examples[opt.
size()])),
67 x(*this, n*n*n*n, 1, n*n) {
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[]) {
135 opt.
parse(argc,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);
void size(unsigned int s)
Set default size.
Options for scripts with additional size parameter
IntVarArray x
Values for the fields.
Slice< A > col(int c) const
Access column c.
void branch(Home home, const FloatVarArgs &x, FloatVarBranch vars, FloatValBranch vals, FloatBranchFilter bf, FloatVarValPrint vvp)
Branch over x with variable selection vars and value selection vals.
void update(Space &home, VarArray< Var > &a)
Update array to be a clone of array a.
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
virtual void print(std::ostream &os) const
Print solution.
virtual Space * copy(void)
Perform copying during cloning.
Slice< A > slice(int fc, int tc, int fr, int tr) const
Access slice of the matrix.
void ipl(IntPropLevel i)
Set default integer propagation level.
Parametric base-class for scripts.
void decay(double d)
Set default decay factor.
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...
int n
Number of negative literals for node type.
Gecode::IntArgs i({1, 2, 3, 4})
IntValBranch INT_VAL_MIN(void)
Select smallest value.
unsigned int size(I &i)
Size of all ranges of range iterator i.
void distinct(Home home, const IntVarArgs &x, IntPropLevel ipl)
Post propagator for for all .
Base class for Sudoku puzzles.
Sudoku(const SizeOptions &opt)
Constructor.
Slice< A > row(int r) const
Access row r.
bool assigned(View x, int v)
Whether x is assigned to value v.
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
Domain propagation Options: basic versus advanced propagation.
void solutions(unsigned int n)
Set default number of solutions to search for.
Sudoku(Sudoku &s)
Constructor for cloning s.
Matrix-interface for arrays.
int main(int argc, char *argv[])
Gecode toplevel namespace