Research on university curriculum system based on genetic algorithmShenlijong Chen Minglei (Department of Computer Science and engineering, School of Information, Nanjing Forestry University, Nanjing 210037)
SummaryThis paper proposes and realizes an automatic course scheduling algorithm, establishes the data model by using genetic algorithm, defines a chromosome coding scheme and fitness function including teacher number, class number, course number, classroom number, class time period, and finally obtains the optimal solution through the process of initializing population, selection, crossover and mutation. Using this algorithm to experiment the real data of a university, the results show that there is no classroom, teacher, class conflict, the algorithm is reasonable and feasible.
Key WordsGenetic algorithm; class-scheduling problem; fitness function
1 PrefaceIt is an important task for the Academic Affairs Department to make reasonable arrangements for the teaching tasks of the university each semester. One of the most important aspects of the course is scheduling. The essence of the scheduling problem is to assign the curriculum, teachers and students to the appropriate classroom in the appropriate time period, which involves more factors and is a multi-objective scheduling problem, which is called the timetable problem in operations research (timetable problem, or TTP). At present, due to the expansion of school enrollment, the number of students and courses has greatly increased than in the past, the classroom resources are obviously insufficient, in this case, it is difficult for the platoon staff in the case of multiple constraints at the same time with the manual discharge of teachers and students are satisfied with the class schedule. The problem of course scheduling has long been a research topic for many researchers and software companies, but there are few classes of software that are actually put into use. The reasons are manifold, among them the choice of algorithms is the most critical problem, S.even and others in the 1975 study proved that the problem of scheduling is a np-complete problem, that is, if the "exhaustive method" algorithm to find the best solution is impossible. However, due to the cost of poor lifting method is too high, time is too long, can not be implemented on the computer. Because assuming that there are n hours in one weeks to arrange classes, there are m teachers need to participate in the course, the average teacher one weeks on the K class, without regard to other restrictions, the possible combinations can be introduced Nm*k species, such a high degree of complexity is the current computer can not afford. Therefore, many researchers put forward a variety of other scheduling algorithms, such as simulated annealing, list search, constraint satisfaction, etc. [1]. Among them, genetic algorithm (genetic algorithm, short GA) is an effective algorithm to solve the optimal solution. Genetic algorithm is an adaptive artificial intelligence technology that simulates the extreme value by simulating the evolutionary process of nature, which was first put forward by Professor Holland of the University of Chicago in 1962. Genetic algorithm borrowed from the viewpoint of biological genetics, through the mechanism of natural selection, heredity and mutation to improve the adaptability of each individual, and embodied the evolutionary process of "natural and survival of the fittest" in nature. Genetic algorithm attracts a large number of researchers and is widely used in many fields such as function optimization, combinatorial optimization, production scheduling, machine learning, image processing, pattern recognition and so on.2 class Problem description[2] In the course of arranging classes, our main task is to arrange the classes, classrooms, courses, and teachers within a week without any time conflicts. " " Accordingly, we give the following descriptions: schools have r classrooms, c classes, S-gate courses, T-Teachers, p-time periods. Classroom Collection R (R1,r2,... Rn), each classroom can be accommodated (x1,x2 ... XR) person; class set C (C1,c2,... Cn), each class has (K1,k2,... KC) persons, of which there are X classes on the class of the class; Course collection S (s1,s2,... Sn), each course corresponds to Ci classes, 1 teachers, (1≤CI&NBSP;<CN); Teacher Collection T (t1,t2,... Tn), each teacher corresponding to the Sm door class, Cn classes, (1≤SM&NBSP;<SN,1≤CN&NBSP;<CN), in the initial setup of the teachers to set the schedule requirements. time set P (P1,P2,...,PN), assuming a week of five days lessons, divided into five teaching units per day, each unit is 2 hours, that is 2 in the morning, 2 in the afternoon, 1 in the evening, the time set contains 25 time periods. If 11 represents the first teaching module of Monday, that is, Monday 1, 2, and 12 represents the second teaching unit in Monday, i.e. Monday 3, 4, and so on, these time periods constitute a time set P (11,12,13,.... 55). a correct schedule should satisfy at least the following hard constraints: [3] ⑴ a teacher or a class or a classroom can only arrange one course at a time; ⑵ allocated classrooms should be larger than the number of students. In addition to the above rigid constraints, there are some soft constraints, these soft constraints help make the timetable more reasonable, more humane. These soft constraints may be [4]: ⑴ as far as possible in the morning to arrange compulsory courses, and the afternoon to arrange elective courses, at night try not to arrange classes; ⑵ as much as possible to meet the special class time requirements for individual teachers; ⑶ a course as far as possible scattered in one weeks, that is, after a certain course in the sky, to be more than one day to take this course, so that teachers have sufficient time to prepare and correcting homework, and students have enough time to review digestion; (4) A teacher's class cannot be filled all day; (5) The class time in the student schedule should not be too concentrated, should avoid one day course is full and another day but a whole day without class. These soft constraints are different in colleges and universities, and in our research, we define a method of solving the genetic algorithm in the constraint scope, and optimize the operation.3 Genetic algorithmsGenetic algorithm uses a similar gene evolution cycle process, the calculation process is as follows: 1 randomly generate a certain number of initial population 2) to assess the individual fitness, if the individual's fitness to meet the optimization criteria, the best individual and its representative of the optimal solution, and end the calculation, or the 3rd step. 3) According to the adaptation of the selection of the regeneration of the individual 4) according to a certain crossover probability and crossover method to generate a new individual 5) according to a certain mutation probability and mutation method to generate a new individual 6) by crossover and mutation of the generation of the population, and then return to the 2nd step. 1 is shown below:
Figure 1 Genetic algorithm The following is the pseudo-code of the genetic algorithm. begin:i = 0; Initialize P (I); Fitness P (I); while (not terminate-condition) {I + +; Ga-operation P (I); Fitness P (I); } END.4 Design4.1 chromosome encodingThe first consideration in GA is how to express the problem, that is, how to encode the chromosome so that it can be applied to GA operation. In classical genetic algorithms, floating-point or binary coding methods are often used, while in the study, each chromosome represents each teacher's timetable, and its structure is expressed as follows:
teacher id |
class ID |
Course ID |
classroom |
class schedule |
Chromosomes in the program can be encoded in decimal numbers, for example: A teacher number 1247, to teach "database principle" This course, "Database Principle" course number 8017, weekly hours 4, class 01811, 01812, randomly generated class time, randomly selected more than two class total number of classrooms, The chromosome can be generated such as: "124701811018128017024012241" where 02401,2241 represents the classroom and the second teaching module in Tuesday (i.e. morning 3, 4) and the first teaching module in Thursday (i.e. morning 1, 2). According to the code above, the two chromosomes are cross-operated on the last 9 digits, and will not affect the courses taught by each teacher, nor will it result in teachers ' curriculum including other teachers ' teaching courses or the unreasonable chromosome structure after each generation. Each chromosome represents a possible scheduling result, and the fitness function evaluates the fitness value of the chromosome to determine the outcome of the course. The genetic algorithm of fitness function chooses the next generation population according to the fitness value of each individual in the evolution. The adaptability function setting directly affects the convergence speed of genetic algorithm and can find the optimal solution. In this system, the design idea of the fitness function is the weighted summation of the types of conflicts that exist in each chromosome, in which the weight of WI represents the importance of rule I, and if a chromosome violates a rule I, the value pi is set to 1 (if there is no violation of rule I, the Pi value is 0), The penalty value is WI*PI, weighted summation of the existing conflict in the chromosome and 1, then the reciprocal, as shown in the following formula. The higher the number of chromosome fitness function, the better teaching time and classroom, the more survival probability in the next generation evolution.
4.2 Genetic manipulation (1) Initialization of [initialize] is intended to provide an initial population for subsequent genetic operations. in our algorithm, due to the genetic operation of a teacher each time, the initialization needs to take into account the classroom and time settings, including the classroom can accommodate the number of the best approximation (that is, to avoid a class of 30 people can occupy 200 of the classroom this situation), And the rationality of the schedule of classes, which has been explained in the problem description of arranging classes. (2) Select the [select] selection operation to simulate the phenomenon of natural selection in biological communities. It chooses a certain chromosome with high degree of adaptability from the old population, and puts it into the pairing set to prepare the new population for chromosome crossover and mutation operation. The higher the degree of adaptability of the chromosome is the more likely the choice of the, method has many, such as the roulette selection method (Roulette wheel selection), the local selection method (locally selection), Tournament Selection Method (tournament selection) and so on. In the study, we chose one of the local selection methods: Truncated selection (truncation selection). In the truncated selection method, the chromosomes are ranked from highest to lowest according to the fitness function, and only the best individuals can be chosen as parents. Among them, the parameters used to determine the percentage of chromosomes selected as parents are called truncated threshold trunc, and the value range is 50%~10%. Individuals outside of this threshold cannot produce sub-entities. The relationship between the selection strength and the truncated threshold in the algorithm is shown in table 1. Table 1 The relationship between the selection strength and the truncated threshold [5]
truncated threshold |
1% 10% 20% 40% 50% |
80% |
Select strength |
2.66 1.76 1.2 0.97 0.8 |
The selection intensity is to apply the normal Gaussian distribution to the selection method, and the expected average fitness. The selection strength is expressed as: Selinttrunc (Trunc) = The FC is the lower limit of the integral of the following Gaussian distributions: Trunc = (3) Cross [Crossover] cross is based on the result of the selection operation, select two chromosomes as the parent, then take a random value (set to R) and the system preset intersection The fork rate value (set to T) is compared if the r<t is the exchange gene. (4) Mutation [mutate] mutation is random change in the chromosome of any one of the teaching period, the time period randomly extracted a bit within the set range of changes. Mutation operation mimics the genetic mutation caused by various accidental factors in the natural genetic environment, through mutation, chromosome adaptability may be increased or decreased, but it ensures the diversity of genetic types in the population, so that the search can be carried out in as large a space as possible, and the possibility of obtaining the optimal solution is greatly enhanced. The mutation operation is similar to the crossover operation, that is, to define a mutation probability pm, to generate a random number r when the mutation occurs, or to perform a mutation operation when R<PM, otherwise it is not executed. For example: One chromosome is encoded as: "0872 ' 01211 ' 1005 ' 04201 ' 2122", which indicates that the first to second teaching Unit section in Tuesday has a course numbered "1005", which, after mutation, becomes: "0872 ' 01211 ' 1005 ' 04201 ' 2152" , the degree of chromosome adaptability is greatly improved.5 Resolution of conflictsThe problem of course scheduling is a np-complete problem, regardless of which method can not avoid the emergence of various conflicts, the same teacher in the same period of two courses is the most obvious conflict problem. In order to avoid this kind of conflict, a conflict detection function fconflict () was introduced in the development of this system, and when all courses of a teacher are completed, the system will use this function to detect and revise the conflict situation of this teacher's curriculum arrangement.6 Evaluation of resultsThis system uses Visual C + + 6.0 software to implement the genetic scheduling algorithm, and the real data of a university is tested. In the 2002-2003 school year, there were 686 classes, 356 teachers, 160 classrooms and 412 administrative classes. Figure 2 shows the maximum adaptation and average adaptation of a generation of chromosomes in the evolutionary process, with 30 chromosomes, a crossover rate of 0.8, a mutation rate of 0.02, and an evolutionary algebra of 1000 generations.
Fig. 2 The maximum adaptive value of the study-average adaptive value curve
It can be seen from the adaptive value curve that this algorithm has better convergence, and it also shows that the chromosome coding scheme and fitness function mentioned in this paper can better reflect the requirements of scheduling, and the chromosome will be able to obtain satisfactory optimal solution after the generation of evolution. Figure 3 is the use of genetic algorithm discharged 01811,01812 two classes a semester schedule, from the timetable can be seen that there is no teacher, classroom, class conflict, the same course two times the class interval has reached more than one day, and no courses are arranged at night, Therefore, both the hard constraint condition and the soft constraint condition are better satisfied.
7 ConclusionThis paper discusses the problem of the arrangement of college timetable by using genetic algorithm, and proves that the chromosome coding scheme and fitness function proposed in this paper are feasible, and the value of fitness function can be increased with the increase of evolutionary algebra, and the experimental results are satisfactory. In the area of chromosome coding, it is also ready to consider more complex curriculum requirements in the future.
Figure 3 Example of a class result based on genetic algorithm
Reference Documents[1] ye Ning, Liang, Dong Yisheng. A genetic algorithm-based algorithm for TTP problem solving. Journal of Southeast University (natural Science Edition). 2003 (1): 41-44 [2] tangyong, Tang Shefei, Wang Ling. Scheduling system based on genetic algorithm. Computer Applications-2002 (1): 93-94,97 [3]h.l.fang, "Genetic algorithms in timetabling and scheduling", Ph.D. thesis,department of Artifi cial Intelligence, University of Edinburgh, uk,1994. [4] e.k Burke, D.G Elliman, R.f. Weare, "A Genetic algorithm Based University timetabling System", East-west Conference On computer Technologies in education, CRIMEA, Ukraine, 1994, pp. 35-40. [5] Wang Xiaoping, Cao Liming. Genetic algorithm--theory, application and software implementation. Xi ' an: Xi ' an Jiaotong University Press, 2002:31-33
Received: August 21 Date Modified: August 29
Fund Project: Jiangsu Provincial Natural Science Fund Project (BK2005134), School Introduction (study) talent Fund (G2002-28), School 15 Talent Fund (PG200518)
Author Profile:Shenlijong (1974-), female, PhD, lecturer, mainly engaged in artificial intelligence and database research articles reprinted from: http://www.ahcit.com/lanmuyd.asp?id=2069
trackback:http://tb.blog.csdn.net/trackback.aspx?postid=1448122
Research on university curriculum system based on genetic algorithm