Chapter 5 Genetic algorithms and the School Timetabling Problem
5.2 Genetic algorithms with other techniques
The lessons for some classes should end as early as possible on particular days.
Each teacher should teach a set number of lessons in a day within a specified range.
Teacher day and period preferences should be met.
A class should only be taught a specific subject once in a day.
Information regarding representation, timetable creation and selection method used was not provided. Mutation was the only genetic operator and involved making a number of moves (swaps). Mutation incorporated both hill climbing and a tabu list. Hill climbing ensured that moves did not result in an increase in the constraint cost of the timetable. The tabu list stored moves that would result in a return to a previous candidate solution. The genetic algorithm was applied to the HDTT benchmark problem [ABRA91a] and real world primary and secondary school timetabling problems. The algorithm was only able to find solutions to some of the data sets in the benchmark problem but did find feasible timetables for the real world problems. The use of a tabu search was identified as an important factor in improving the performance of the mutation operator.
Cerdeira-Pena et al. [CERD08] implemented a hill climbing approach, a genetic algorithm and two hybrid algorithms to solve the school timetabling problem.
The hard constraints for the problem are:
No teacher clashes or class clashes.
Co-teaching and subclass requirements must be met.
Teacher availability requirements must be met.
Double period requirements must be met.
The soft constraints for this problem are:
Maximum daily teaching limits for teachers should not be exceeded.
Each teacher should have his/her lessons evenly distributed throughout the week.
Teacher timetables should be compact.
Subjects should be evenly distributed throughout the week.
Teacher preferences should be met.
Each timetable was represented as a two-dimensional matrix with the rows of the table representing periods while each column represented a teacher. A cell of the matrix indicated
the class and subject. The cost of a timetable was determined by counting the number of constraint violations. The initial population consisted of previous solutions and randomly generated timetables.
The hill climbing approach (called RNA) explored the search space using double moves (a single swap and an optional second swap if a constraint violation occurs from the first swap).
This process continued until no further improvements could be made to the timetable after a specified number of moves.
Two genetic algorithms were implemented with the algorithms differing only in the selection method used. In the first selection method (GAT), two parents are chosen, each from two pairs of randomly selected individuals. The second selection method (GAT4C) differs from the first in that four parents (rather than two) are selected and selection is without replacement. Genetic operators used were one point crossover and a mutation operator that made random swaps.
The final two approaches combined the hill climbing (RNA) algorithm with each of the genetic algorithms. The hybrid approach alternated the genetic algorithm and the RNA approach with the genetic algorithm applied first. The RNA approach was applied to each individual in the population and produced the offspring for a new generation. The alternation between the RNA approach and the genetic algorithm continued until a generation limit was reached.
The algorithms were applied to three sets of school data. The first school had six co- teaching and subclass groups, 70 classes and approximately 16 teachers. The best performing algorithm was the hybrid algorithm using the GAT4C selection method. The second problem contained 27 co-teaching and subclass groups, 333 classes and 71 teachers and best results were found with the hybrid algorithm using the GAT selection method. The third problem involved a Spanish high school with 11 teachers and 33 classes.
The hybrid algorithm using the GAT4C selection method produced the best results. The authors concluded that, overall, the best performing algorithms were the hybrid approaches.
Rahoual and Saad [RAHO06] solved the school timetabling problem by hybridizing a genetic algorithm and tabu search. The hard constraints are:
No class clashes or teacher clashes.
Certain subjects must be allocated to specific periods.
The only soft constraint for the problem is that teacher preferences should be met. Each timetable was represented as an array, with the array index indicating the tuple number.
Each tuple in the array is allocated to a period and a teacher. Timetables were created by allocating tuples to randomly chosen periods but no details were provided as to how the tuples were selected. The fitness of a timetable was determined by calculating the weighted sum of the constraint violations. A steady-state control model was used. Crossover and three mutation operators were used to create offspring. Each mutation operator focused on a particular constraint and incorporated both hill climbing (swapping of tuples was only accepted if the constraint cost was reduced) and a tabu list (to prevent cycling in terms of performing the same swap and returning to previous solutions).
The approach was tested on benchmark data sets provided by Abramson [ABRA91a] and the performance was found to be equivalent to that of the simulated annealing technique and the tabu search used by Abramson [ABRA93]. The approach was also tested using four generated data sets. The first set had 64 subjects, 12 teachers and 16 venues. The second set involved 100 subjects, 21 teachers and 25 venues. The third data set involved 150 subjects, 26 teachers and 31 venues. Data set four had 200 subjects, 33 teachers and 37 venues. The performance of the genetic algorithm using the constraint focused mutation operators performed better when compared to a genetic algorithm using a standard mutation operator that randomly swaps tuples. The hybrid algorithm found good results and the authors found that the tabu search minimized the possibility of premature convergence. This approach was also tested against a real world case study involving 500 groups, 3000 teachers, 5000 subjects and 200 venues. The manual creation of a timetable for this problem took approximately four weeks. In comparison to the manual approach, the genetic algorithm approach solved the problem in less than an hour.
The authors concluded that the hybrid algorithm provided great flexibility and efficiency. A contributing factor towards the success of the algorithm was the use of three separate mutation operators that were each dedicated to reducing the cost of one specific constraint.
Another key contributing factor was the use of the tabu search incorporated with the mutation operator.