Please help define my problem (matching entries of 2 data sets with corresponding values?)

#1
Hello everyone,

For my job, I am trying to match up 900 students (Group A) with 250 teachers (Group B).
I want to find an optimal matching so that students get a teacher who is (1) relevant to their needs and (2) works in their schedule

Group A can express up to 3 values from a list of 8, ranked in order of preference.
Group B can express up to all 8 values, unranked.
Group B has either 4 or 8 time slots available to match Group A.


How do I go about arranging the data? Is there a specific function I can use to match everyone up?

I will then perform a mail merge on the matched up data so every respondent receives an email informing them who they are matched to...I'll worry about that next!
 
#2
reminds me of 'halls marriage theorem' a bit. that is, how do you know that the required matching exists in the first place? halls theorem gives a condition, i can't recall recall though. Its too the effect of every subset of students must have a set of teachers that fit their needs equal to the number of students.