I have an optimization task that involves choosing the ordering of some magnets. A solution is a list of N integers taken from a larger set of N+S integers where S=# of spares. Each number in the list occurs once and must be unique. For example, if N=3, S=0, then the possible choices are [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2] and [3,2,1]. For each choice there is a complex objective that depends on the ordering. For example, one part of the objective is to calculate a sum of sums then do a linear regression and calculate deviations from the line while imposing a constraint on the slope and offset. LIkewise, constraints are also complex, non-linear functions.
The actual problem involves about 200 magnets with 200 factorial combinations. The "optimum" will be one that is "good enough". Algorithms I have used in the past with other programming languages and environments are simulated annealing and genetic algorithm.
How would I set up this kind of permutation/combinatoric optimization in MatLab?