78 x1(*this,n*n,1,n), x2(*this,n*n,1,n) {
87 for (
int i=0;
i<
n;
i++)
88 for (
int j=0; j<
n; j++) {
92 for (
int i = nn;
i--; ) {
94 element(*
this, mod, z[i], x1[i]);
99 for (
int i = n;
i--; ) {
101 for (
int j = n; j--; )
104 for (
int j = n; j--; )
108 for (
int j = n; j--; ) {
110 for (
int i = n;
i--; )
113 for (
int i = n;
i--; )
118 for (
int i = 1;
i<
n;
i++) {
121 for (
int j = n; j--; ) {
133 :
Script(share,s), n(s.n) {
146 for (
int i = 0;
i<
n;
i++) {
148 for (
int j = 0; j<
n; j++) {
150 os << y1(
i,j) <<
" ";
155 for (
int i = 0;
i<
n;
i++) {
157 for (
int j = 0; j<
n; j++) {
159 os << y2(
i,j) <<
" ";
177 opt.
parse(argc,argv);
178 Script::run<OrthoLatinSquare,DFS,SizeOptions>(
opt);
void size(unsigned int s)
Set default size.
Options for scripts with additional size parameter
IntVar & y2(int i, int j)
Access field at position i and j in second square.
void mod(Home home, IntVar x0, IntVar x1, IntVar x2, IntConLevel icl)
Post propagator for .
Example: Orthogonal latin squares
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
IntVarArray x1
Fields of first square.
int main(int argc, char *argv[])
Main function.
OrthoLatinSquare(bool share, OrthoLatinSquare &s)
Constructor for cloning s.
virtual void print(std::ostream &os) const
Print solution.
IntVarBranch INT_VAR_SIZE_MIN(BranchTbl tbl)
Select variable with smallest domain size.
OrthoLatinSquare(const SizeOptions &opt)
Actual model.
IntVar & y1(int i, int j)
Access field at position i and j in first square.
Parametric base-class for scripts.
const IntVar & y2(int i, int j) const
Access field at position i and j in second square.
void update(Space &, bool share, VarArray< Var > &a)
Update array to be a clone of array a.
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
const IntVar & y1(int i, int j) const
Access field at position i and j in first square.
IntVarArray x2
Fields of second square.
virtual Space * copy(bool share)
Copy during cloning.
unsigned int size(I &i)
Size of all ranges of range iterator i.
void element(Home home, IntSharedArray c, IntVar x0, IntVar x1, IntConLevel)
Post domain consistent propagator for .
Passing integer variables.
Passing integer arguments.
void div(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
const int n
Size of squares.
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
void distinct(Home home, const IntVarArgs &x, IntConLevel icl)
Post propagator for for all .
IntValBranch INT_VAL_SPLIT_MIN(void)
Select values not greater than mean of smallest and largest value.
Gecode toplevel namespace
BrancherHandle 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 icl(IntConLevel i)
Set default integer consistency level.
Domain propagation or consistency.