74 const int s = nn*(nn+1) / (2*
n);
79 for (
int i =
n;
i--; ) {
87 for (
int i =
n;
i--; ) {
102 switch (
opt.branching()) {
106 case BRANCH_AFC_SIZE:
127 for (
int i = 0;
i<
n;
i++) {
129 for (
int j = 0; j<
n; j++) {
151 Script::run<MagicSquare,DFS,SizeOptions>(
opt);
Options for scripts with additional size parameter
Slice< A > col(int c) const
Access column c.
virtual Space * copy(bool share)
Copy during cloning.
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, bool share, VarImpVar< VarImp > &y)
Update this variable to be a clone of variable y.
void linear(Home home, const FloatVarArgs &x, FloatRelType frt, FloatVal c)
Post propagator for .
Parametric base-class for scripts.
void iterations(unsigned int i)
Set default number of iterations.
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...
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.
void distinct(Home home, const IntVarArgs &x, IntPropLevel ipl)
Post propagator for for all .
void branching(int v)
Set default branching value.
Passing integer variables.
int main(int argc, char *argv[])
Main-function.
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.
Slice< A > row(int r) const
Access row r.
MagicSquare(const SizeOptions &opt)
Post constraints.
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
Post propagator for SetVar x
Matrix-interface for arrays.
IntValBranch INT_VAL_SPLIT_MIN(void)
Select values not greater than mean of smallest and largest value.
Gecode toplevel namespace
MagicSquare(bool share, MagicSquare &s)
Constructor for cloning s.
virtual void print(std::ostream &os) const
Print solution.