I'm looking at optimizing class selection for the school I go to. We have a rank-by-preference system, because it's a relatively small school and classes need to be able to stay balanced. Here's my attempt at formalizing it:

There are c classes, and s students.

Each student has a tuple of n class selections, ranked in order of preference. Each student will only get into one class.

I'm trying to find / create and implement an algorithm to optimize the classes, so that each student gets into their highest choice possible. The problem is that there's a lot of material to sift through. So far I've done some basic research into mathematical programming, operations research, and combinatorics- they're all huge, complex fields, and I'm not sure where to look to find the information I need.

Any pointers? I don't want solutions, just a direction to go in. I'll post my eventual answer when I find it.

Edit: formatting