Here's a similar project with source code in C++ [url removed, login to view]
I think it will be easier, if you use an existing library for GA. e.g. JGAP. I am open to other suggestions.
Coding style: Use comments in order to make it easier for me to understand the code.
Note: I've opened a duplicate of this project with Ruby (my preference) instead of Java. I will only initiate the project with the most promising bidding.
In order to solve the course timetable problem for a university department, we have to allocate its classes in a number of slots. Each slot represents a specific point in time & space (hour and classroom). Number of slots is days*hours*rooms. E.g. 5 days, 12 hours per day, 30 rooms => 1800 slots. My suggestion (not requirement) is that the Genotype/Chromosome should be represented either as a '1 dimension array' or as a '3 dimension array'.
CourseClass holds a reference to the course to which the class belongs, a reference to the professor who teaches. It also stores how many seats (number of students expected to attend) are needed in the classroom, if the class requires computers in the classroom, and the duration of the class in hours (optional).
Note: In my description of the problem there is no need to reference student groups. Also, whenever I mention 'class' I refer to 'CourseClass'.
- A class can be placed only in a spare classroom.
- No professor can have more then one class at a time.
- A classroom must have enough seats to accommodate all students.
- To place a class in a classroom, the classroom must meet the requirements of that class e.g. have laboratory equipment, such as computers.
ATTENTION: It's not absolutely necessary, for this project, to implement all the stuff below this point. Of course we'll agree beforehand, what exactly you are going to work on. (I actually am not sure whether all these stuff are hard/time consuming/expensive or easy)
Have the ability:
- To assign a different number of hours for every class e.g. 1,2 or 3 (hard constrain).
- To associate/allocate pairs of classes/slots (permanently == read only) before running the GA.
- To exclude certain slots altogether. These will be used for classes of the other university departments.
Soft requirements (can be broken, but the schedule is still feasible):
- The personal preferences (for certain slots) by each professor.
- My desire to have certain classes close with one another (or the opposite).
- It's better that every professor teaches for no more or less than e.g. 4 hours per day.
- The fewer gaps (empty hours) between classes the better.
The app should take into account these soft constrains, try to enforce them, and use them, along with the hard constrains, to determine the fitness of any given Genotype/Chromosome. I think one way to implement the constrains, is to keep, for every CourseClass, its own reference to the slots it is allowed to associate with. This reference should be sorted by preference and have the ability to change with every new generation of the population.
- Have the ability to use the final product in order to test different strategies in GA, and generate reports comparing them. Different strategies == different configurations: try every possible combination of supplied, applicable Genetic Operators (Selection, Mutation, Crossover) and test different values (e.g. mutation rate).
One way to do it, is to provide for me, a separate, executable file for each different configuration you have prepared. Another way is to allow me to change the configuration during runtime.
- Using the console & text files for input & output it's ok, 100% acceptable. I wouldn't mind having a simple GUI but it's a low priority that I can do without.
If you mention a comment or question about the project, I'll know you took the time to read the description. Thank you!