46 extern const int *specs[];
48 extern const unsigned int n_examples;
81 :
Script(opt), spec(specs[opt.size()]),
82 n_filled(spec[1]),
n(spec[0]),
x(*this,
n*
n,1,
n*
n) {
87 const int s = nn*(nn+1) / (2*
n);
92 for (
int i=0; i<n_filled; i++) {
97 col = spec[idx + 1] - 1;
103 for (
int i =
n; i--; ) {
111 for (
int i =
n; i--; ) {
122 switch (opt.branching()) {
138 :
Script(s), spec(s.spec), n_filled(s.n_filled),
n(s.
n) {
139 x.update(*
this, s.x);
152 for (
int i = 0; i<
n; i++) {
154 for (
int j = 0; j<
n; j++) {
178 opt.
parse(argc,argv);
196 const int magicSquare5_filled10_10[] = {
210 const int magicSquare5_filled10_11[] = {
224 const int magicSquare5_filled10_12[] = {
238 const int magicSquare5_filled10_13[] = {
252 const int magicSquare5_filled10_14[] = {
266 const int magicSquare5_filled10_15[] = {
280 const int magicSquare5_filled10_16[] = {
294 const int magicSquare5_filled10_17[] = {
308 const int magicSquare5_filled10_18[] = {
322 const int magicSquare5_filled10_19[] = {
336 const int magicSquare5_filled10_1[] = {
350 const int magicSquare5_filled10_20[] = {
364 const int magicSquare5_filled10_2[] = {
378 const int magicSquare5_filled10_3[] = {
392 const int magicSquare5_filled10_4[] = {
406 const int magicSquare5_filled10_5[] = {
420 const int magicSquare5_filled10_6[] = {
434 const int magicSquare5_filled10_7[] = {
448 const int magicSquare5_filled10_8[] = {
462 const int magicSquare5_filled10_9[] = {
476 const int magicSquare5_filled11_3_1[] = {
491 const int magicSquare5_filled11_5_1[] = {
506 const int magicSquare5_filled11_5_2[] = {
521 const int magicSquare5_filled11_5_3[] = {
536 const int magicSquare5_filled12_10_1[] = {
552 const int magicSquare5_filled12_1_1[] = {
568 const int magicSquare5_filled12_1_2[] = {
584 const int magicSquare5_filled12_1_3[] = {
600 const int magicSquare5_filled12_2_1[] = {
616 const int magicSquare5_filled12_2_2[] = {
632 const int magicSquare5_filled12_2_3[] = {
648 const int magicSquare5_filled12_3_1[] = {
664 const int magicSquare5_filled12_3_2[] = {
680 const int magicSquare9_filled10_10[] = {
694 const int magicSquare9_filled10_11[] = {
708 const int magicSquare9_filled10_12[] = {
722 const int magicSquare9_filled10_13[] = {
736 const int magicSquare9_filled10_14[] = {
750 const int magicSquare9_filled10_15[] = {
764 const int magicSquare9_filled10_16[] = {
778 const int magicSquare9_filled10_17[] = {
792 const int magicSquare9_filled10_18[] = {
806 const int magicSquare9_filled10_19[] = {
820 const int magicSquare9_filled10_1[] = {
834 const int magicSquare9_filled10_20[] = {
848 const int magicSquare9_filled10_2[] = {
862 const int magicSquare9_filled10_3[] = {
876 const int magicSquare9_filled10_4[] = {
890 const int magicSquare9_filled10_5[] = {
904 const int magicSquare9_filled10_6[] = {
918 const int magicSquare9_filled10_7[] = {
932 const int magicSquare9_filled10_8[] = {
946 const int magicSquare9_filled10_9[] = {
960 const int magicSquare9_filled50_10[] = {
1014 const int magicSquare9_filled50_11[] = {
1068 const int magicSquare9_filled50_12[] = {
1122 const int magicSquare9_filled50_13[] = {
1176 const int magicSquare9_filled50_14[] = {
1230 const int magicSquare9_filled50_15[] = {
1284 const int magicSquare9_filled50_16[] = {
1338 const int magicSquare9_filled50_17[] = {
1392 const int magicSquare9_filled50_18[] = {
1446 const int magicSquare9_filled50_19[] = {
1500 const int magicSquare9_filled50_1[] = {
1554 const int magicSquare9_filled50_20[] = {
1608 const int magicSquare9_filled50_2[] = {
1662 const int magicSquare9_filled50_3[] = {
1716 const int magicSquare9_filled50_4[] = {
1770 const int magicSquare9_filled50_5[] = {
1824 const int magicSquare9_filled50_6[] = {
1878 const int magicSquare9_filled50_7[] = {
1932 const int magicSquare9_filled50_8[] = {
1986 const int magicSquare9_filled50_9[] = {
2040 const int *specs[] = {
2041 magicSquare5_filled10_1,
2042 magicSquare5_filled10_2,
2043 magicSquare5_filled10_3,
2044 magicSquare5_filled10_4,
2045 magicSquare5_filled10_5,
2046 magicSquare5_filled10_6,
2047 magicSquare5_filled10_7,
2048 magicSquare5_filled10_8,
2049 magicSquare5_filled10_9,
2050 magicSquare5_filled10_10,
2051 magicSquare5_filled10_11,
2052 magicSquare5_filled10_12,
2053 magicSquare5_filled10_13,
2054 magicSquare5_filled10_14,
2055 magicSquare5_filled10_15,
2056 magicSquare5_filled10_16,
2057 magicSquare5_filled10_17,
2058 magicSquare5_filled10_18,
2059 magicSquare5_filled10_19,
2060 magicSquare5_filled10_20,
2061 magicSquare5_filled11_3_1,
2062 magicSquare5_filled11_5_1,
2063 magicSquare5_filled11_5_2,
2064 magicSquare5_filled11_5_3,
2065 magicSquare5_filled12_10_1,
2066 magicSquare5_filled12_1_1,
2067 magicSquare5_filled12_1_2,
2068 magicSquare5_filled12_1_3,
2069 magicSquare5_filled12_2_1,
2070 magicSquare5_filled12_2_2,
2071 magicSquare5_filled12_2_3,
2072 magicSquare5_filled12_3_1,
2073 magicSquare5_filled12_3_2,
2074 magicSquare9_filled10_1,
2075 magicSquare9_filled10_2,
2076 magicSquare9_filled10_3,
2077 magicSquare9_filled10_4,
2078 magicSquare9_filled10_5,
2079 magicSquare9_filled10_6,
2080 magicSquare9_filled10_7,
2081 magicSquare9_filled10_8,
2082 magicSquare9_filled10_9,
2083 magicSquare9_filled10_10,
2084 magicSquare9_filled10_11,
2085 magicSquare9_filled10_12,
2086 magicSquare9_filled10_13,
2087 magicSquare9_filled10_14,
2088 magicSquare9_filled10_15,
2089 magicSquare9_filled10_16,
2090 magicSquare9_filled10_17,
2091 magicSquare9_filled10_18,
2092 magicSquare9_filled10_19,
2093 magicSquare9_filled10_20,
2094 magicSquare9_filled50_1,
2095 magicSquare9_filled50_2,
2096 magicSquare9_filled50_3,
2097 magicSquare9_filled50_4,
2098 magicSquare9_filled50_5,
2099 magicSquare9_filled50_6,
2100 magicSquare9_filled50_7,
2101 magicSquare9_filled50_8,
2102 magicSquare9_filled50_9,
2103 magicSquare9_filled50_10,
2104 magicSquare9_filled50_11,
2105 magicSquare9_filled50_12,
2106 magicSquare9_filled50_13,
2107 magicSquare9_filled50_14,
2108 magicSquare9_filled50_15,
2109 magicSquare9_filled50_16,
2110 magicSquare9_filled50_17,
2111 magicSquare9_filled50_18,
2112 magicSquare9_filled50_19,
2113 magicSquare9_filled50_20
2116 const unsigned n_examples =
sizeof(specs)/
sizeof(
int*);
int n
Number of negative literals for node type.
Node * x
Pointer to corresponding Boolean expression node.
Parametric base-class for scripts.
static void run(const Options &opt, Script *s=NULL)
Passing integer variables.
Matrix-interface for arrays.
Slice< A > col(int c) const
Access column c.
Slice< A > row(int r) const
Access row r.
Options for scripts with additional size parameter
int main(int argc, char *argv[])
Main-function.
@ BRANCH_AFC_SIZE
Branch by size over AFC.
@ BRANCH_SIZE
Branch by size.
@ BRANCH_CBS_MAX_SD
Use maximum solution density.
MagicSquare(MagicSquare &s)
Constructor for cloning s.
MagicSquare(const SizeOptions &opt)
Post constraints.
virtual void print(std::ostream &os) const
Print solution.
virtual Space * copy(void)
Copy during cloning.
void parse(int argc, char *argv[])
Parse commandline arguments.
void branch(Home home, const FloatVarArgs &x, FloatVarBranch vars, FloatValBranch vals, FloatBranchFilter bf=nullptr, FloatVarValPrint vvp=nullptr)
Branch over x with variable selection vars and value selection vals.
void linear(Home home, const FloatVarArgs &x, FloatRelType frt, FloatVal c)
Post propagator for .
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVar x1)
Post propagator for .
Gecode toplevel namespace
IntValBranch INT_VAL_SPLIT_MIN(void)
Select values not greater than mean of smallest and largest value.
IntVarBranch INT_VAR_AFC_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr)
Select variable with largest accumulated failure count divided by domain size with decay factor d.
void distinct(Home home, const IntVarArgs &x, IntPropLevel ipl=IPL_DEF)
Post propagator for for all .
IntVarBranch INT_VAR_SIZE_MIN(BranchTbl tbl=nullptr)
Select variable with smallest domain size.