I am looking for a formula or program to help place people in classes based on their preferences.

The elements of the problem are:

There are 30 class choices a student can pick from.

There are 400 students that are asked to rank their top ten class preferences.

Each class (specialty subject, but a class by year or age, i.e. 2nd grade, 3rd grade) has a maximum number of 20 available seats.

Students then get placed into six of the classes based on their selections. Our goal is place as many students in as many of their top choices as possible.

Secondarily those 400 students could be broken down by grade as well and our secondary goal may be to also have as many students from the same grade in each class. But this secondary goal is less important.

Looking for any help to solve this problem.

  • $\begingroup$ Since your goal only relates to the number of students who receive their top choice, it seems it only matters what each student ranks as their first preference, and their preferences #2,#3,#4,#5 don't matter. Is that correct? Have you correctly stated the objective function you are trying to maximize? If yes, I suggest removing any mention of "top five" and instead indicate that each student indicates their top choice. If not, can you please edit the question to state the problem more clearly and precisely? $\endgroup$
    – D.W.
    Commented Mar 26, 2023 at 19:09
  • $\begingroup$ Apologies. Yes, I will rephrase the question. Kids get placed into six classes and they rank their top 10 preferred selections. Thanks for asking. $\endgroup$
    – Nick B.
    Commented Mar 27, 2023 at 20:14
  • $\begingroup$ "as many of their top choices as possible" - Can you state more precisely the objective function you are trying to optimize? I find this vague/unclear. $\endgroup$
    – D.W.
    Commented Mar 27, 2023 at 21:13
  • $\begingroup$ This seems impossible, you're trying to put 400 students into 6 classes each (2400 positions) but you have 30 classes each with 20 seats (600 positions). You can't program your way out of this one, as written. $\endgroup$
    – Turksarama
    Commented Mar 30, 2023 at 4:08


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.