Is the an algorithm that would help solve this problem:
Teams are swapping members.
Each team has preferences for members it 'wants' from other teams.
Each member has preferences for the teams its 'wants' to join.
Overall matches can only go through (be accepted) if they are balanced. i.e. the number of people leaving a team has to equal the number arriving to the team.
It feels like a stable matching or a top trading cycle problem but I'm not sure how to set it up with the constraint that what goes into a team must come out for the matches to work.
Would be very grateful for any advice
Edit: Thank you, Aaron and Narek for helping me make the question clearer.
A valid solution would be pareto efficient and strategy proof. I did initially think of stable matching but I came to the conclusion that stable matching would lead to two few valid matches (once you put the one-in, on-out constraint).
Number of teams 10-15, each with between 2 and 10 members, each team is has five preferences of members in other teams, and each member can state 5 five preferences of teams it out join.