Generating an m X n array with 0/1 that meets certain conditions in R -
i'm working on problem on surface seems easy i've been unable find key solving it. think harnessing power of r it's relatively trivial.
the basic premise this. have 32 people @ networking event. there 4 tables seat 8 people @ time. @ event there 4 rounds people meet each other. idea come seating arrangement across rounds makes every person meets max number of unique people across rounds possible.
so have 16 (table*round: t1r1, t1r2,...etc.)) column x 32 (number of people) row array of 0/1 (0 = not seated @ table/round, 1 = seated @ table/round). , array has meet following conditions:
- people can have 4 rounds rowsums should 4.
- each table/round combo can fit 8 people hence colsums should 8
- each person can @ 1 table once rowsum of table columns has 1 (t1r1 + t1r2 +t1r3 + t1r4 = 1)
- each person can @ 1 per round rowsum of round columns has 1 (t1r1 + t2r1 + t3r1 +t4r1 = 1)
i'm sure there's mathematical solution, thinking might quicker brute force in r generating matrices , saving meet these conditions. best way? i'm open other suggestions.
Comments
Post a Comment