0

I have a data similar to,

df = pd.DataFrame({'users': ['John', 'Bob', 'Alice', 'John', 'Alice','Bob','Alice','John', 'Bob', 'Alice'], 
                   'class': ['Economics','Economics','Economics','Maths','Maths','Physics','Physics','CS','CS','CS'],
                   'rank':[2,1,3,1,2,2,1,3,1,2],
                  'total_students':[10,10,10,20,20,12,12,30,30,30]})

Unique users will be assigned to a class by meeting below requirements,

  • John should teach 10% - 30% of total students
  • Bob - min 10% of total students
  • Alice - max 10% of total students

I have to find the optimal combination to assign user to a class which can be measured by min (total rank * total students)

I have tried few things but requires manual intervention as and when the % changes, Is there an algorithm to find optimal combination?

  • Looks like there are two constraints, class size and the total rank. Have you taken a look at this? https://stackoverflow.com/questions/17012528/how-do-you-find-the-optimal-assignment-of-pupils-in-classes. Not exactly the same question, but its close. – dyao Jul 14 '21 at 05:18
  • @dyao Thanks for the link, it really helped to narrow down my search. – hidden-layer Jul 14 '21 at 11:07

0 Answers0