84 for (
int i=0;
i<
n;
i++)
85 for (
int j=0; j<
n; j++) {
89 for (
int i = nn;
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) <<
" ";
175 Script::run<OrthoLatinSquare,DFS,SizeOptions>(
opt);
Parametric base-class for scripts.
Passing integer arguments.
Passing integer variables.
unsigned int width(void) const
Return width of domain (distance between maximum and minimum)
Options for scripts with additional size parameter
void update(Space &home, VarArray< Var > &a)
Update array to be a clone of array a.
Example: Orthogonal latin squares
int main(int argc, char *argv[])
Main function.
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.
const IntVar & y2(int i, int j) const
Access field at position i and j in second square.
IntVar & y1(int i, int j)
Access field at position i and j in first square.
virtual void print(std::ostream &os) const
Print solution.
const int n
Size of squares.
IntVar & y2(int i, int j)
Access field at position i and j in second square.
IntVarArray x1
Fields of first square.
OrthoLatinSquare(const SizeOptions &opt)
Actual model.
OrthoLatinSquare(OrthoLatinSquare &s)
Constructor for cloning s.
void parse(int argc, char *argv[])
Parse commandline arguments.
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVar x1)
Post propagator for .
@ IRT_GQ
Greater or equal ( )
@ IPL_DOM
Domain propagation Options: basic versus advanced propagation.
void branch(Home home, const IntVarArgs &x, const BoolVarArgs &y, IntBoolVarBranch vars, IntValBranch vals)
Branch function for integer and Boolean variables.
unsigned int size(I &i)
Size of all ranges of range iterator i.
Gecode toplevel namespace
IntValBranch INT_VAL_SPLIT_MIN(void)
Select values not greater than mean of smallest and largest value.
void mod(Home home, IntVar x0, IntVar x1, IntVar x2, IntPropLevel ipl=IPL_DEF)
Post propagator for .
void distinct(Home home, const IntVarArgs &x, IntPropLevel ipl=IPL_DEF)
Post propagator for for all .
void div(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
void element(Home home, IntSharedArray n, IntVar x0, IntVar x1, IntPropLevel ipl=IPL_DEF)
Post domain consistent propagator for .
Post propagator for SetVar SetOpType SetVar SetRelType SetVar z
IntVarBranch INT_VAR_SIZE_MIN(BranchTbl tbl=nullptr)
Select variable with smallest domain size.
Gecode::IntArgs i({1, 2, 3, 4})