Assigning Classes

Dave Cross dave at
Tue Sep 10 09:29:05 BST 2013

Quoting Dave Cross <dave at>:

> I have offered to help a friend[1] solve what sounds like an  
> interesting problem.

[ snip ]

Thanks for all the suggestions.

It turned out that I only had two or three hours to do this, so I  
didn't have time to research any of the algorithms that you mentioned.  
So I took a very basic approach that got me close enough to a solution.

* Iterate across the list of students in random order
* For each student find their favourite course that still has places available
* Allocate the student to that course.
* Repeat to choose the second course.

This has many problems. It doesn't, for example, ensure that each  
course has students allocated to it.

But we had 387 students, leading to 774 course allocations. And my  
algorithm allocated 722 of those places, leaving the staff with about  
50 to allocate manually. Although it's not a complete solution, it's  
enough of an improvement on the old (manual) process that they are  
really happy.

I'll carry on working on the program to have it complete for next  
year's courses.



More information about the mailing list