this repo has no description
1% RUNS ON mzn20_fd 2% RUNS ON mzn-fzn_fd 3% RUNS ON mzn20_mip 4% perfsq2.mzn 5% vim: ft=zinc ts=4 sw=4 et 6% 7% Perfect squares: find a square equal to the sum of smaller, distinct squares. 8 9int: n = 100; 10 11% x[k] = 1 iff k^2 is part of the sum. 12% 13array [1..n] of var 0..1: x; 14 15% t is the sum of the first n squares, the largest value our sum can have. 16% 17int: t = ((n * (n + 1) * (2 * n + 1)) div 6); 18 19% squares is the set of square numbers less than t. 20% 21set of int: squares = {i * i | i in 1..(n * n) where i * i <= t}; 22 23% k is the sum of the squares selected by the x[i]. 24% 25var squares: k = sum (i in 1..n) (i * i * x[i]); 26 27solve maximize(k); 28 29output [show(k), "\n"]; 30 31% output 32% [ show(k), " = sum of " 33% ] ++ 34% [ if fix(x[i]) = 1 then show(i * i) ++ " " else "" endif 35% | i in 1..n 36% ] ++ 37% [ "\n" 38% ];