Generated on Tue Mar 24 2020 14:04:04 for Gecode by doxygen 1.8.17
magic-square-partial.cpp
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Christian Schulte <schulte@gecode.org>
5  *
6  * Contributing authors:
7  * Samuel Gagnon <samuel.gagnon92@gmail.com>
8 
9  * Copyright:
10  * Christian Schulte, 2001
11  * Samuel Gagnon, 2018
12  *
13  * This file is part of Gecode, the generic constraint
14  * development environment:
15  * http://www.gecode.org
16  *
17  * Permission is hereby granted, free of charge, to any person obtaining
18  * a copy of this software and associated documentation files (the
19  * "Software"), to deal in the Software without restriction, including
20  * without limitation the rights to use, copy, modify, merge, publish,
21  * distribute, sublicense, and/or sell copies of the Software, and to
22  * permit persons to whom the Software is furnished to do so, subject to
23  * the following conditions:
24  *
25  * The above copyright notice and this permission notice shall be
26  * included in all copies or substantial portions of the Software.
27  *
28  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35  *
36  */
37 
38 #include <gecode/driver.hh>
39 #include <gecode/int.hh>
40 #include <gecode/minimodel.hh>
41 
42 using namespace Gecode;
43 
44 namespace {
46  extern const int *specs[];
48  extern const unsigned int n_examples;
49 }
50 
61 class MagicSquare : public Script {
62 private:
64  const int* spec;
66  const int n_filled;
68  const int n;
70  IntVarArray x;
71 
72 public:
74  enum {
77  BRANCH_CBS_MAX_SD
78  };
81  : Script(opt), spec(specs[opt.size()]),
82  n_filled(spec[1]), n(spec[0]), x(*this,n*n,1,n*n) {
83  // Number of fields on square
84  const int nn = n*n;
85 
86  // Sum of all a row, column, or diagonal
87  const int s = nn*(nn+1) / (2*n);
88 
89  // Matrix-wrapper for the square
90  Matrix<IntVarArray> m(x, n, n);
91 
92  for (int i=0; i<n_filled; i++) {
93  int row, col, num;
94  {
95  int idx = 3 * i + 2;
96  row = spec[idx] - 1;
97  col = spec[idx + 1] - 1;
98  num = spec[idx + 2];
99  }
100  rel(*this, m(col,row), IRT_EQ, num);
101  }
102 
103  for (int i = n; i--; ) {
104  linear(*this, m.row(i), IRT_EQ, s, opt.ipl());
105  linear(*this, m.col(i), IRT_EQ, s, opt.ipl());
106  }
107  // Both diagonals must have sum s
108  {
109  IntVarArgs d1y(n);
110  IntVarArgs d2y(n);
111  for (int i = n; i--; ) {
112  d1y[i] = m(i,i);
113  d2y[i] = m(n-i-1,i);
114  }
115  linear(*this, d1y, IRT_EQ, s, opt.ipl());
116  linear(*this, d2y, IRT_EQ, s, opt.ipl());
117  }
118 
119  // All fields must be distinct
120  distinct(*this, x, opt.ipl());
121 
122  switch (opt.branching()) {
123  case BRANCH_CBS_MAX_SD:
124 #ifdef GECODE_HAS_CBS
125  cbsbranch(*this, x);
126 #endif
127  case BRANCH_SIZE:
129  break;
130  case BRANCH_AFC_SIZE:
131  branch(*this, x, INT_VAR_AFC_SIZE_MAX(opt.decay()), INT_VAL_SPLIT_MIN());
132  break;
133  }
134  }
135 
138  : Script(s), spec(s.spec), n_filled(s.n_filled), n(s.n) {
139  x.update(*this, s.x);
140  }
141 
143  virtual Space*
144  copy(void) {
145  return new MagicSquare(*this);
146  }
148  virtual void
149  print(std::ostream& os) const {
150  // Matrix-wrapper for the square
151  Matrix<IntVarArray> m(x, n, n);
152  for (int i = 0; i<n; i++) {
153  os << "\t";
154  for (int j = 0; j<n; j++) {
155  os.width(2);
156  os << m(i,j) << " ";
157  }
158  os << std::endl;
159  }
160  }
161 
162 };
163 
167 int
168 main(int argc, char* argv[]) {
169  SizeOptions opt("MagicSquare");
170  opt.iterations(1);
171  opt.size(0);
175 #ifdef GECODE_HAS_CBS
177 #endif
178  opt.parse(argc,argv);
179  Script::run<MagicSquare,DFS,SizeOptions>(opt);
180  return 0;
181 }
182 
183 namespace {
184 
196  const int magicSquare5_filled10_10[] = {
197  5,10,
198  1,2,18,
199  1,3,9,
200  1,5,2,
201  2,2,5,
202  3,1,1,
203  3,5,24,
204  4,2,21,
205  4,3,6,
206  5,2,13,
207  5,4,10,
208  };
209 
210  const int magicSquare5_filled10_11[] = {
211  5,10,
212  1,3,6,
213  1,5,2,
214  2,2,8,
215  2,5,25,
216  3,1,1,
217  3,4,17,
218  3,5,24,
219  4,1,9,
220  4,2,21,
221  5,3,16,
222  };
223 
224  const int magicSquare5_filled10_12[] = {
225  5,10,
226  1,2,5,
227  1,4,21,
228  2,1,10,
229  2,2,16,
230  2,3,8,
231  3,4,12,
232  4,2,20,
233  4,5,11,
234  5,1,18,
235  5,5,3,
236  };
237 
238  const int magicSquare5_filled10_13[] = {
239  5,10,
240  1,5,2,
241  1,2,16,
242  2,3,8,
243  3,3,21,
244  3,1,1,
245  4,1,12,
246  5,2,6,
247  5,1,20,
248  5,3,14,
249  5,5,3,
250  };
251 
252  const int magicSquare5_filled10_14[] = {
253  5,10,
254  1,3,14,
255  1,2,7,
256  2,3,12,
257  2,4,4,
258  3,3,21,
259  3,5,24,
260  4,5,11,
261  4,4,6,
262  4,3,13,
263  5,4,22,
264  };
265 
266  const int magicSquare5_filled10_15[] = {
267  5,10,
268  1,5,2,
269  1,1,21,
270  2,1,15,
271  2,2,5,
272  4,2,18,
273  4,5,11,
274  5,4,20,
275  5,5,3,
276  5,2,12,
277  5,3,8,
278  };
279 
280  const int magicSquare5_filled10_16[] = {
281  5,10,
282  1,1,22,
283  1,5,2,
284  1,4,18,
285  2,5,25,
286  2,4,7,
287  3,4,15,
288  3,1,1,
289  3,2,9,
290  4,4,4,
291  5,1,23,
292  };
293 
294  const int magicSquare5_filled10_17[] = {
295  5,10,
296  1,2,5,
297  2,4,4,
298  2,5,25,
299  3,4,16,
300  3,5,24,
301  3,3,14,
302  3,1,1,
303  4,2,22,
304  5,3,13,
305  5,4,7,
306  };
307 
308  const int magicSquare5_filled10_18[] = {
309  5,10,
310  1,3,7,
311  1,4,22,
312  2,5,25,
313  2,4,4,
314  2,1,10,
315  3,1,1,
316  4,4,6,
317  4,3,20,
318  5,3,8,
319  5,2,12,
320  };
321 
322  const int magicSquare5_filled10_19[] = {
323  5,10,
324  1,2,6,
325  1,5,2,
326  2,2,18,
327  2,1,13,
328  3,5,24,
329  3,3,17,
330  5,2,7,
331  5,1,22,
332  5,4,21,
333  5,3,12,
334  };
335 
336  const int magicSquare5_filled10_1[] = {
337  5,10,
338  1,4,16,
339  1,5,2,
340  1,3,20,
341  2,5,25,
342  2,4,4,
343  3,5,24,
344  3,1,1,
345  4,4,9,
346  5,2,12,
347  5,1,23,
348  };
349 
350  const int magicSquare5_filled10_20[] = {
351  5,10,
352  1,1,22,
353  2,5,25,
354  2,2,5,
355  3,5,24,
356  3,1,1,
357  4,4,19,
358  4,5,11,
359  5,1,23,
360  5,2,8,
361  5,3,10,
362  };
363 
364  const int magicSquare5_filled10_2[] = {
365  5,10,
366  1,2,19,
367  1,4,9,
368  2,5,25,
369  2,1,15,
370  3,2,6,
371  4,2,20,
372  4,1,5,
373  5,5,3,
374  5,3,10,
375  5,1,23,
376  };
377 
378  const int magicSquare5_filled10_3[] = {
379  5,10,
380  1,1,15,
381  1,5,2,
382  2,1,20,
383  2,3,7,
384  3,4,5,
385  4,1,6,
386  4,4,16,
387  5,1,23,
388  5,2,12,
389  5,3,8,
390  };
391 
392  const int magicSquare5_filled10_4[] = {
393  5,10,
394  1,2,15,
395  1,5,2,
396  1,1,22,
397  1,4,16,
398  2,5,25,
399  3,5,24,
400  3,1,1,
401  4,1,23,
402  4,2,18,
403  4,3,9,
404  };
405 
406  const int magicSquare5_filled10_5[] = {
407  5,10,
408  1,1,14,
409  1,4,21,
410  2,2,12,
411  2,5,25,
412  3,2,5,
413  3,3,19,
414  3,5,24,
415  4,2,18,
416  5,1,22,
417  5,2,10,
418  };
419 
420  const int magicSquare5_filled10_6[] = {
421  5,10,
422  1,1,19,
423  1,2,20,
424  2,1,7,
425  3,3,23,
426  4,5,11,
427  4,4,4,
428  5,3,13,
429  5,5,3,
430  5,4,22,
431  5,2,10,
432  };
433 
434  const int magicSquare5_filled10_7[] = {
435  5,10,
436  1,2,10,
437  2,4,4,
438  3,5,24,
439  3,4,17,
440  4,5,11,
441  4,2,23,
442  4,4,5,
443  4,1,14,
444  5,2,6,
445  5,5,3,
446  };
447 
448  const int magicSquare5_filled10_8[] = {
449  5,10,
450  1,1,22,
451  1,3,5,
452  2,5,25,
453  2,4,4,
454  3,5,24,
455  3,2,8,
456  4,1,10,
457  4,2,21,
458  4,3,16,
459  4,5,11,
460  };
461 
462  const int magicSquare5_filled10_9[] = {
463  5,10,
464  1,5,2,
465  2,2,10,
466  2,5,25,
467  3,3,23,
468  3,1,1,
469  4,2,15,
470  4,4,13,
471  4,3,6,
472  5,5,3,
473  5,3,5,
474  };
475 
476  const int magicSquare5_filled11_3_1[] = {
477  5,11,
478  1,1,15,
479  1,5,2,
480  2,1,20,
481  2,3,7,
482  3,2,13,
483  3,4,5,
484  4,1,6,
485  4,4,16,
486  5,1,23,
487  5,2,12,
488  5,3,8,
489  };
490 
491  const int magicSquare5_filled11_5_1[] = {
492  5,11,
493  1,1,14,
494  1,4,21,
495  2,2,12,
496  2,5,25,
497  3,2,5,
498  3,3,19,
499  3,4,16,
500  3,5,24,
501  4,2,18,
502  5,1,22,
503  5,2,10,
504  };
505 
506  const int magicSquare5_filled11_5_2[] = {
507  5,11,
508  1,1,14,
509  1,4,21,
510  2,2,12,
511  2,5,25,
512  3,2,5,
513  3,3,19,
514  3,5,24,
515  4,2,18,
516  5,1,22,
517  5,2,10,
518  5,5,3,
519  };
520 
521  const int magicSquare5_filled11_5_3[] = {
522  5,11,
523  1,1,14,
524  1,3,8,
525  1,4,21,
526  2,2,12,
527  2,5,25,
528  3,2,5,
529  3,3,19,
530  3,5,24,
531  4,2,18,
532  5,1,22,
533  5,2,10,
534  };
535 
536  const int magicSquare5_filled12_10_1[] = {
537  5,12,
538  1,2,18,
539  1,3,9,
540  1,5,2,
541  2,2,5,
542  3,1,1,
543  3,3,15,
544  3,5,24,
545  4,1,7,
546  4,2,21,
547  4,3,6,
548  5,2,13,
549  5,4,10,
550  };
551 
552  const int magicSquare5_filled12_1_1[] = {
553  5,12,
554  1,1,21,
555  1,3,20,
556  1,4,16,
557  1,5,2,
558  2,5,25,
559  2,4,4,
560  3,1,1,
561  3,3,14,
562  3,5,24,
563  4,4,9,
564  5,2,12,
565  5,1,23,
566  };
567 
568  const int magicSquare5_filled12_1_2[] = {
569  5,12,
570  1,3,20,
571  1,4,16,
572  1,5,2,
573  2,2,18,
574  2,4,4,
575  2,5,25,
576  3,1,1,
577  3,3,14,
578  3,5,24,
579  4,4,9,
580  5,2,12,
581  5,1,23,
582  };
583 
584  const int magicSquare5_filled12_1_3[] = {
585  5,12,
586  1,3,20,
587  1,4,16,
588  1,5,2,
589  2,2,18,
590  2,4,4,
591  2,5,25,
592  3,1,1,
593  3,5,24,
594  4,4,9,
595  5,1,23,
596  5,2,12,
597  5,3,10,
598  };
599 
600  const int magicSquare5_filled12_2_1[] = {
601  5,12,
602  1,1,21,
603  1,2,19,
604  1,4,9,
605  2,1,15,
606  2,5,25,
607  3,2,6,
608  3,4,18,
609  4,1,5,
610  4,2,20,
611  5,1,23,
612  5,3,10,
613  5,5,3,
614  };
615 
616  const int magicSquare5_filled12_2_2[] = {
617  5,12,
618  1,2,19,
619  1,4,9,
620  2,1,15,
621  2,3,8,
622  2,5,25,
623  3,2,6,
624  3,4,18,
625  4,1,5,
626  4,2,20,
627  5,1,23,
628  5,3,10,
629  5,5,3,
630  };
631 
632  const int magicSquare5_filled12_2_3[] = {
633  5,12,
634  1,1,21,
635  1,2,19,
636  1,4,9,
637  2,1,15,
638  2,5,25,
639  3,2,6,
640  4,1,5,
641  4,2,20,
642  4,4,12,
643  5,1,23,
644  5,3,10,
645  5,5,3,
646  };
647 
648  const int magicSquare5_filled12_3_1[] = {
649  5,12,
650  1,1,15,
651  1,4,21,
652  1,5,2,
653  2,1,20,
654  2,3,7,
655  3,4,5,
656  4,1,6,
657  4,4,16,
658  5,1,23,
659  5,2,12,
660  5,3,8,
661  5,5,3,
662  };
663 
664  const int magicSquare5_filled12_3_2[] = {
665  5,12,
666  1,1,15,
667  1,2,17,
668  1,3,10,
669  1,5,2,
670  2,1,20,
671  2,3,7,
672  3,4,5,
673  4,1,6,
674  4,4,16,
675  5,1,23,
676  5,2,12,
677  5,3,8,
678  };
679 
680  const int magicSquare9_filled10_10[] = {
681  9,10,
682  8,2,19,
683  6,7,25,
684  7,3,15,
685  8,4,77,
686  7,1,29,
687  4,9,63,
688  4,6,53,
689  7,1,29,
690  3,9,36,
691  5,4,74,
692  };
693 
694  const int magicSquare9_filled10_11[] = {
695  9,10,
696  5,5,78,
697  6,5,56,
698  9,8,30,
699  3,3,38,
700  2,3,9,
701  1,2,23,
702  3,5,80,
703  9,7,52,
704  7,5,1,
705  1,1,32,
706  };
707 
708  const int magicSquare9_filled10_12[] = {
709  9,10,
710  6,7,25,
711  1,4,2,
712  5,1,54,
713  3,3,38,
714  7,2,71,
715  1,5,28,
716  3,2,50,
717  2,7,59,
718  7,7,42,
719  5,4,74,
720  };
721 
722  const int magicSquare9_filled10_13[] = {
723  9,10,
724  7,2,71,
725  8,9,22,
726  2,2,17,
727  3,3,38,
728  1,8,72,
729  6,5,56,
730  5,6,41,
731  9,1,8,
732  7,8,37,
733  3,3,38,
734  };
735 
736  const int magicSquare9_filled10_14[] = {
737  9,10,
738  9,4,35,
739  1,3,48,
740  9,6,69,
741  7,6,70,
742  6,1,46,
743  5,1,54,
744  4,2,62,
745  2,8,67,
746  7,6,70,
747  7,3,15,
748  };
749 
750  const int magicSquare9_filled10_15[] = {
751  9,10,
752  9,8,30,
753  1,6,4,
754  9,9,45,
755  9,2,49,
756  5,6,41,
757  6,5,56,
758  5,9,7,
759  2,6,3,
760  3,2,50,
761  1,2,23,
762  };
763 
764  const int magicSquare9_filled10_16[] = {
765  9,10,
766  1,9,81,
767  3,8,18,
768  8,4,77,
769  6,5,56,
770  7,9,31,
771  1,9,81,
772  7,3,15,
773  6,4,5,
774  6,8,61,
775  4,6,53,
776  };
777 
778  const int magicSquare9_filled10_17[] = {
779  9,10,
780  4,4,12,
781  9,5,26,
782  7,6,70,
783  8,2,19,
784  7,2,71,
785  8,1,68,
786  8,2,19,
787  5,5,78,
788  6,3,21,
789  5,3,75,
790  };
791 
792  const int magicSquare9_filled10_18[] = {
793  9,10,
794  7,2,71,
795  4,1,47,
796  6,9,24,
797  8,8,39,
798  3,9,36,
799  2,9,60,
800  4,3,64,
801  5,8,11,
802  4,2,62,
803  3,7,43,
804  };
805 
806  const int magicSquare9_filled10_19[] = {
807  9,10,
808  7,4,73,
809  8,3,44,
810  8,1,68,
811  1,2,23,
812  1,6,4,
813  5,7,16,
814  3,6,6,
815  8,2,19,
816  4,5,14,
817  3,3,38,
818  };
819 
820  const int magicSquare9_filled10_1[] = {
821  9,10,
822  4,5,14,
823  6,7,25,
824  8,8,39,
825  6,7,25,
826  3,8,18,
827  4,4,12,
828  8,2,19,
829  4,1,47,
830  4,6,53,
831  8,5,10,
832  };
833 
834  const int magicSquare9_filled10_20[] = {
835  9,10,
836  1,4,2,
837  8,6,57,
838  1,5,28,
839  1,8,72,
840  6,1,46,
841  4,1,47,
842  8,7,33,
843  4,6,53,
844  1,5,28,
845  5,8,11,
846  };
847 
848  const int magicSquare9_filled10_2[] = {
849  9,10,
850  2,5,76,
851  9,1,8,
852  2,4,51,
853  1,2,23,
854  9,7,52,
855  1,8,72,
856  3,3,38,
857  6,6,66,
858  3,7,43,
859  7,6,70,
860  };
861 
862  const int magicSquare9_filled10_3[] = {
863  9,10,
864  5,6,41,
865  5,3,75,
866  6,1,46,
867  3,2,50,
868  3,8,18,
869  1,5,28,
870  3,2,50,
871  5,9,7,
872  4,8,34,
873  1,4,2,
874  };
875 
876  const int magicSquare9_filled10_4[] = {
877  9,10,
878  4,9,63,
879  9,4,35,
880  7,5,1,
881  2,6,3,
882  8,4,77,
883  7,6,70,
884  5,8,11,
885  2,5,76,
886  9,4,35,
887  3,6,6,
888  };
889 
890  const int magicSquare9_filled10_5[] = {
891  9,10,
892  2,5,76,
893  1,4,2,
894  9,3,55,
895  1,2,23,
896  3,3,38,
897  2,5,76,
898  3,4,40,
899  3,4,40,
900  1,2,23,
901  3,6,6,
902  };
903 
904  const int magicSquare9_filled10_6[] = {
905  9,10,
906  7,5,1,
907  4,7,20,
908  8,7,33,
909  5,5,78,
910  5,2,13,
911  3,1,58,
912  1,9,81,
913  5,1,54,
914  3,1,58,
915  7,5,1,
916  };
917 
918  const int magicSquare9_filled10_7[] = {
919  9,10,
920  7,5,1,
921  7,5,1,
922  1,5,28,
923  4,8,34,
924  4,1,47,
925  4,2,62,
926  2,6,3,
927  2,8,67,
928  1,9,81,
929  5,4,74,
930  };
931 
932  const int magicSquare9_filled10_8[] = {
933  9,10,
934  9,4,35,
935  4,9,63,
936  1,6,4,
937  5,5,78,
938  7,5,1,
939  9,4,35,
940  5,6,41,
941  6,3,21,
942  9,3,55,
943  3,5,80,
944  };
945 
946  const int magicSquare9_filled10_9[] = {
947  9,10,
948  4,8,34,
949  4,1,47,
950  3,9,36,
951  8,6,57,
952  9,2,49,
953  9,9,45,
954  1,6,4,
955  4,6,53,
956  3,6,6,
957  2,2,17,
958  };
959 
960  const int magicSquare9_filled50_10[] = {
961  9,50,
962  4,3,64,
963  3,9,36,
964  8,3,44,
965  6,9,24,
966  2,7,59,
967  7,2,71,
968  8,2,19,
969  2,8,67,
970  6,7,25,
971  6,6,66,
972  3,8,18,
973  1,9,81,
974  8,4,77,
975  5,4,74,
976  8,2,19,
977  6,9,24,
978  4,9,63,
979  9,3,55,
980  2,5,76,
981  9,2,49,
982  3,7,43,
983  3,8,18,
984  6,3,21,
985  6,2,65,
986  9,2,49,
987  7,9,31,
988  8,6,57,
989  8,6,57,
990  9,3,55,
991  7,5,1,
992  2,4,51,
993  5,4,74,
994  3,4,40,
995  4,2,62,
996  6,3,21,
997  3,6,6,
998  7,4,73,
999  5,4,74,
1000  4,8,34,
1001  3,3,38,
1002  8,1,68,
1003  3,4,40,
1004  6,8,61,
1005  7,3,15,
1006  9,5,26,
1007  7,1,29,
1008  6,9,24,
1009  2,6,3,
1010  3,5,80,
1011  7,9,31,
1012  };
1013 
1014  const int magicSquare9_filled50_11[] = {
1015  9,50,
1016  6,8,61,
1017  3,3,38,
1018  9,7,52,
1019  6,3,21,
1020  4,9,63,
1021  3,9,36,
1022  7,3,15,
1023  1,1,32,
1024  2,7,59,
1025  1,8,72,
1026  2,5,76,
1027  8,7,33,
1028  5,1,54,
1029  3,5,80,
1030  3,8,18,
1031  4,8,34,
1032  4,5,14,
1033  2,3,9,
1034  9,5,26,
1035  3,3,38,
1036  2,5,76,
1037  9,8,30,
1038  8,9,22,
1039  6,7,25,
1040  7,6,70,
1041  5,6,41,
1042  2,1,27,
1043  4,4,12,
1044  8,4,77,
1045  8,2,19,
1046  9,1,8,
1047  7,3,15,
1048  5,6,41,
1049  3,4,40,
1050  2,5,76,
1051  5,1,54,
1052  8,4,77,
1053  7,4,73,
1054  2,3,9,
1055  1,8,72,
1056  7,3,15,
1057  4,6,53,
1058  3,5,80,
1059  9,2,49,
1060  7,7,42,
1061  1,6,4,
1062  7,7,42,
1063  7,2,71,
1064  4,7,20,
1065  4,3,64,
1066  };
1067 
1068  const int magicSquare9_filled50_12[] = {
1069  9,50,
1070  1,3,48,
1071  3,5,80,
1072  4,5,14,
1073  6,1,46,
1074  8,8,39,
1075  2,8,67,
1076  8,8,39,
1077  9,2,49,
1078  2,2,17,
1079  6,1,46,
1080  9,9,45,
1081  8,9,22,
1082  3,4,40,
1083  2,3,9,
1084  4,6,53,
1085  5,3,75,
1086  6,6,66,
1087  7,1,29,
1088  8,1,68,
1089  1,7,79,
1090  7,9,31,
1091  5,3,75,
1092  6,4,5,
1093  5,7,16,
1094  3,1,58,
1095  5,3,75,
1096  7,4,73,
1097  9,8,30,
1098  5,8,11,
1099  1,7,79,
1100  4,4,12,
1101  9,8,30,
1102  7,4,73,
1103  6,5,56,
1104  4,4,12,
1105  2,8,67,
1106  1,4,2,
1107  2,6,3,
1108  6,4,5,
1109  1,8,72,
1110  2,6,3,
1111  8,9,22,
1112  7,7,42,
1113  5,9,7,
1114  5,5,78,
1115  6,7,25,
1116  6,5,56,
1117  3,3,38,
1118  8,8,39,
1119  8,1,68,
1120  };
1121 
1122  const int magicSquare9_filled50_13[] = {
1123  9,50,
1124  2,7,59,
1125  6,2,65,
1126  9,5,26,
1127  6,5,56,
1128  8,6,57,
1129  1,1,32,
1130  9,9,45,
1131  7,6,70,
1132  4,2,62,
1133  4,9,63,
1134  4,9,63,
1135  4,8,34,
1136  3,6,6,
1137  1,1,32,
1138  2,6,3,
1139  8,3,44,
1140  2,3,9,
1141  2,1,27,
1142  7,7,42,
1143  3,6,6,
1144  2,3,9,
1145  4,1,47,
1146  2,1,27,
1147  5,4,74,
1148  9,8,30,
1149  3,1,58,
1150  7,4,73,
1151  6,9,24,
1152  7,5,1,
1153  8,8,39,
1154  1,4,2,
1155  1,9,81,
1156  6,9,24,
1157  7,2,71,
1158  5,9,7,
1159  5,6,41,
1160  1,8,72,
1161  4,2,62,
1162  6,8,61,
1163  3,3,38,
1164  6,5,56,
1165  1,2,23,
1166  6,7,25,
1167  8,3,44,
1168  2,4,51,
1169  1,9,81,
1170  8,8,39,
1171  9,2,49,
1172  6,6,66,
1173  3,1,58,
1174  };
1175 
1176  const int magicSquare9_filled50_14[] = {
1177  9,50,
1178  1,4,2,
1179  6,7,25,
1180  3,2,50,
1181  6,6,66,
1182  2,8,67,
1183  5,1,54,
1184  2,6,3,
1185  7,7,42,
1186  6,2,65,
1187  2,8,67,
1188  8,3,44,
1189  2,9,60,
1190  4,5,14,
1191  9,5,26,
1192  4,1,47,
1193  5,2,13,
1194  4,9,63,
1195  6,5,56,
1196  1,9,81,
1197  1,2,23,
1198  8,4,77,
1199  1,9,81,
1200  9,7,52,
1201  5,3,75,
1202  8,6,57,
1203  1,7,79,
1204  8,9,22,
1205  4,9,63,
1206  5,1,54,
1207  3,6,6,
1208  1,7,79,
1209  5,3,75,
1210  6,2,65,
1211  5,6,41,
1212  1,3,48,
1213  6,8,61,
1214  6,6,66,
1215  6,3,21,
1216  3,1,58,
1217  6,8,61,
1218  6,4,5,
1219  5,4,74,
1220  4,7,20,
1221  1,6,4,
1222  7,3,15,
1223  2,6,3,
1224  1,6,4,
1225  6,4,5,
1226  5,1,54,
1227  8,4,77,
1228  };
1229 
1230  const int magicSquare9_filled50_15[] = {
1231  9,50,
1232  1,4,2,
1233  2,7,59,
1234  7,5,1,
1235  7,7,42,
1236  5,3,75,
1237  5,1,54,
1238  7,8,37,
1239  2,8,67,
1240  3,3,38,
1241  4,9,63,
1242  3,3,38,
1243  3,1,58,
1244  6,8,61,
1245  5,2,13,
1246  6,1,46,
1247  5,5,78,
1248  4,4,12,
1249  2,8,67,
1250  9,8,30,
1251  5,2,13,
1252  9,7,52,
1253  3,4,40,
1254  5,2,13,
1255  9,7,52,
1256  2,3,9,
1257  5,5,78,
1258  3,5,80,
1259  5,8,11,
1260  2,7,59,
1261  9,7,52,
1262  7,2,71,
1263  9,8,30,
1264  4,1,47,
1265  6,1,46,
1266  7,8,37,
1267  2,4,51,
1268  6,2,65,
1269  5,8,11,
1270  2,4,51,
1271  6,3,21,
1272  6,8,61,
1273  5,8,11,
1274  3,8,18,
1275  4,4,12,
1276  5,4,74,
1277  9,1,8,
1278  3,8,18,
1279  8,4,77,
1280  7,3,15,
1281  4,2,62,
1282  };
1283 
1284  const int magicSquare9_filled50_16[] = {
1285  9,50,
1286  1,4,2,
1287  3,6,6,
1288  3,7,43,
1289  5,4,74,
1290  1,8,72,
1291  5,6,41,
1292  4,7,20,
1293  2,6,3,
1294  3,5,80,
1295  8,8,39,
1296  6,5,56,
1297  6,7,25,
1298  3,4,40,
1299  1,7,79,
1300  4,3,64,
1301  8,5,10,
1302  4,8,34,
1303  8,6,57,
1304  5,3,75,
1305  8,5,10,
1306  8,1,68,
1307  8,2,19,
1308  5,9,7,
1309  8,8,39,
1310  3,4,40,
1311  4,6,53,
1312  8,9,22,
1313  3,8,18,
1314  1,2,23,
1315  6,5,56,
1316  4,2,62,
1317  9,7,52,
1318  1,7,79,
1319  1,5,28,
1320  8,8,39,
1321  1,6,4,
1322  6,8,61,
1323  8,2,19,
1324  6,4,5,
1325  9,6,69,
1326  5,3,75,
1327  2,3,9,
1328  2,3,9,
1329  1,9,81,
1330  4,4,12,
1331  4,5,14,
1332  6,3,21,
1333  2,4,51,
1334  8,9,22,
1335  8,6,57,
1336  };
1337 
1338  const int magicSquare9_filled50_17[] = {
1339  9,50,
1340  8,6,57,
1341  9,2,49,
1342  3,5,80,
1343  3,6,6,
1344  8,2,19,
1345  9,1,8,
1346  2,1,27,
1347  3,1,58,
1348  1,2,23,
1349  1,2,23,
1350  5,2,13,
1351  6,8,61,
1352  5,5,78,
1353  2,1,27,
1354  5,8,11,
1355  4,1,47,
1356  4,3,64,
1357  2,4,51,
1358  8,3,44,
1359  9,4,35,
1360  2,8,67,
1361  5,4,74,
1362  7,5,1,
1363  2,7,59,
1364  6,2,65,
1365  9,9,45,
1366  4,3,64,
1367  7,6,70,
1368  8,9,22,
1369  4,3,64,
1370  7,7,42,
1371  1,1,32,
1372  7,2,71,
1373  3,3,38,
1374  2,2,17,
1375  5,4,74,
1376  8,7,33,
1377  7,3,15,
1378  2,8,67,
1379  7,6,70,
1380  8,4,77,
1381  5,9,7,
1382  7,2,71,
1383  3,3,38,
1384  1,6,4,
1385  5,5,78,
1386  1,3,48,
1387  4,7,20,
1388  2,6,3,
1389  8,4,77,
1390  };
1391 
1392  const int magicSquare9_filled50_18[] = {
1393  9,50,
1394  5,3,75,
1395  7,1,29,
1396  9,4,35,
1397  3,8,18,
1398  9,1,8,
1399  4,5,14,
1400  2,6,3,
1401  2,8,67,
1402  8,4,77,
1403  1,6,4,
1404  7,3,15,
1405  2,5,76,
1406  5,5,78,
1407  3,7,43,
1408  1,8,72,
1409  8,5,10,
1410  1,5,28,
1411  6,7,25,
1412  6,6,66,
1413  5,3,75,
1414  6,7,25,
1415  8,8,39,
1416  3,9,36,
1417  4,1,47,
1418  2,3,9,
1419  7,8,37,
1420  5,6,41,
1421  4,8,34,
1422  1,4,2,
1423  3,8,18,
1424  9,1,8,
1425  3,9,36,
1426  5,6,41,
1427  6,8,61,
1428  3,8,18,
1429  1,6,4,
1430  5,8,11,
1431  2,8,67,
1432  6,4,5,
1433  6,5,56,
1434  6,1,46,
1435  1,8,72,
1436  6,2,65,
1437  6,6,66,
1438  5,6,41,
1439  4,2,62,
1440  6,5,56,
1441  1,8,72,
1442  8,4,77,
1443  4,8,34,
1444  };
1445 
1446  const int magicSquare9_filled50_19[] = {
1447  9,50,
1448  1,5,28,
1449  3,5,80,
1450  1,2,23,
1451  1,4,2,
1452  5,7,16,
1453  8,8,39,
1454  5,9,7,
1455  7,2,71,
1456  1,1,32,
1457  5,4,74,
1458  7,9,31,
1459  5,1,54,
1460  2,4,51,
1461  7,9,31,
1462  7,1,29,
1463  6,5,56,
1464  3,8,18,
1465  1,4,2,
1466  9,8,30,
1467  7,3,15,
1468  3,4,40,
1469  1,8,72,
1470  3,5,80,
1471  9,3,55,
1472  6,4,5,
1473  6,1,46,
1474  1,9,81,
1475  1,2,23,
1476  3,5,80,
1477  9,7,52,
1478  4,5,14,
1479  3,6,6,
1480  1,1,32,
1481  7,9,31,
1482  8,3,44,
1483  2,2,17,
1484  6,1,46,
1485  9,6,69,
1486  5,6,41,
1487  8,1,68,
1488  7,3,15,
1489  1,8,72,
1490  9,9,45,
1491  7,2,71,
1492  2,4,51,
1493  8,5,10,
1494  6,1,46,
1495  2,6,3,
1496  1,6,4,
1497  4,7,20,
1498  };
1499 
1500  const int magicSquare9_filled50_1[] = {
1501  9,50,
1502  7,1,29,
1503  2,9,60,
1504  2,4,51,
1505  1,8,72,
1506  8,5,10,
1507  4,6,53,
1508  3,4,40,
1509  6,2,65,
1510  8,2,19,
1511  3,6,6,
1512  6,2,65,
1513  2,8,67,
1514  2,5,76,
1515  8,9,22,
1516  6,2,65,
1517  6,1,46,
1518  2,8,67,
1519  1,4,2,
1520  9,8,30,
1521  2,5,76,
1522  3,3,38,
1523  1,3,48,
1524  4,6,53,
1525  5,1,54,
1526  7,5,1,
1527  6,1,46,
1528  4,6,53,
1529  6,5,56,
1530  1,5,28,
1531  3,6,6,
1532  4,8,34,
1533  7,6,70,
1534  4,5,14,
1535  7,3,15,
1536  1,6,4,
1537  8,2,19,
1538  7,6,70,
1539  4,8,34,
1540  3,8,18,
1541  8,7,33,
1542  1,5,28,
1543  6,5,56,
1544  8,2,19,
1545  9,8,30,
1546  4,2,62,
1547  3,8,18,
1548  8,7,33,
1549  4,2,62,
1550  9,8,30,
1551  5,9,7,
1552  };
1553 
1554  const int magicSquare9_filled50_20[] = {
1555  9,50,
1556  8,3,44,
1557  8,2,19,
1558  3,5,80,
1559  7,8,37,
1560  8,4,77,
1561  6,5,56,
1562  4,5,14,
1563  1,3,48,
1564  2,6,3,
1565  4,3,64,
1566  9,9,45,
1567  6,6,66,
1568  8,5,10,
1569  2,6,3,
1570  1,5,28,
1571  3,7,43,
1572  8,8,39,
1573  8,8,39,
1574  1,4,2,
1575  4,8,34,
1576  5,8,11,
1577  2,8,67,
1578  1,2,23,
1579  1,2,23,
1580  7,2,71,
1581  2,7,59,
1582  1,7,79,
1583  1,6,4,
1584  2,9,60,
1585  3,1,58,
1586  3,3,38,
1587  7,8,37,
1588  9,3,55,
1589  6,9,24,
1590  4,1,47,
1591  8,8,39,
1592  6,9,24,
1593  6,6,66,
1594  8,4,77,
1595  5,6,41,
1596  5,6,41,
1597  1,4,2,
1598  2,8,67,
1599  9,1,8,
1600  7,9,31,
1601  1,9,81,
1602  3,7,43,
1603  7,2,71,
1604  8,2,19,
1605  8,2,19,
1606  };
1607 
1608  const int magicSquare9_filled50_2[] = {
1609  9,50,
1610  2,1,27,
1611  8,8,39,
1612  6,3,21,
1613  7,6,70,
1614  8,5,10,
1615  2,9,60,
1616  7,7,42,
1617  4,5,14,
1618  8,1,68,
1619  2,3,9,
1620  3,2,50,
1621  8,1,68,
1622  8,9,22,
1623  9,5,26,
1624  7,2,71,
1625  2,8,67,
1626  2,1,27,
1627  5,6,41,
1628  3,2,50,
1629  9,8,30,
1630  4,1,47,
1631  7,9,31,
1632  7,1,29,
1633  4,4,12,
1634  2,3,9,
1635  4,2,62,
1636  4,9,63,
1637  9,9,45,
1638  8,8,39,
1639  2,5,76,
1640  1,4,2,
1641  1,9,81,
1642  4,5,14,
1643  3,4,40,
1644  4,3,64,
1645  2,8,67,
1646  1,9,81,
1647  7,8,37,
1648  7,8,37,
1649  9,6,69,
1650  9,1,8,
1651  5,1,54,
1652  9,2,49,
1653  1,7,79,
1654  1,9,81,
1655  9,8,30,
1656  3,7,43,
1657  5,4,74,
1658  3,8,18,
1659  7,4,73,
1660  };
1661 
1662  const int magicSquare9_filled50_3[] = {
1663  9,50,
1664  8,7,33,
1665  9,8,30,
1666  4,4,12,
1667  4,1,47,
1668  3,3,38,
1669  5,9,7,
1670  1,9,81,
1671  9,7,52,
1672  9,7,52,
1673  2,7,59,
1674  7,1,29,
1675  5,9,7,
1676  8,7,33,
1677  2,8,67,
1678  3,6,6,
1679  2,1,27,
1680  3,9,36,
1681  9,6,69,
1682  3,3,38,
1683  5,3,75,
1684  4,9,63,
1685  2,4,51,
1686  6,2,65,
1687  2,5,76,
1688  8,1,68,
1689  9,5,26,
1690  2,2,17,
1691  3,7,43,
1692  9,2,49,
1693  3,2,50,
1694  7,2,71,
1695  3,1,58,
1696  1,2,23,
1697  6,4,5,
1698  4,1,47,
1699  6,5,56,
1700  7,8,37,
1701  9,2,49,
1702  9,8,30,
1703  4,5,14,
1704  8,4,77,
1705  8,7,33,
1706  5,8,11,
1707  2,4,51,
1708  9,4,35,
1709  4,6,53,
1710  4,6,53,
1711  6,4,5,
1712  5,1,54,
1713  7,6,70,
1714  };
1715 
1716  const int magicSquare9_filled50_4[] = {
1717  9,50,
1718  8,2,19,
1719  2,6,3,
1720  9,8,30,
1721  5,6,41,
1722  4,8,34,
1723  8,9,22,
1724  9,6,69,
1725  5,5,78,
1726  4,6,53,
1727  6,3,21,
1728  8,7,33,
1729  7,2,71,
1730  1,3,48,
1731  3,5,80,
1732  1,8,72,
1733  9,9,45,
1734  9,8,30,
1735  3,6,6,
1736  6,7,25,
1737  9,7,52,
1738  3,5,80,
1739  6,3,21,
1740  2,1,27,
1741  5,3,75,
1742  5,8,11,
1743  4,1,47,
1744  6,1,46,
1745  9,6,69,
1746  1,2,23,
1747  9,2,49,
1748  7,8,37,
1749  1,4,2,
1750  4,3,64,
1751  7,7,42,
1752  7,6,70,
1753  4,9,63,
1754  2,9,60,
1755  9,1,8,
1756  8,4,77,
1757  1,1,32,
1758  3,4,40,
1759  1,6,4,
1760  2,9,60,
1761  2,3,9,
1762  8,8,39,
1763  2,4,51,
1764  4,2,62,
1765  7,7,42,
1766  2,5,76,
1767  4,8,34,
1768  };
1769 
1770  const int magicSquare9_filled50_5[] = {
1771  9,50,
1772  8,7,33,
1773  7,7,42,
1774  5,7,16,
1775  5,1,54,
1776  8,6,57,
1777  1,1,32,
1778  9,8,30,
1779  4,2,62,
1780  5,6,41,
1781  2,1,27,
1782  2,3,9,
1783  4,6,53,
1784  2,9,60,
1785  3,3,38,
1786  4,5,14,
1787  1,9,81,
1788  9,5,26,
1789  7,2,71,
1790  9,2,49,
1791  2,8,67,
1792  7,9,31,
1793  6,5,56,
1794  5,1,54,
1795  4,7,20,
1796  4,5,14,
1797  8,5,10,
1798  5,9,7,
1799  1,6,4,
1800  8,2,19,
1801  8,9,22,
1802  6,6,66,
1803  9,3,55,
1804  1,6,4,
1805  5,1,54,
1806  5,6,41,
1807  8,3,44,
1808  4,2,62,
1809  7,8,37,
1810  2,8,67,
1811  4,5,14,
1812  3,2,50,
1813  1,7,79,
1814  1,8,72,
1815  3,7,43,
1816  9,8,30,
1817  6,3,21,
1818  4,5,14,
1819  6,2,65,
1820  1,1,32,
1821  2,6,3,
1822  };
1823 
1824  const int magicSquare9_filled50_6[] = {
1825  9,50,
1826  4,7,20,
1827  6,7,25,
1828  9,1,8,
1829  4,1,47,
1830  8,7,33,
1831  4,8,34,
1832  6,4,5,
1833  5,4,74,
1834  9,5,26,
1835  1,9,81,
1836  1,7,79,
1837  9,4,35,
1838  2,5,76,
1839  5,1,54,
1840  3,5,80,
1841  4,7,20,
1842  9,7,52,
1843  2,8,67,
1844  7,3,15,
1845  7,3,15,
1846  7,1,29,
1847  1,1,32,
1848  2,3,9,
1849  5,1,54,
1850  5,5,78,
1851  7,5,1,
1852  9,5,26,
1853  6,2,65,
1854  7,8,37,
1855  9,1,8,
1856  1,1,32,
1857  5,1,54,
1858  7,4,73,
1859  8,2,19,
1860  5,3,75,
1861  4,2,62,
1862  1,2,23,
1863  3,2,50,
1864  2,5,76,
1865  1,6,4,
1866  9,5,26,
1867  8,9,22,
1868  9,2,49,
1869  8,5,10,
1870  9,5,26,
1871  5,1,54,
1872  5,7,16,
1873  8,2,19,
1874  1,4,2,
1875  3,3,38,
1876  };
1877 
1878  const int magicSquare9_filled50_7[] = {
1879  9,50,
1880  6,3,21,
1881  7,6,70,
1882  3,4,40,
1883  5,2,13,
1884  6,6,66,
1885  7,8,37,
1886  8,6,57,
1887  8,1,68,
1888  2,9,60,
1889  4,8,34,
1890  7,3,15,
1891  2,3,9,
1892  4,3,64,
1893  2,2,17,
1894  7,2,71,
1895  3,3,38,
1896  4,9,63,
1897  8,4,77,
1898  2,4,51,
1899  3,5,80,
1900  7,1,29,
1901  3,5,80,
1902  6,1,46,
1903  4,7,20,
1904  1,5,28,
1905  3,5,80,
1906  8,4,77,
1907  7,2,71,
1908  6,8,61,
1909  3,3,38,
1910  8,4,77,
1911  3,9,36,
1912  1,2,23,
1913  4,2,62,
1914  3,6,6,
1915  4,7,20,
1916  4,7,20,
1917  9,9,45,
1918  5,1,54,
1919  4,3,64,
1920  6,6,66,
1921  8,2,19,
1922  8,5,10,
1923  3,2,50,
1924  2,4,51,
1925  3,7,43,
1926  5,5,78,
1927  4,5,14,
1928  4,7,20,
1929  5,4,74,
1930  };
1931 
1932  const int magicSquare9_filled50_8[] = {
1933  9,50,
1934  2,8,67,
1935  1,3,48,
1936  5,8,11,
1937  3,8,18,
1938  8,6,57,
1939  1,2,23,
1940  1,8,72,
1941  3,8,18,
1942  2,4,51,
1943  7,1,29,
1944  5,9,7,
1945  5,9,7,
1946  5,8,11,
1947  4,6,53,
1948  4,8,34,
1949  1,3,48,
1950  5,8,11,
1951  5,7,16,
1952  6,5,56,
1953  5,3,75,
1954  9,4,35,
1955  4,9,63,
1956  9,5,26,
1957  5,8,11,
1958  8,2,19,
1959  6,3,21,
1960  9,1,8,
1961  2,4,51,
1962  7,3,15,
1963  9,1,8,
1964  9,7,52,
1965  1,2,23,
1966  6,5,56,
1967  8,2,19,
1968  8,2,19,
1969  2,7,59,
1970  5,6,41,
1971  6,4,5,
1972  8,8,39,
1973  3,6,6,
1974  7,8,37,
1975  6,6,66,
1976  7,5,1,
1977  7,2,71,
1978  5,5,78,
1979  2,2,17,
1980  2,9,60,
1981  3,7,43,
1982  2,2,17,
1983  7,9,31,
1984  };
1985 
1986  const int magicSquare9_filled50_9[] = {
1987  9,50,
1988  3,8,18,
1989  6,7,25,
1990  2,9,60,
1991  8,9,22,
1992  7,8,37,
1993  3,3,38,
1994  5,6,41,
1995  8,2,19,
1996  8,4,77,
1997  3,4,40,
1998  8,2,19,
1999  5,9,7,
2000  8,8,39,
2001  5,9,7,
2002  7,9,31,
2003  9,9,45,
2004  5,5,78,
2005  4,7,20,
2006  3,9,36,
2007  4,9,63,
2008  8,5,10,
2009  9,3,55,
2010  8,6,57,
2011  2,7,59,
2012  9,2,49,
2013  1,7,79,
2014  1,3,48,
2015  4,8,34,
2016  8,6,57,
2017  7,5,1,
2018  5,6,41,
2019  2,1,27,
2020  9,3,55,
2021  5,2,13,
2022  3,6,6,
2023  8,1,68,
2024  8,8,39,
2025  1,7,79,
2026  2,2,17,
2027  4,1,47,
2028  1,2,23,
2029  5,1,54,
2030  2,6,3,
2031  8,1,68,
2032  3,5,80,
2033  3,5,80,
2034  9,3,55,
2035  3,8,18,
2036  5,7,16,
2037  7,5,1,
2038  };
2039 
2040  const int *specs[] = {
2041  magicSquare5_filled10_1, //0
2042  magicSquare5_filled10_2, //1
2043  magicSquare5_filled10_3, //2
2044  magicSquare5_filled10_4, //3
2045  magicSquare5_filled10_5, //4
2046  magicSquare5_filled10_6, //5
2047  magicSquare5_filled10_7, //6
2048  magicSquare5_filled10_8, //7
2049  magicSquare5_filled10_9, //8
2050  magicSquare5_filled10_10, //9
2051  magicSquare5_filled10_11, //10
2052  magicSquare5_filled10_12, //11
2053  magicSquare5_filled10_13, //12
2054  magicSquare5_filled10_14, //13
2055  magicSquare5_filled10_15, //14
2056  magicSquare5_filled10_16, //15
2057  magicSquare5_filled10_17, //16
2058  magicSquare5_filled10_18, //17
2059  magicSquare5_filled10_19, //18
2060  magicSquare5_filled10_20, //19
2061  magicSquare5_filled11_3_1, //20
2062  magicSquare5_filled11_5_1, //21
2063  magicSquare5_filled11_5_2, //22
2064  magicSquare5_filled11_5_3, //23
2065  magicSquare5_filled12_10_1, //24
2066  magicSquare5_filled12_1_1, //25
2067  magicSquare5_filled12_1_2, //26
2068  magicSquare5_filled12_1_3, //27
2069  magicSquare5_filled12_2_1, //28
2070  magicSquare5_filled12_2_2, //29
2071  magicSquare5_filled12_2_3, //30
2072  magicSquare5_filled12_3_1, //31
2073  magicSquare5_filled12_3_2, //32
2074  magicSquare9_filled10_1, //33
2075  magicSquare9_filled10_2, //34
2076  magicSquare9_filled10_3, //35
2077  magicSquare9_filled10_4, //36
2078  magicSquare9_filled10_5, //37
2079  magicSquare9_filled10_6, //38
2080  magicSquare9_filled10_7, //39
2081  magicSquare9_filled10_8, //40
2082  magicSquare9_filled10_9, //41
2083  magicSquare9_filled10_10, //42
2084  magicSquare9_filled10_11, //43
2085  magicSquare9_filled10_12, //44
2086  magicSquare9_filled10_13, //45
2087  magicSquare9_filled10_14, //46
2088  magicSquare9_filled10_15, //47
2089  magicSquare9_filled10_16, //48
2090  magicSquare9_filled10_17, //49
2091  magicSquare9_filled10_18, //50
2092  magicSquare9_filled10_19, //51
2093  magicSquare9_filled10_20, //52
2094  magicSquare9_filled50_1, //53
2095  magicSquare9_filled50_2, //54
2096  magicSquare9_filled50_3, //55
2097  magicSquare9_filled50_4, //56
2098  magicSquare9_filled50_5, //57
2099  magicSquare9_filled50_6, //58
2100  magicSquare9_filled50_7, //59
2101  magicSquare9_filled50_8, //60
2102  magicSquare9_filled50_9, //61
2103  magicSquare9_filled50_10, //62
2104  magicSquare9_filled50_11, //63
2105  magicSquare9_filled50_12, //64
2106  magicSquare9_filled50_13, //65
2107  magicSquare9_filled50_14, //66
2108  magicSquare9_filled50_15, //67
2109  magicSquare9_filled50_16, //68
2110  magicSquare9_filled50_17, //69
2111  magicSquare9_filled50_18, //70
2112  magicSquare9_filled50_19, //71
2113  magicSquare9_filled50_20 //72
2114  };
2115 
2116  const unsigned n_examples = sizeof(specs)/sizeof(int*);
2118 
2119 }
2120 
2121 // STATISTICS: example-any
2122 
Post propagator for SetVar x
Definition: set.hh:767
virtual void print(std::ostream &os) const
Print solution.
Passing integer variables.
Definition: int.hh:656
unsigned int size(I &i)
Size of all ranges of range iterator i.
Slice< A > row(int r) const
Access row r.
Definition: matrix.hpp:177
Computation spaces.
Definition: core.hpp:1742
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.
Definition: branch.cpp:39
void iterations(unsigned int i)
Set default number of iterations.
Definition: options.hpp:461
Integer variable array.
Definition: int.hh:763
Gecode toplevel namespace
Options opt
The options.
Definition: test.cpp:97
MagicSquare(MagicSquare &s)
Constructor for cloning s.
Parametric base-class for scripts.
Definition: driver.hh:729
void branching(int v)
Set default branching value.
Definition: options.hpp:225
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
Definition: options.cpp:548
Matrix-interface for arrays.
Definition: minimodel.hh:2087
@ BRANCH_SIZE
Branch by size.
void linear(Home home, const FloatVarArgs &x, FloatRelType frt, FloatVal c)
Post propagator for .
Definition: linear.cpp:41
IntVarBranch INT_VAR_SIZE_MIN(BranchTbl tbl)
Select variable with smallest domain size.
Definition: var.hpp:206
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
Definition: rel.cpp:43
Slice< A > col(int c) const
Access column c.
Definition: matrix.hpp:183
void update(Space &home, VarImpVar< VarImp > &y)
Update this variable to be a clone of variable y.
Definition: var.hpp:116
@ IRT_EQ
Equality ( )
Definition: int.hh:926
void distinct(Home home, const IntVarArgs &x, IntPropLevel ipl)
Post propagator for for all .
Definition: distinct.cpp:46
IntValBranch INT_VAL_SPLIT_MIN(void)
Select values not greater than mean of smallest and largest value.
Definition: val.hpp:75
@ BRANCH_CBS_MAX_SD
Use maximum solution density.
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.
Definition: var.hpp:236
int main(int argc, char *argv[])
Main-function.
MagicSquare(const SizeOptions &opt)
Post constraints.
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:234
Gecode::IntArgs i({1, 2, 3, 4})
@ BRANCH_AFC_SIZE
Branch by size over AFC.
virtual Space * copy(void)
Copy during cloning.
Options for scripts with additional size parameter
Definition: driver.hh:675
Example: Magic squares