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.