Edit: Before you begin, please note that a move refers to swapping a pair of letters (thanks to ferfer93)
Ok, so I understand the title is a bit ambiguous, so I'll clarify it further below:
Let us take two objects only, A and B, that are repeated to make a, I don't know what to call it, a set, say. This 'set' would look like, for example, AABABAAB, that is, a permutation of 5 As and 3 Bs.
Now, it is intuitive that to generate another permutation with the same number of As and Bs, you need not move all letters about... there is indeed the smallest number of moves that will have to be made to produce something like (I'm not trying to be creative here) AAABBAAB. Obviously, the smallest move that should be done to make AABABAAB into AAABBAAB is just one (move the first B ahead of the third A).
I've been thinking that it might be possible to arrive at a solution if the permutations were lexicographically ordered, the following is a list of them excluding repetitions (56);
AAAAABBB AAAABABB AAAABBAB AAAABBBA AAABAABB AAABABAB AAABABBA AAABBAAB AAABBABA AAABBBAA AABAAABB AABAABAB AABAABBA AABABAAB AABABABA AABABBAA AABBAAAB AABBAABA AABBABAA AABBBAAA ABAAAABB ABAAABAB ABAAABBA ABAABAAB ABAABABA ABAABBAA ABABAAAB ABABAABA ABABABAA ABABBAAA ABBAAAAB ABBAAABA ABBAABAA ABBABAAA ABBBAAAA BAAAAABB BAAAABAB BAAAABBA BAAABAAB BAAABABA BAAABBAA BAABAAAB BAABAABA BAABABAA BAABBAAA BABAAAAB BABAAABA BABAABAA BABABAAA BABBAAAA BBAAAAAB BBAAAABA BBAAABAA BBAABAAA BBABAAAA BBBAAAAA
So... AABABAAB is the 14th permutation by alphabetical order, and AAABBAAB is the 9th. So the questions are;
A. What is the least amount of moves (which obviously cannot be greater than the total number of As and Bs in the 'set') that have to be made to convert the $n$th permutation to the $m$th, given a 'set' of only $x$ As and $y$ Bs? Do note that all As and all Bs are similar, so all AABBABAAs are the same AABBABAA.
B. How would you know which As and which Bs to move? Probably an alphabetically ordered permutation list (excluding repetitions) would help...? (because I suppose this is a sorting problem)
C. And a final question... under which values for $n$ and $m$ would the solution to A be greatest?
And oh, I forgot - thanks!
You're being a little ambigous with some things, specially with the word "move". I guess you mean move is swaping a pair of letters. If that's it, then as you list of permutations all have the same numbers of As and Bs, and you only have two kind of symbols, the minimum amount of moves consist of swaping every pair of As and Bs that are not in place, that is the minimum amount of moves is $n/2$, where $n$ is the number of symbols (As or Bs) that are not in place.