I have a real life problem that I want to solve using Python. I have a team of x=10 people (myself included) and during n-1=9 weeks we want to schedule a 1-on-1 call each week such that everyone gets a call with everyone and no pair of people talk twice during the 9 weeks.
This is my solution but it is flawed because, although everyone speaks with everyone, each person has two calls per week and I want just 1 call per week.
Any idea of how could I solve this?
#for shifting a list to the left with n positions
def rotate(l, n):
return l[n:] + l[:n]
def generate_1on1_meetings(members):
random.shuffle(members)
n = len(members)
for i in range(0, int(n / 2)):
print("WEEK " + str(i + 1) + "\n")
aux = rotate(members, i + 1)
for j in range(0, n):
print(members[j] + " - " + aux[j])
print("\n")
EDIT: So to make things more clear, there should be an even number (2k) of persons. In each week there will be k meetings, each person appearing just in one meeting, and in each week everyone will have participated in exactly one meeting. There need to be 2k-1 weeks to have all the meetings.
Example: so let's consider the case of 4 team members: [A, B, C, D]. A solution given my constraints would be:
Week 1:AB,CD
Week 2: AC, BD
Week 3: AD, BC
So each person had just one meeting per week, all of them appeared in just 1 meeting in each week and after the 4-1 weeks passed everyone had a meeting with everyone