I would like to obtain the optimized arrangement of integers. Let me give a simple example.
Suppose I have a sequence like 1,2,3,4,5
I would like to re-arrange it according to a given metric function.
Suppose in this case, the metric function is $g(x)$ where $g(x) = \min(|x_{i+1}-x_i|)$. So in our case, $g(x) = \min(\{2-1, 3-2, 4-3, 5-4\}) = 1$
if we have $x = \{2,5,3,1,4\}\implies g(x) = \min(\{|5-2|, |3-5|, |1-3|, |4-1|\}) = \min(\{3,2,2,3\})=2$
Now Suppose we want to re-arrage the vector such that we maximize this metric function, how can we formulate the problem? Is there a way to solve this without trying all permutations? In my problem, I have a vector of length n and a different metric function which is quite complicated than the one given above.
Let me know if more information is needed
EDIT:
We could think of the problem as $$\underset{x}{\arg\max} ~g(x)~~s.t.~ x_i\in \mathbb N, \mathbf{x} = \{1,...,N\}$$
Can this work? If so how can we proceed?