I have a set $S=\{s_1,\ldots,s_k\}$ and would like to maximize a fixed expression over permutations of $S$: $\max f(x_1,\ldots,x_k)$ with $x_i\in S$ and $x_i=x_j\Rightarrow i=j$.
Is there a convenient way to do this? As an example, with $S=\{1,2,3,4\}$ I can write
Maximize[
{f[a,b,c,d],
a != b && a != c && a != d && b != c && b != d && c != d &&
0 < a < 5 && 0 < b < 5 && 0 < c < 5 && 0 < d < 5},
{a, b, c, d}, Integers]
but obvious this scales poorly.
You can assume $S\subset\mathbb{Z}$ if it helps. Most of the time I'm just using initial segments of the positive integers, as in my example.
kis small enough you can brute force it (Permutations). – Szabolcs Sep 11 '13 at 19:19fis linear then it can be done using integer linear programming, and Minimize will use this under the hood if it is properly set up. I'd go with an nxn matrix of variables, all in range [0,1], with row sums constrained to = 1, col sums <= 1, and a 1 in row i, col j meaning the ith variable is the jth set element. Now writef[vars]to reflect that. – Daniel Lichtblau Sep 11 '13 at 23:52fis linear in any given variable, but of degree $n$ overall. – Charles Sep 13 '13 at 21:23