Constraint-Based School Timetabling Using Hybrid ... - Springer Link

5 downloads 1147 Views 205KB Size Report
data obtained the Technical and Vocational High Schools in Turkey. Experimental ... [7], have used with two heuristics based on local search, implemented by ...
Constraint-Based School Timetabling Using Hybrid Genetic Algorithms Tuncay Yigit Suleyman Demirel University, Engineering and Architecture Faculty, Computer Engineering, 32260, Cunur, Isparta, Turkey [email protected]

Abstract. In this paper, a hybrid genetic algorithm (HGA) has been developed to solve the constraint-based school timetabling problem (CB-STTP). HGA has a new operator called repair operator, in addition to standard crossover and mutation operators. A timetabling tool has been developed for HGA to solve CB-STTP. The timetabling tool has been tested extensively using real-word data obtained the Technical and Vocational High Schools in Turkey. Experimental results have presented that performance of HGA is better than performance of standard GA. Keywords: school timetabling, genetic algorithms, planning and scheduling.

1 Introduction The Timetabling problem is computationally NP-hard, therefore, it is very difficult to solve using conventional optimizations techniques. It has been frequently studied due to their wide range of applications, such as the traveling salesman problem, scheduling problem, employee timetabling, universities or high school timetabling. The School Timetabling Problem (STTP) is the planning of a number of meeting lessons or exams, involving a group of students or teachers for a given period and requiring given rooms or laboratories according with their availability and respecting some other constraints. The basic timetabling problem in a school consists of finding time-slots for a set of exams or lessons. A set of timetabling tasks is directly related to the satisfying a set of constraints. In most cases, although solutions are acceptable, there are many of hard and soft constraints remain violated [1]. There are many researcher have introduced models and algorithms for solving STTP problem. Recently, there has been a lot of attention paid to the problem of automating the construction of university and high school timetables. Many different methods have being tried, including simulated Annealing [2], tabu search [3], variations of genetic algorithms [4,5]. A standard GA does not yield desired timetables, because of violation of many constraints. This is a situation that has been noticed in several other implementations. Many researchers have used different hybrid operators to reduce of computing time and reduce the number of violations for some constraints. Wilke et. al. [6] are used Hybrid Genetic Algorithms for solving German High School. Their use direct representation of the problem and applies an R. Basili and M.T. Pazienza (Eds.): AI*IA 2007, LNAI 4733, pp. 848–855, 2007. © Springer-Verlag Berlin Heidelberg 2007

Constraint-Based School Timetabling Using Hybrid Genetic Algorithms

849

adapted mutation operators as well as several specific repair operators. But, their using operators are applied randomly, according to a given hybrid repair probability parameter. Stefano et. al. [7], have used with two heuristics based on local search, implemented by the intelligence mutation and improvement operators for solving Italian school system. Burke et. al. [8], have proposed some heuristic operators to improve solutions. Deris et. al. [9], have proposed a hybrid algorithm with constraintbased reasoning. Michalewicz [10], has used special operators which are designed to generate feasible solutions. This paper presents a new HGA approach to solve CB-STTP. HGA have been used to produce desired solutions and used an adaptive mutation and crossover operators. Repair operator is used to fix some chromosomes with duplications or absents of genes. The proposed algorithm is tested using the data of the Technical and Vocational High Schools in Turkey. The timetabling tool has been developed to using C++ Builder 5.0 language. The experimental results showed that the performance of the HGA is better than the standard GA.

2 School Timetabling The school timetabling problem, which has an important role typically on planning of education, is a special kind of the optimization problems in real-word. School timetabling models must accommodate the characteristics and regulations of specific education systems. Therefore the problem under consideration varies from country to country. 2.1 Structure of the Problem The data used this study, is the actual information of the Gazi Anatolian Technical and Vocational High Schools in Turkey. The students attend Technical High school up to 4 years and Vocational High Schools up to 3 years. Both of them, first year training is all nearly same. Timetable consists of 12 consecutive 40 minutes time-slots per day, having 5 minutes allocated as a break between courses, starting at 8:00 AM for 5 days. Vocational High School students go to industry to for vocational training in three days of a week. In these days, the students have no courses at school. Structure of the data consists of the number of time-slot of lessons in a week. A timetabling is characterized by events, such as classes, teachers and rooms. Here, each one of event is automatically appointed ID. A graphical user interface has been developed to facilitate the input data, as can be seen in Figure 1. As can be seen from figure 1, the column dimension consists of weekdays, and the row dimension consists of several time-slots within each weekdays. These time-slots are directly related to the satisfying a set of constraints. These constraints are classified as hard constraints and soft constraints. 2.2 Constraints Definition The constraints are the most important for the school timetabling to obtain good performance. These constraints are classified into two categorized. First, those constraints are called hard constraints. All of them, that must be satisfied completely

850

T. Yigit

Lesson ID 100 101

Lessons Lesson 1xn Lesson 2xn

Room ID 100 101

Rooms

Teacher ID 100 101

Room 1xn Room 2xn

Teachers Teacher 1xn Teacher 2xn

. .

. .

. .

. .

. .

. .

999

Lesson nxn

999

Room nxn

999

Teacher nxn Class

.

..

..

..

Lesson 1xn Lesson 2xn

time slot time slot

Room 1xn Room 2xn

Teacher 1xn Teacher 1xn

Lesson 3xn Lesson 4xn

time slot time slot

Room 3xn Room 4xn

Teacher 1xn Teacher 1xn

Lesson time slot1xn Room Lesson 1xn time slot Room Teacher 1xn 1xn 1xn Lesson time slot Room Lesson Lesson time time slot slot Room Room Teacher Teacher 1xn 1xn 1xn 1xn 1xn 1xn 1xn 1xn Lesson time slot Teacher Room Lesson Lesson Lesson timetime slot time slot slot Room Room Teacher Teacher 1xn Room 1xn 1xn 1xn 1xn 1xn 1xn 1xn 1xn 1xn 1xn Lesson time slot Teacher Room Lesson Lesson Lesson timetime slot time slot slot Room Room Teacher Teacher 1xn Room 1xn 1xn 2xn 1xn 1xn 2xn 1xn 1xn 2xn 1xn

Teacher 1xn

Lesson Lesson Lesson timetime slot time slot slot Room Room Room Teacher 4xn 4xn 1xn 1xn 4xn 1xn 1xn Lesson time slot slot Room Room Room Teacher . Lesson . time . 1xn . 1xn 1xn 1xn 1xn 1xn

Lesson nxn

. time . 1xn . Teacher time slot slot Room Room Room Teacher 1xn 1xn 1xn 1xn . . . time slot Room Room Teacher Teacher 1xn 1xn

time slot

Room nxn

1xn 1xn

Teacher nxn

time slot 2

. . .

Lesson Lesson Lesson timetime slot time slot slot Room Room Room Teacher Teacher 3xn 1xn 1xn 3xn 1xn 1xn 3xn 1xn

. Lesson 1xn . Lesson 1xn

time slot 1

. ..

..

Class

Class

Class

..

Class

m

. . . time slot n

1

Mon. . . . . . . . . . . . .

Tues. . . . . . . . . . . . .

Wed. . . . Lesson Room Teacher . . . . . .

Tour. . . . . . . . . . . . .

Friday . . . . . . . . . . . .

3

2

1

Fig. 1. Structure of data for STTP

in a timetabling. Second, those constraints are called soft constraints. Some or all of them may be violated provided that the penalty value. However, it is desired that all of the soft constraints should have minimum value. The school timetabling problem, based on a thorough analysis of the Turkish Technical and Vocational High School, the following a set of general constraints has been identified. Typical hard constraints: 1. 2. 3.

No teacher can teach two different classes at the same time No two distinct classes can be held in the same room and time period. Specific time-slot have to be closed or blocked, (no course hour is assigned) 4. Some of time-slots are closed for each of teacher. Consider a ten hourlong practical experiment. 5. Specific room requirements must be closed to take into considerations(i.e., lab) Typical soft constraints: 6. 7. 8.

Neither students nor teachers like timetables with a lot of empty slots (empty periods between lessons) Teacher’s preferences for time-slots for their classes Time-slots of the same lesson should be distributed uniformly over the week.

3 Hybrid Genetic Algorithm for STTP 3.1 Background of Standard GA GA’s are a heuristic solution-search or optimization technique, originally motivated by the Darwinian principle of evolution through (genetic) selection. A GA is a

Constraint-Based School Timetabling Using Hybrid Genetic Algorithms

851

parallel search method that manipulates a string of numbers (a chromosome) in a manner similar to the laws of evolution and biology. GA starts with an initial set of random solutions called populations and each individual in the population is called a chromosome. The operation of the GA changes slightly depending on the base of the numbers to apply the genetic operators such as, crossover, mutation, reproduction and elitism. The selection process evaluates each chromosome by some fitness mechanism and assigns it a fitness value. Although there are many techniques for the selection of parents, a commonly used method is the Roulette Wheel Selection, a proportionate selection scheme which bases the number of offspring on the average fitness of the population. Crossover is the procedure where two “parent” chromosomes exchange genetic information (i.e., a section of the string of numbers) to form two chromosome offspring’s. Mutation is a form of global search where the genetic information of a chromosome is randomly altered. Elitism is used to transfer the fittest member of the population into the next generation without modification. However, in some situations, repair function is to be needed to fix problems in the any chromosome [11]. 3.2 Chromosome Representation GA work with a population of strings or chromosomes. The idea is to create a population of individuals, each individual representing a possible timetable. In our implementation an individual represents a school timetable that consists of a sequence of all classes timetable of the school, as shown in Figure 2. These chromosomes are constituted by genes which consisted of Lesson_ID, Room_ID and Teacher_ID. These genes are decimal strings and used for each activity in the timetable. Generation 1

Generation 2

Generation 3

Generation 4

...........

Generation n

Generation

Chromosome1

Chromosome2

Chromosome3

Chromosome4

...........

Chromosomen

Population

Class 1

Class 2

Class 3

Class 4

...........

Class n

101104108

101104108

100100108

100100108

...........

110103105

100

100

108

Lesson_ID

Room_ID

Teacher_ID

Chromosome Genes

Fig. 2. Chromosome representation

3.3 Initialization At the first stage of GA, it is necessary to form a beginning population in which the size of space and the chromosomes in this space will be determined. During initialization, a population of feasible solutions is created randomly without regard to their fitness value. The size of the beginning population is important in the sense of GA’s activity. The small size of population causes the solution space to be small and not to reach the best solution merits. When solution space is too big, it causes both

852

T. Yigit

GA’s activity to minimize and solutions merits to turn towards very different and undesired points. In this study, during initialization, a population of candidate solution is created randomly for all lessons. Population size has been 20. 3.4 Fitness Function The evaluation process is mainly deal with hard constraints and soft constraints and has a mechanism for assigning penalties whenever these types of constraints are violated. The fitness function for school timetabling is of the form [7], as follows;

f =

1 1 + ∑ i α i .hi + ∑ j β j .s j

(1)

where, hi ∈ ℜ is the number violations of the ith hard constraint, whose penalty value is α i ∈ ℜ , and s j ∈ ℜ is the number violations of the jth soft constraint, whose penalty value is β j ∈ ℜ . The fitness of the chromosomes is inversely proportional to the number of violations of the hard and soft constraints. Those chromosomes with less penalty values are better solution. The penalty values for the violation of hard constraints are higher than those for soft constraints. The complete penalty value of the chromosomes is computed by adding the penalty values for all hard and soft constraints violations found. Thus the optimization process tries to generate a feasible solution with as few soft constraints violations as possible. 3.5 Genetic Operators

The selection operator evaluates each chromosome by some fitness mechanism and assigns it a fitness value. Although there are many techniques for the selection of parents, a commonly used method is the Roulette Wheel Selection [11], a proportionate selection scheme which bases the number of offspring on the average fitness of the population. But, in this mechanism it is possible that the individuals who were transferred from the preceding generation might not form a better individual. In that case, although better solution is expected in the next generation, the system may go worse. To prevent this, by applying a structure called elitism. The elitism is used to move into the next generation the fit member of the population without any modification into the next generation [11]. Crossover is the procedure where two parent (parents1 and parents2) chromosomes exchange a part of genetic information (i.e., a section of the string of numbers) to form two chromosome offspring. The simplest model is the single-point crossover, where the selection of a random position between 1 and l − 1, where l is the length of the chromosome, indicates which portions are interchanged between parents. Here, multi-point crossover has been used in this study, where each class timetable is selected randomly from one parent or the other. Mutation is a form of global search where the genetic information of a chromosome is randomly altered. In this presented algorithm, two gene swap for each classes in a random position. Repair operator is used to fix some with invalid solution for the problem. Because, the new gene structures formed after crossover and mutation operates turn into unsuitable gene structures. This operator use problem

Constraint-Based School Timetabling Using Hybrid Genetic Algorithms

853

specific knowledge about the problem domain to repair missing, lost or extra lessons in timetable.

4 Experiments and Results The developed timetabling tool has been tested using real-data obtained from Gazi Anatolian Technical and Vocational High School for 2004-2005 semesters. Table 1 summarizes information for this school. The parameter settings for the HGA reported in Table 2. Fitness function uses the penalty values for corresponding constraints as shown in Table 3. HGA attempts to solve the bigger penalty values ahead of others. By changing the penalties, constraints to be satisfied can be prioritized. In this study, those have been chosen using trial and error method. The implementation of the timetabling tool has been developed in C++ Builder. Experimental results are obtained by using PC which has Pentium Centrino 1.7 GHz processor and 512 MB RAM. Experimental results are obtained run standard GA and HGA. Table 1. Summary of the School Resources Teachers Department Classes Size of the lessons Rooms Weekly time-slot of Timetable Total time-slot of Timetable

Value 111 6 44 226 70 60 2640

Table 2. Parameters of the HGA Parameters Population size Chromosome size Crossover rate(pc) Mutation rate (pm)

Value 20 2640 0,85 0,08

Table 3. Penalty values of hard and soft constraints Hard Constraints 1 2 3, 4, 5 Soft Constraints 6 7 8 9

Penalty Value 200 200 closed of time-slots Penalty Value 50 50 50 50

As shown in Figure 3 and 4, those algorithms have been configurations computed are run 100.000 generations. Therefore, 2.000.000 configurations school timetables. Computing time for this problem was 6 hours on above PC. The total penalty value for the violation of all constraints is shown in figure 3. The best solutions with standard GA and HGA, respectively, about 17.000 and 4.000 penalty values were produced. In the run of GA and HGA completely are remained hard constraints violations as shown in figure 4. As shown in figure 4, HGA is better than the GA and it has less the computing time.

854

T. Yigit

Fig. 3. The total penalty value for the violation of all constraints with GA and HGA

Fig. 4. Penalty value of hard constraints with GA and HGA

Especially, for reduce penalty value of hard constraint in the HGA are used repair algorithm. After the completely hard constraints are removed, HGA is run like GA. Thus, it has less computing time. In the timetable, blocked time-slot, in the initial and next generations are the same and not open. Table 4 is shown number of constraint violations in the initial and next generations. Hard constraints completely are removed at 42.857 in Table 4. Number of constraints remained violated after GA and HGA GA

HGA

(72.682 generations)

(42.857 generations)

201 204 blocked

0 0 blocked

0 0 blocked

Soft Constraints

Initial Population

(100.000 generations)

(100.000 generations)

6 7 8 9

26 210 252 342

6 82 104 142

2 13 23 41

Hard Constraints

Initial Population

1 2 3, 4, 5

Constraint-Based School Timetabling Using Hybrid Genetic Algorithms

855

HGA and 76.682 generations in GA, respectively. These experimental results are quite acceptable in the solution space. But, there were remain few soft constraints at 100.000 generation for two techniques. Accordingly, a solution will be acceptable if it satisfies all the hard constraints, and a feasible solution will be said to be more or less acceptable depending on the degree to which soft constraints are satisfied.

5 Conclusions This paper deals with to solve the school timetabling problem using HGA with repair algorithm. HGA has so called a repair operator together with mutation and crossover operators. Significantly improvements have been achieved by using repair operator for the HGA. Paper discussed the application of a GA to the school timetabling problem, and show how the execution time can be reduced by using repair operator. The results obtained by HGA were compared with standard GA and experiments show.

References 1. de Werra, D.: An introduction to timetabling. Europan Journal Of Operations Research 19, 151–162 (1985) 2. Abramson, D.: Constructing school timetables using simulated annealing: sequential and parallel algorithms. Management Science 37, 98–113 (1991) 3. Hertz, A.: Tabu search for large scale timetabling problems. European Journal of Operations Research 54, 39–47 (1991) 4. Colorni, A., Dorigo, M., Maniezzo, V.: Genetic Algorithms and Highly Constrained Problems; The Timetable Case, Parallel Problem Solving from Nature I, pp. 55–59. Springer, Heidelberg (1990) 5. Calderia, J.P., Rosa, A.C.: School Timetabling using Genetic Search. In: Burke, E.K., Carter, M. (eds.) PATAT 1997. LNCS, vol. 1408, pp. 115–122. Springer, Heidelberg (1998) 6. Wilke, P., Grobner, M., Oster, N.: A Hybrid Genetic Algorithm for School Timetabling. In: McKay, B., Slaney, J. (eds.) AI 2002: Advances in Artificial Intelligence, pp. 455–464. Springer-Verlag, New York (2002) 7. Di Stefano, C., Tettamanzi, A.: An Evolutionary Algorithm for Solving the School TimeTabling Problem. In: EvoWorkshops, pp. 452–462 (2001) 8. Burke, E.K., Petrovic, S., Qu, R.: Case Based Heuristic Selection for Timetabling Problems. Journal of Scheduling 9, 15–132 (2006) 9. Deris, S., Omatu, S., Ohta, H., Saad, P.: Incorporating Constraint Propagation in Genetic Algorithm for University Timetable Planning. Engineering Applications of Artificial Intelligence 12, 241–253 (1999) 10. Michalewicz, Z.: Genetic Algorithms+Data Structure=Evoluation Programs, 3rd edn. Springer, Heidelberg (1996) 11. Goldberg, D.E.: Genetic Algorithm in Search, Optimization, and Machine Learning. Addison- Wesley Publishing Company Inc, Canada (1989)

Suggest Documents