Okay,
I have a list of angles, call it A. How would I arrange them in a 2D m-by-n grid G such that the distances between each adjacent angle-element (row- and column-wise) is minimized?
G has as many elements as A, or more. I get to pick m and n. Duplicating elements from A is allowed, but every element from A must be used at least once.
Toy Example 1:
A = {0, 10, 10, 20, 20, 20, 20, 30, 30}
Put them in a 3x3 array:
G = {
{0, 10, 20},
{10. 20, 30},
{20, 30, 20}
}
Toy Example 2 (list of 5 angles, put them in a 3x2 grid, so have to duplicate 1 element):
A = {0, 350, 10, 20, 30}
G = {
{0, 10, 20},
{350, 0, 30}
}
Hopefully that was clear enough? Let me know if it wasn't....