Reputation: 1712
we have about 1000 free seats for our lectures at our uni, and around 2000 seats demanded (maybe 500 students demanding 4 places each).
I'm developing a webapp with CakePHP, which lets students make a wishlist and enter 4 lectures per block, with priorities from 1 to 4. (This then goes into a MySQL-database)
Now, the web frontend is done, the admin actions (add lectures, add lecturers, etc) are done.. the only thing left is writing the distribution algorithm.
How should I best do this? A MySQL-script seems useful, but mysql is not very friendly when it comes to loops and if-constructs, is it?
Would it be smart to export the data somewhere and let another language handle the problem?
Edit: dnagirl requested more info about the algorithm:
We don't have business rules for the algorithm. We adapted an existing (very expensive) app from someone else at another university, which has rules we just adapted.
What he is doing (and what I am trying to clone, to save the big per-semester fee), is this:
I know this algorithm isn't the best solution, but I thought I'll just clone it for now, and maybe afterwards work on an improvement in the logic/possibilities.
Upvotes: 1
Views: 991
Reputation: 20721
You probably want some sort of genetic algorithm:
You'll have to run a few tests and tweak the scoring weights to get it right.
MySQL is not really very suitable for this; you better solve this in PHP and then persist in one go. If the performance isn't good enough, you might even consider implementing it in C++, but I suggest you try PHP first and see if it's fast enough. It's not like you're going to run this every 2 seconds.
Upvotes: 4