Speed dating algorithm

后端 未结 9 725
深忆病人
深忆病人 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: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.

提交回复
热议问题