Say that $\Pi_a$ and $\Pi_b$ are two permutations in your permutation space. If the function $f$ is not a black box, or if it is a black box which you are allowed to use as an oracle, find the value $f_a$ for $\Pi_a$ and $f_a$ for $\Pi_b$, or for a larger population of permutations. Take two or three of the highest scoring permutations based on the values of $\f(X,\Pi_j)$ f(X,\Pi_j)$and use a genetic algorithm to cross-over between these two permutations. Or take the single highest scoring permutation and then internally permute a short region of the permutation and recalculate$f$. Iterate as necessary. This presumes that$f$if smoothly continuous and that you can use a hill-climbing style of approach to find local maxima or local minima, whichever you need in your case. 1 Simulated annealing is a good answer, as given by Kjetil B Halvorsen. You can also try genetic algorithms to mix and cross-over multiple tries at different permutations. Say that$\Pi_a$and$\Pi_b$are two permutations in your permutation space. If the function$f$is not a black box, or if it is a black box which you are allowed to use as an oracle, find the value$f_a$for$\Pi_a$and$f_a$for$\Pi_b$, or for a larger population of permutations. Take two or three of the highest scoring permutations based on the values of$\f(X,\Pi_j)$and use a genetic algorithm to cross-over between these two permutations. Or take the single highest scoring permutation and then internally permute a short region of the permutation and recalculate$f$. Iterate as necessary. This presumes that$f\$ if smoothly continuous and that you can use a hill-climbing style of approach to find local maxima or local minima, whichever you need in your case.