64 : n(opt.
size()), x(*this,n*n,1,n*n) {
69 const int s = nn*(nn+1) / (2*n);
74 for (
int i = n;
i--; ) {
82 for (
int i = n;
i--; ) {
102 x.
update(*
this, share, s.x);
115 for (
int i = 0;
i<
n;
i++) {
117 for (
int j = 0; j<
n; j++) {
135 opt.
parse(argc,argv);
136 Script::run<MagicSquare,DFS,SizeOptions>(
opt);
void size(unsigned int s)
Set default size.
Options for scripts with additional size parameter
void linear(Home home, const FloatVarArgs &x, FloatRelType frt, FloatNum c)
Post propagator for .
virtual Space * copy(bool share)
Copy during cloning.
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
IntVarBranch INT_VAR_SIZE_MIN(BranchTbl tbl)
Select variable with smallest domain size.
Parametric base-class for scripts.
void iterations(unsigned int i)
Set default number of iterations.
void update(Space &, bool share, VarArray< Var > &a)
Update array to be a clone of array a.
virtual void print(std::ostream &os) const
Print solution.
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
unsigned int size(I &i)
Size of all ranges of range iterator i.
Slice< A > row(int r) const
Access row r.
Passing integer variables.
int main(int argc, char *argv[])
Main-function.
Node * x
Pointer to corresponding Boolean expression node.
MagicSquare(const SizeOptions &opt)
Post constraints.
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 .
Matrix-interface for arrays.
IntValBranch INT_VAL_SPLIT_MIN(void)
Select values not greater than mean of smallest and largest value.
Gecode toplevel namespace
Slice< A > col(int c) const
Access column c.
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.
MagicSquare(bool share, MagicSquare &s)
Constructor for cloning s.
void icl(IntConLevel i)
Set default integer consistency level.