75 x1(*this,n*n,1,n), x2(*this,n*n,1,n) {
84 for (
int i=0;
i<
n;
i++)
85 for (
int j=0; j<
n; j++) {
89 for (
int i = nn;
i--; ) {
91 element(*
this, mod, z[i], x1[i]);
96 for (
int i = n;
i--; ) {
98 for (
int j = n; j--; )
101 for (
int j = n; j--; )
105 for (
int j = n; j--; ) {
107 for (
int i = n;
i--; )
110 for (
int i = n;
i--; )
115 for (
int i = 1;
i<
n;
i++) {
118 for (
int j = n; j--; ) {
143 for (
int i = 0;
i<
n;
i++) {
145 for (
int j = 0; j<
n; j++) {
147 os << y1(
i,j) <<
" ";
152 for (
int i = 0;
i<
n;
i++) {
154 for (
int j = 0; j<
n; j++) {
156 os << y2(
i,j) <<
" ";
174 opt.
parse(argc,argv);
175 Script::run<OrthoLatinSquare,DFS,SizeOptions>(
opt);
void size(unsigned int s)
Set default size.
void mod(Home home, IntVar x0, IntVar x1, IntVar x2, IntPropLevel ipl)
Post propagator for .
Options for scripts with additional size parameter
IntVar & y2(int i, int j)
Access field at position i and j in second square.
Example: Orthogonal latin squares
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)
IntVarArray x1
Fields of first square.
int main(int argc, char *argv[])
Main function.
OrthoLatinSquare(const SizeOptions &opt)
Actual model.
void ipl(IntPropLevel i)
Set default integer propagation level.
IntVar & y1(int i, int j)
Access field at position i and j in first square.
Parametric base-class for scripts.
OrthoLatinSquare(OrthoLatinSquare &s)
Constructor for cloning s.
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
IntVarArray x2
Fields of second square.
const IntVar & y1(int i, int j) const
Access field at position i and j in first square.
virtual Space * copy(void)
Copy during cloning.
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 .
Post propagator for SetVar SetOpType SetVar SetRelType SetVar z
Passing integer variables.
Passing integer arguments.
const IntVar & y2(int i, int j) const
Access field at position i and j in second square.
IntVarBranch INT_VAR_SIZE_MIN(BranchTbl tbl)
Select variable with smallest domain size.
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 .
Domain propagation Options: basic versus advanced propagation.
IntValBranch INT_VAL_SPLIT_MIN(void)
Select values not greater than mean of smallest and largest value.
Gecode toplevel namespace
virtual void print(std::ostream &os) const
Print solution.
void element(Home home, IntSharedArray c, IntVar x0, IntVar x1, IntPropLevel)
Post domain consistent propagator for .