Let's us say you have a finite sequence of things. Some are identical, some distinct. For example:
Now, under what conditions can each permutation of a sequence be reached through swapping adjacent items, such that you begin and end on the same sequence. Also, when it does exist, what order do you do the swaps.
Note that for those with experience in graph theory, you could represent each distinct permutation with a point, and have an edge for each swap. Than the problem reduces to if there is an Hamiltonian cycle.
Note: Partial answers are fine. Like for example, if you know an algorithm for a specific case, say, when all items are unique, post it. Or if you know a specific case that is impossible, post your explanation.