Antisymmetric Table Puzzle where the Rows/Columns Sum to Zero

485 Views Asked by At

I've encountered a problem that seems very simple, but turned out to just be frustrating, and now I seek math experts to help me. I've got a square table with Light Blue, White, Red and Green blocks.

Magic Table Puzzle - Empty

The Light Blue blocks cuts the table in two equal parts diagonally from the top left to bottom right. The bottom left half of the table is a mirror image of the top right, but the Red/Green boxes are inverted / opposites.

Rules of the puzzle:

  1. Only whole numbers allowed and you can only put numbers in red and green blocks.
  2. Red blocks must contain negative numbers
  3. Green blocks must contain positive numbers
  4. All the white blocks and light blue blocks count as 0 and this is not allowed to change
  5. Boxes that are mirror opposites must add up to 0

Aim of the puzzle:

In the end all the columns must add up to 0 and all the rows must add up to to 0

I would appreciate solutions to this puzzle, but what I really would like is if some math expert out there could give me the smallest whole number solution.

What I mean is: If I have two solutions, and I add up the numbers in all the green blocks for both of them, then the solution with the lower sum would be "smaller".

Even better would be if someone could explain to me how to find the smallest whole number solution for other tables, with different red/green configurations or different sizes, that work in the same way.

I would like to find a general optimal solution, if such a solution actually exists in reality.

Here's an attempted solution:

Magic Table Puzzle - Try

Here are solutions I've found so far:

Solution 1:

Magic Table Puzzle - Solution 1

Solution 2:

Magic Table Puzzle - Solution 2

Any help would be appreciated.

3

There are 3 best solutions below

9
On BEST ANSWER

This can be formulated as an Integer Programming or Constraint Programming problem. Let $x_{ij} \in \mathbb{Z}$ be the value of cell $(i,j)$, then

$$\begin{align} &x_{i,j} = 0 && \text{white and blue cells}\\ &x_{i,j} \ge 1 && \text{green cells}\\ &x_{i,j} \le -1 && \text{red cells}\\ &x_{i,j}= -x_{j,i} && \forall i<j\\ &\sum_i x_{i,j} = 0 &&\forall j\\ &\sum_j x_{i,j} = 0 &&\forall i\\ \end{align}$$

These are all linear constraints. (The model can be reformulated by skipping all white/blue cells: that would make the problem smaller).

I tried your problem, and if I made no errors transcribing the data, the problem does not have a feasible solution. (Well, I made some errors. See below for updated results).

Update

After fixing my input data, and adding the objective: $$\min \sum_{(i,j) \in Green} x_{i,j}$$ I get:

enter image description here

The total value of the green cells is 87 (this is the optimal value: no better solution exists). This solution was found in 0.28 seconds.

0
On

After tedious trial and error I found two solutions:

Solution 1:

Magic Table Puzzle - Solution 1

Solution 2:

Magic Table Puzzle - Solution 2

Solution 1 is better because when I add up all the green block values; I get 520; which is lower than Solution 2's 565.

What's really interesting is the lowest number used in Solution 1 is 2 and the lowest number used in Solution 2 is 1, but Solution 1 is a "smaller" solution.

So either Solution 1 is the "smallest" / optimal solution (which I doubt greatly) or there is a "smaller" solution out there.

I would really appreciate any help / feedback.

0
On

I've now written software that can find solutions to these types of problems. It has led me to find this solution:

enter image description here

The highest integer this solution uses is 5