My university lists the rotation of courses each semester/year. Therefore, it is possible to predict when every class will be taught.
I am trying to create a JavaScript (language is irrelevant, really) program that will have the user select all the courses they would like to take, for how many semesters, and the max (or maybe exact) number of classes they'd like to take during each one of those semesters.
So, for instance, my university offers: 12 courses in Fall (varies between even and odd years) 10 courses in Spring (varies between even and odd years) 6 courses in Summer (varies between even and odd years) essentially, 6 different semester patterns
Basically, the user will choose their preferred 16 or so courses, enter 6 semesters, the semester they would like to start in, and the max number of courses per semester. From there, I would like to generate all the possible course maps the user could take in order to graduate in 6 semesters. I want them to be able to vary the number of courses in each semester--like 3 courses one semester, 2 courses in another, etc. I also want to check previous classes to make sure classes aren't duplicated, as well as ensure that the classes meet their respective pre-requisites.
My instincts say to go with recursion in order to do this, but I'm not exactly sure how I would go about it.
So far, I have only been able to come up with: generate all the sets per semester based on home many courses the user would like in that semester (if the user picks 3 courses for the first semester, then create all the sets of 3 out of the 12 courses). Do this for each semester. Then, loop through all these combinations to see which ones work. Seems very inefficient and slow to me.
As this is Programmers SE, I'm not really looking for any code, but maybe an algorithm or a more efficient approach to this problem. Any help would be greatly appreciated. I can post a link to my university's course rotation if that would help.
Timetable problem
, and in general you may need to enumerate all permutations exhaustively to be sure you've found all correct answers. There are many approaches to generate "good enough" answers more quickly, e.g. see a GA approach.