The code below can give you an idea of how to approach the problem. One solution (which will be a university timetable) consists of an array of separate rooms. These single rooms have a 2-dimensional array, where the columns are days and the rows are hours. I set CLOCK to 16, as I think there will be no classes at night. Thus, Hour Row 1 will be the first hour of the day ... perhaps from 7 to 8 hours. Array values indicate which class is reserved.
public class SingleRoom { static final int DAYS = 7; static final int HOURS = 16; . . . private int[][] timetable = new int[DAYS][HOURS]; //0 would say room is not booked, >0 indicates the booked class (english advanced (12), object oriented programming (139), etc..) } public class Solution { static final int AVAILABLE_ROOMS = 26; . . . private SingleRoom[] university_timetable = new SingleRoom[AVAILABLE_ROOMS]; }
mutations:
change class mutation - change the class to another random class or to zero = no reservation
turn on / off the class - if an hour is a day in a certain room, book it off if it is not booked, turn it on using a random class, this means that the algorithm makes it possible not to record the clock, since in the mutation of the class change 0 has a low probability of choice
restrictions: after creating your decisions, check all restrictions and keep the right decisions. New existing solutions should be included in your population (s) if they are better suited to other solutions already in your population or if they increase the diversity of your population.
But the document you talked about is pretty well described on how to implement GA for this problem (starts on page 16).
I wrote a general java framework for the mPOEMS multi-purpose optimization algorithm (multi-threaded prototype optimization with advanced improvement steps), which is a GA using evolutionary concepts.
Here you can find the code, this can give you an idea of how to approach your problem:
The solutions that you can find using this algorithm were compared in scientific work with the most advanced SPEA-2 and NSGA algorithms, and it was proved that the algorithm works comparable or even better, depending on the indicators that you take to measure performance.
Here you can find.
Additional resources: My thesis that applies this structure to the problem of choosing a project is: http://www.ub.tuwien.ac.at/dipl/2008/AC05038968.pdf
Structure documentation: http://thomaskremmel.com/mpoems/mpoems_in_java_documentation.pdf
mPOEMS presentation document: http://portal.acm.org/citation.cfm?id=1792634.1792653
In fact, with little enthusiasm, you can easily adapt the general structure code to your needs.
Do you write this GA in your work or as a student?