Speed dating algorithm

后端 未结 9 606
深忆病人
深忆病人 2021-02-04 10:19

I work in a consulting organization and am most of the time at customer locations. Because of that I rarely meet my colleagues. To get to know each other better we are going to

相关标签:
9条回答
  • 2021-02-04 10:44

    Perfect Table Plan

    0 讨论(0)
  • 2021-02-04 10:45

    This sounds like an application for genetic algorithm:

    1. Select a random permutation of the 40 guests - this is one seating arrangement
    2. Repeat the random permutation N time (n is how many times you are to switch seats in the night)
    3. Combine the permutations together - this is the chromosome for one organism
    4. Repeat for how ever many organisms you want to breed in one generation
    5. The fitness score is the number of people each person got to see in one night (or alternatively - the inverse of the number of people they did not see)
    6. Breed, mutate and introduce new organisms using the normal method and repeat until you get a satisfactory answer

    You can add in any other factors you like into the fitness, such as male/female ratio and so on without greatly changing the underlying method.

    0 讨论(0)
  • 2021-02-04 10:52

    heres an idea
    first work from the perspective of the first person .. lets call him X
    X has to meet all the other people in the room, so we should divide the remaining people into n groups ( where n = #_of_people/capacity_per_table ) and make him sit with one of these groups per iteration
    Now that X has been taken care of, we will consider the next person Y
    WLOG Y be a person X had to sit with in the first iteration itself.. so we already know Y's table group for that time-frame.. we should then divide the remaining people into groups such that each group sits with Y for every consecutive iteration.. and for each iteration X's group and Y's group have no person in common
    .. I guess, if you keep doing something like this, you will get an optimal solution (if one exists)

    Alternatively you could crowd source the problem by giving each person a card where they could write down the names of all the people they got dine with.. and at the end of event, present some kind of prize to the person with the most names in their card

    0 讨论(0)
提交回复
热议问题