1

I am making a website for a side project at school where students enter the classes they need to take, what days they want or don't want classes, and when they cant have or don't want classes. The basics are there are classes, and each class has many sections at different times with different professors that a student can choose from. With the freshman level classes, there can be over 30 different sections for each class. I have the classes and sections in a mysql database and I have been coding in php.

So far I have it working but I want to make it faster. I have been reading about other scheduling problems but I am looking for specifics to what I am doing. This isn't making schedules from scratch. It is making schedules from what sections are available and ranking them based on what the students inputs. Currently for few possible sections, it runs fast. But when the possible schedules get to about 300,000, it takes around 30 seconds to compare and rank everything. I have been improving it by changing how schedules are generated but I want to faster. I switched from brute force generating to using a tree based method.

I'm not asking for homework help or for someone to do this for me. I just want to be pointed in the right direction with already existing problems and algorithms that I can learn about.

Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794
scottarver
  • 23
  • 4
  • have you analyzed your current algorithm for its time complexity? – Anurag Mar 11 '10 at 07:02
  • for 7 classes, 50,400 possible schedules, Total Time: 6.47082304955 seconds, seconds per schedule: 7788.80825733 seconds, Seconds per schedule: 0.000128389346221, Good schedules: 24,330.| for 8 classes, 201,600 possible schedules, Total Time: 18.2666659355 seconds, seconds per schedule: 11036.4967921 seconds, Seconds per schedule: 9.06084619817E-5, Good schedules: 59,024. |for 9 classes, 806,400 possible schedules, Total Time: 60.9230577946 seconds, seconds per schedule: 13236.3677923 seconds, Seconds per schedule: 7.55494268286E-5, Good schedules: 172,912 – scottarver Mar 11 '10 at 07:49
  • The way I have it make the schedules is it puts the first classes sections in nodes along level 0, then on level 1, it adds the next classes sections to each child node if there are no conflicts. and does that for each class. after it adds all the classes, the path all the way down is a good schedule. Doing it tree like reduced my times and number of compairs ggreatly from brute forcing it. – scottarver Mar 11 '10 at 07:55

3 Answers3

1

Remember the eight queens puzzle? I sure hope you do, if not, go and solve it first, then come back to your scheduling task.

You have already moved from brute force to a tree structure. Now it's time for branch and bound. Whatever you mean by "good schedules", 170000 is too much — you do not prune your tree enough. I do not think that there could be more than 20-50 really good schedules for each student, unless they take very few classes and are extremely flexible.

AVB
  • 3,994
  • 22
  • 21
1

Try metaheuristics such as tabu search or simulated annealing. Brute force and branch and bound don't scale up enough.

Take a look at my curriculum course example in drools planner, as defined by ITC2007. Its probably an advanced form of your use case (not counting gui/db).

Geoffrey De Smet
  • 26,223
  • 11
  • 73
  • 120
-1

Have a look at this. It may not be exactly what you want but you can get some design ideas.

Ravi Gupta
  • 4,468
  • 12
  • 54
  • 85