Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (*48 variables*)
- Clear[a1, b1, c1, d1, e1, f1, g1, h1, a2, b2, c2, d2, e2, f2, g2, h2,
- a3, b3, c3, d3, e3, f3, g3, h3, a4, b4, c4, d4, e4, f4, g4, h4, a5,
- b5, c5, d5, e5, f5, g5, h5, a6, b6, c6, d6, e6, f6, g6, h6];
- a1 = 27;
- b1 = -18;
- c1 = 1;
- d1 = 4;
- e1 = 23;
- f1 = 26;
- g1 = 13;
- h1 = 32;
- a2 = 19;
- b2 = 22;
- c2 = 41;
- d2 = 44;
- e2 = 31;
- f2 = 18;
- g2 = 37;
- h2 = 24;
- a3 = 27;
- b3 = 46;
- c3 = 33;
- d3 = 36;
- e3 = 23;
- f3 = -6;
- g3 = -3;
- h3 = 16;
- a4 = 19;
- b4 = 38;
- c4 = 41;
- d4 = 12;
- e4 = -1;
- f4 = 2;
- g4 = -11;
- h4 = 8;
- a5 = 11;
- b5 = -2;
- c5 = 17;
- d5 = 4;
- e5 = -9;
- f5 = -6;
- g5 = 13;
- h5 = 16;
- a6 = 3;
- b6 = 22;
- c6 = 9;
- d6 = 12;
- e6 = 31;
- f6 = 34;
- g6 = 53;
- h6 = 8;
- (*
- sol={a1,b1,c1,d1,e1,f1,g1,h1,a2,b2,c2,d2,e2,f2,g2,h2,a3,b3,c3,d3,e3,\
- f3,g3,h3,a4,b4,c4,d4,e4,f4,g4,h4,a5,b5,c5,d5,e5,f5,g5,h5,a6,b6,c6,d6,\
- e6,f6,g6,h6}/.Solve[{
- *)
- Max[{a1, b1, c1, d1, e1, f1, g1, h1, a2, b2, c2, d2, e2, f2, g2, h2,
- a3, b3, c3, d3, e3, f3, g3, h3, a4, b4, c4, d4, e4, f4, g4, h4, a5,
- b5, c5, d5, e5, f5, g5, h5, a6, b6, c6, d6, e6, f6, g6, h6}] == 53
- Min[{a1, b1, c1, d1, e1, f1, g1, h1, a2, b2, c2, d2, e2, f2, g2, h2,
- a3, b3, c3, d3, e3, f3, g3, h3, a4, b4, c4, d4, e4, f4, g4, h4, a5,
- b5, c5, d5, e5, f5, g5, h5, a6, b6, c6, d6, e6, f6, g6, h6}] == -18
- h6 == 8(*last value hard coded constraint*)
- g6 == 53(*penultimate value hard coded constraint*)
- g6 > 0 (*penultimate value > 0*)
- Total[{a1, b1, c1, d1, e1, f1, g1, h1, a2, b2, c2, d2, e2, f2, g2, h2,
- a3, b3, c3, d3, e3, f3, g3, h3, a4, b4, c4, d4, e4, f4, g4, h4,
- a5, b5, c5, d5, e5, f5, g5, h5, a6, b6, c6, d6, e6, f6, g6, h6} -
- Sort[{a1, b1, c1, d1, e1, f1, g1, h1, a2, b2, c2, d2, e2, f2, g2,
- h2, a3, b3, c3, d3, e3, f3, g3, h3, a4, b4, c4, d4, e4, f4, g4,
- h4, a5, b5, c5, d5, e5, f5, g5, h5, a6, b6, c6, d6, e6, f6, g6,
- h6}]] == 0
- Abs[Total[{a1, b1, c1, d1, e1, f1, g1, h1, a2, b2, c2, d2, e2, f2, g2,
- h2, a3, b3, c3, d3, e3, f3, g3, h3, a4, b4, c4, d4, e4, f4, g4,
- h4, a5, b5, c5, d5, e5, f5, g5, h5, a6, b6, c6, d6, e6, f6, g6,
- h6}] - Sort[{a1, b1, c1, d1, e1, f1, g1, h1, a2, b2, c2, d2, e2,
- f2, g2, h2, a3, b3, c3, d3, e3, f3, g3, h3, a4, b4, c4, d4, e4,
- f4, g4, h4, a5, b5, c5, d5, e5, f5, g5, h5, a6, b6, c6, d6, e6,
- f6, g6, h6}]] == 16*12
- a1 + h6 == 35
- b1 + g6 == 35
- c1 + f6 == 35
- d1 + e6 == 35
- e1 + d6 == 35
- f1 + c6 == 35
- g1 + b6 == 35
- h1 + a6 == 35
- a2 + h5 == 35
- b2 + g5 == 35
- c2 + f5 == 35
- d2 + e5 == 35
- e2 + d5 == 35
- f2 + c5 == 35
- g2 + b5 == 35
- h2 + a5 == 35
- a3 + h4 == 35
- b3 + g4 == 35
- c3 + f4 == 35
- d3 + e4 == 35
- e3 + d4 == 35
- f3 + c4 == 35
- g3 + b4 == 35
- h3 + a4 == 35
- a1 + b1 + c1 + d1 + e1 + f1 + g1 + h1 + a2 + b2 + c2 + d2 + e2 + f2 +
- g2 + h2 + a3 + b3 + c3 + d3 + e3 + f3 + g3 + h3 + a4 + b4 + c4 +
- d4 + e4 + f4 + g4 + h4 + a5 + b5 + c5 + d5 + e5 + f5 + g5 + h5 +
- a6 + b6 + c6 + d6 + e6 + f6 + g6 + h6 == 840
- a1 - b1 == g6 - h6
- b1 - c1 == f6 - g6
- c1 - d1 == e6 - f6
- d1 - e1 == d6 - e6
- e1 - f1 == c6 - d6
- f1 - g1 == b6 - c6
- g1 - h1 == a6 - b6
- h1 - a2 == h5 - a6
- a2 - b2 == g5 - h5
- b2 - c2 == f5 - g5
- c2 - d2 == e5 - f5
- d2 - e2 == d5 - e5
- e2 - f2 == c5 - d5
- f2 - g2 == b5 - c5
- g2 - h2 == a5 - b5
- h2 - a3 == h4 - a5
- a3 - b3 == g4 - h4
- b3 - c3 == f4 - g4
- c3 - d3 == e4 - f4
- d3 - e3 == d4 - e4
- e3 - f3 == c4 - d4
- f3 - g3 == b4 - c4
- g3 - h3 == a4 - b4
- (*h3-a4\[Equal]h3-a4,*)
- h3 - a4 ==
- f3 - g3 (*two additional middle value formulas, also valid for 8, \
- 480, 5760 and larger rows maybe*)
- h3 - a4 == b4 - c4
- a1 - b1 + b1 - c1 + c1 - d1 + d1 - e1 + e1 - f1 + f1 - g1 + g1 - h1 +
- h1 - a2 + a2 - b2 + b2 - c2 + c2 - d2 + d2 - e2 + e2 - f2 + f2 -
- g2 + g2 - h2 + h2 - a3 + a3 - b3 + b3 - c3 + c3 - d3 + d3 - e3 +
- e3 - f3 + f3 - g3 + g3 - h3 + g6 - h6 + f6 - g6 + e6 - f6 + d6 -
- e6 + c6 - d6 + b6 - c6 + a6 - b6 + h5 - a6 + g5 - h5 + f5 - g5 +
- e5 - f5 + d5 - e5 + c5 - d5 + b5 - c5 + a5 - b5 + h4 - a5 + g4 -
- h4 + f4 - g4 + e4 - f4 + d4 - e4 + c4 - d4 + b4 - c4 + a4 -
- b4 == 19 (*maybe missed some values, this is 22 but I think should \
- be 19*)
- (*-19 is min value of nx1 - nx2, also works for 8, 48, 480 and 5760 \
- (ie +-617 for 5760) and maybe larger rows*)
- (*
- },
- {a1,b1,c1,d1,e1,f1,g1,h1,a2,b2,c2,d2,e2,f2,g2,h2,a3,b3,c3,d3,e3,f3,g3,\
- h3,a4,b4,c4,d4,e4,f4,g4,h4,a5,b5,c5,d5,e5,f5,g5,h5,a6,b6,c6,d6,e6,f6,\
- g6,h6},Integers]
- *)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement