Back when I was enlisted, my sergeant had a bit of a conundrum. Troops were grumbling about being repeatedly assigned to the same posts, and we didn't have enough time during the shift to scramble the roster while ensuring adequate manning.
I wrote a simple Excel macro which randomly assigned security personnel to posts they held qualifications for. Since it didn't have any knowledge of personality conflicts or preferences of the troops getting assignments, the results generated by the Rosternator 3000 were generally hated by all involved.
In the end the tool was still useful - the mere threat of a randomized roster was enough to get everyone to quit grumbling.
How many personnel/posts were you assigning, out of curiosity? I've seen a similar problem, not automated yet, with around 20 staff members, who have varying conditionals which would have to be accounted for. It's not necessarily worth my time to automate for such a small # of people, then again it's a fun puzzle.
The current approach is a 2-month rotating schedule. Since there are day/evening/overnight shifts, with overnight being the least desirable and evening the most desirable, it was deemed most equitable to simply rotate members through different 2-month schedules. This way, everyone across the year will be doing the same sets/timings of shifts in different months. This becomes very important for evening shifts, in particular, since transitioning to/from that schedule requires time to overcome the jet-lag induced.
Roughly seventy personnel to about half as many posts. This was during the surge in Iraq, so half (or more) of our garrison was out in the sandbox at any given time anyway.
This was a shift-specific tool, so it only had to account for certifications (e.g. a Response Force Member wouldn't be put into a Controller/Dispatch position). From what I recall, the post listing itself was on one sheet with personnel/qualifications on another. Posts were iterated by priority, so critical manning positions were always appropriately staffed from the source roster.
I wonder if you could augment this further. Assign a scoring system for various conflicts and preferences. Start with the randomly assigned roster and swap random people as long as it improves the overall score.
The problem here is that these conflicts and preferences are constantly shifting. Two people can be good friends one week and decide they hate each others' guts the next week. And then they can go back to being friends again the week after. The Rosternator 3000 can't keep up with this so you're always going to be generating bad schedules for a certain portion of your people.
This is one of the reasons good retail managers ignore the advice of their time-keeping systems and give peoples' requests preference. The time-keeping system ignores all of the human aspects of the problem to focus on the least-important aspect of keeping a store running--making sure there are warm bodies in it.
>Two people can be good friends one week and decide they hate each others' guts the next week. And then they can go back to being friends again the week after.
So... you're saying soldiers are like girls in high school?
This thought did occur to me, but I didn't have the time to continue iteration past the first revision. Police blotters don't write themselves, as it turns out.
If I had to do it today, I'd probably put the list of pair scores on one sheet (e.g. Snuffy/Smith at +5, Smith/Jones at -3) and perform iterative swapping as you suggested.
Note that this is the "stable roommates problem" and does not necessarily have an "optimal" solution (where "optimal" means "no unmatched pair of people would've rather been matched together". Eg, if Albert prefers Bob over Charles, Bob prefers Charles over Albert, and Charles prefers Albert over Bob, and all three prefer being matched with the last person over anyone else).
I wrote a simple Excel macro which randomly assigned security personnel to posts they held qualifications for. Since it didn't have any knowledge of personality conflicts or preferences of the troops getting assignments, the results generated by the Rosternator 3000 were generally hated by all involved.
In the end the tool was still useful - the mere threat of a randomized roster was enough to get everyone to quit grumbling.