I have a problem I'd like to solve and am not sure whether there is a known algorithm or how the best way to approach it would be.
Say for example there is a class of 30 students who are going on a school camp. They will each share a room with other students. Each student can provide a list of 3 friends that they ideally want to share a room with.
I'd like to know if there is a programmatic way to determine the best outcome for keeping students together with who they requested to go with?
There is also another complication here, being that there are x amount of rooms, each room allowing a varying amount of students per room (up to 7).