Design and Application of an Improved Genetic Algorithm to a Class Scheduling System

— The current expansion of national colleges and universities or the increase in the number of enrolments requires teaching management to ensure the quality of teaching. The problem of scheduling is a very complicated problem in teaching management, and there are many restrictions. If the number of courses scheduled is large, it will be necessary to repeat the experiment and make adjustments. This kind of work is difficult to accomplish accurately by manpower. Moreover, for a comprehensive university, there are many subjects, many professional settings, limited classroom resources, limited multimedia classroom resources, and other factors that limit and constrain the results of class scheduling. Such a large data volume and complicated workforce are difficult to complete accurately. Therefore, manpower scheduling cannot meet the needs of the educational administration of colleges and universities. Today, computer technology is highly developed. It is very economical to use software technology to design a course scheduling system and let the computer complete this demanding and rigorous work. Common course scheduling systems mainly include hill climbing algorithms, tabu search algorithms, ant colony algorithms, and simulated annealing algorithms. These algorithms have certain shortcomings. In this research, we investigated the mutation genetic algorithm and applied the algorithm to the student’s scheduling system. Finally, we tested the running speed and accuracy of the system. We found that the algorithm worked well in the course scheduling system and provided strong support for solving the tedious scheduling work of the educational administration staff.


Introduction
In today's era of information technology and Internet technology, the cyberspace collapses the traditional boundaries. People move from physical to virtual World [1]. How to manage information more systematically and conveniently has become a serious problem for universities. With the rapid development of the economy in the recent years, the reform of the education industry has become deeper, and the number of students in major universities has increased. The scale of the school's teaching facilities has become increasingly unable to meet the increasing number of students. Among them, the daily teaching schedule of the school is a very complicated problem. It needs to include the specific classroom address, students, courses, and classroom teachers, as well as the types of courses to be taught and the time required for the class. Manual scheduling results in a large workload and has low efficiency [2]. Colleges and universities urgently need to adopt an automated scheduling system to improve efficiency, reduce human resource costs, and reduce the workload of the academic staff.
The orchestration of courses is a very complicated task, and a number of factors and data dimensions need to be considered in the entire process. It also requires a lot of patience. In the actual course of class scheduling, it is necessary to solve various conflict problems and determine various conditions, including various teaching facilities, teachers and students, and other factors. For example, two or more teachers cannot be assigned a class in a classroom at a time, one class cannot appear in two classrooms at the same time, one teacher cannot attend two classes at the same time, and one course cannot. The number of students in a class that is repeated in one day cannot be less than the number of classes in the classroom [3]. One teacher should have multiple classes on the same day, and these classes should be in the same area. While solving these problems, artificial efficiency is low. In order to improve efficiency and save financial resources, it is necessary to use a computer to complete this work. As long as the software algorithm is optimised and the programming language is selected, an efficient software system can be developed. The system needs to solve the scheduling requirements of diversification, frequent adjustment of schedules, large amount of data, etc., and to meet the reliable and safe performance characteristics based on network applications.
Traditional class scheduling is mainly done by manpower, and the manpower scheduling will be affected by the objective ability. People will be exhausted and negligent, and it will be difficult to perform operations according to the rules under the conditions of a large workload. Moreover, if the course arrangement is not fully implemented, there is a problem with the class, a class adjustment occurs, or a special activity interrupts the normal teaching process, the course settings must be re-adjusted. The best course is to take the lead and move the whole body. If one place is adjusted, the other related places will have to be adjusted, and in an entire semester, sudden and unpredictable situations are difficult to avoid, so there will be a number of adjustments. The work needs to be completed, and the amount of this work is no less than the first class [4]. A normal-sized university, if it has the manpower to complete a class assignment, may need a task force to work for more than a month.
In this study, we first analysed the limitations of the traditional algorithm reclassification. Then, on the basis of these limitations, a genetic algorithm was developed. This algorithm was applied to the course scheduling system, and the school-level course scheduling system was designed and implemented under the three-tier architecture based on the B/S mode. The main functions of this system were as follows: Basic management, information management of training programmes, scheduling management, printing schedules, and system management. In the detailed operation of the course scheduling system, the course scheduling was mainly completed by using manual scheduling and automatic class scheduling. On this basis, it was also possible to adjust the class at any time.

Definition
The definition of the constraint satisfaction problem is as follows:

Scheduling problems
The problem of class scheduling in schools is to put the teacher's class events under the conditions of certain teaching resources and follow certain mandatory conditions that must be met (for example, the same classroom cannot be used for different courses at the same time). In the case that teachers cannot appear at different teaching venues at the same time, the teaching activities are arranged under the condition of soft constraints (for example, teachers' different preferences for class times and places) [5]. Thus, the evaluation function attempts to achieve the problem of optimisation (maximum or minimum). In solving this problem, the following two types of constraints are mainly included.
A hard constraint is a constraint that must not be violated. That is, when a hard constraint is in conflict, the conflict can only be rearranged or removed, including restrictions on various resources, such as the following: H1: The same course taught by the same teacher cannot be arranged for the same period of time. The course group here consists of courses that share the same students. In other words, there can be no overlapping students or teachers at any time.
H2: Any two different courses cannot be assigned the same time period and the same classroom.
H3: Each lesson in each course must be assigned to a time period and a classroom. H4: No student or teacher can be assigned to two classrooms at the same time.
Soft constraints mainly refer to user preferences. He is a very important measure in the solution to the problem of scheduling, satisfying the hard constraints, and can indicate whether people's preferences in this issue are met. The typical soft constraints have teachers' preference for class time and class location (whether some teachers like to go to class in the morning), students' preference for class time and place, and the course itself is more reasonable in the morning or afternoon, such as primary and secondary schools. A few words are usually arranged in the morning. Constraints such as these should be met as much as possible during the course of class scheduling, and if they are not met, they can be violated. Some examples are as follows: S1: A class should be arranged with appropriate teaching resources (such as classrooms, playgrounds, and experimental equipment). For example, a class of 35 people can be arranged in a classroom that can accommodate 40 people. Try not to arrange for a classroom where 200 people can sit. Avoid the wastage of teaching resources.
S2: All courses in any one course should be assigned to the same classroom. If this is not possible, then the number of occupied classrooms should be as small as possible.
S3: In basic education, the distribution of courses is required to be as uniform as possible (for example, all subjects are covered in daily courses), but in higher education, courses are required to be as concentrated as possible.
S4: In higher education, the distance between the two classrooms has a certain relationship with the interval between the two classes. In the case of a short interval between the two lessons, the distance between the two classrooms should not be too far.
S5: Basic courses and elective courses, physical education courses, and other courses should be distributed as evenly as possible.
Although soft constraints are not mandatory, the satisfaction of soft constraints is an important indicator of a scheduling algorithm.

Analysis of algorithms
At present, many people in the field of scheduling have conducted a considerable amount of related research and have produced many methods and techniques to solve the related problems.
The hill climbing algorithm is a heuristic local optimisation method. It is an improvement on the depth-first search algorithm. It uses feedback information to help generate solution decisions. The basic idea of the algorithm is to start with the current node and compare it with the values of the surrounding neighbours [6]. If the current node is the largest, then the current node is returned as a local optimal solution; otherwise, the current node is replaced with the highest neighbour node, thereby implementing an algorithm that obtains a local optimal solution or even obtains a global optimal solution.
The popularity of tabu search should be attributed to the Swiss Federal Institute of Technology, Werr. The pioneering work of the team was conducted in the late 1980s. At that time, Glover's article was not well understood in the absence of a 'superheuristic culture', because of Werr. The important role played by the series of papers published by the team in the academic world has made the tabu search technology widely known [7]. In 1990, with the publication of the first monograph on tabu search, the study on tabu search reached a peak.
The ant colony algorithm was first proposed by the Italian scholars Dorigo, Maniezzo, and others in the 1990s. In their research, they found that the ant population can find and carry food very efficiently during the foraging process. In the process of foraging, the ant colony can always find the shortest path from the ant nest to the food. Through in-depth research, scientists found that when a single ant just went out, it would walk in one direction but when it found food, it would secrete a pheromone. Other ants would come over after discovering the pheromone. The larger the number of ants that find food, the more prominent will be a mechanism such as positive feedback; therefore, after a certain period of time, the entire ant colony will follow the shortest path to the food source. The intelligent behaviour of ants benefits from its simple rules of behaviour, which give it diversity and positive feedback. In the foraging, diversity stops the ants from entering the dead end and an infinite loop; this is an innovative ability; positive feedback preserves good information and is a learning enhancement ability [8]. The ingenious combination of the two results in intelligent behaviour. If the diversity is excessive, the system is very active, which will lead to excessive random motion and a chaotic state. If the diversity is insufficient, the positive feedback will be very strong, which will lead to rigidity; when the environment changes, the ant groups cannot be adjusted accordingly.
The earliest idea of simulated annealing (SA) was proposed by Metropolis et al. in 1953. In 1983, Kirkpatrick et al. successfully introduced annealing ideas into the field of combinatorial optimisation. It is a stochastic optimisation algorithm based on the Monte-Carlo iterative solution strategy. Its starting point is to combine the characteristics of the yard activity and the pursuit of the optimal solution in the metal melting process in the metallurgical industry. The simulated annealing algorithm starts from the algorithm with a high temperature as the initial value. In this process, the temperature is continuously decreased, and the activity of the atom is gradually reduced. However, there are still some atoms with a certain probability of occurrence of a large probability of activity change; that is, there is a certain probability that the atom will jump out from the local optimal solution. As the temperature decreases, the atomic activity gradually decreases. Furthermore, as the temperature changes, the activity of the atom, that is, the jump probability of its certain probability, also tends to eventually become the globally optimal. The simulated annealing algorithm is a general optimisation algorithm, which is suitable for many industries or algorithms to find the optimal solution. At present, it has a wide range of applications in solving CSP problems, neural networks, and artificial intelligence [9]. The simulated annealing algorithm is used to effectively avoid the volatility of the serial structure of the local minimum and is the most stable serial structure by giving the search process a sudden change in probability that eventually changes to zero. The advantages and disadvantages of different algorithms are listed in Table 1.

Algorithm Advantages Disadvantages
Hill climbing algorithm Avoid traversal and select some nodes by inspiration to achieve efficiency.
Not a comprehensive search; the search results may fall into the global optimal solution too early, and due to the lack of a backtracking mechanism, it is impossible to search for a larger solution space, resulting in the failure to obtain a global optimal solution. When the flat top data are searched, the optimal search direction cannot be determined, resulting in random walks, which makes the search efficiency drop to a very low level.

Tabu search
A tabu list is created to avoid falling into the local optimal solution, and the purpose of optimising the direction is achieved by providing a reference to the selection of the moving direction after recording the previous movement condition.
Obsessed with a particular area and its neighbourhood search

Ant colony optimisation
The use of the positive feedback mechanism makes the search process increasingly closer to the optimal solution and considerably improves the computing power and the operating efficiency of the algorithm.
In the initial stage, the execution efficiency will be extremely low, and there will be a stagnation of algorithm execution, which is not conducive to finding the optimal solution.

Simulated annealing
Random factors are introduced in the search process to achieve a global optimal solution. The search for local optimal solutions is very fast.
There is a phenomenon that a certain probability misses the optimal solution.
The parameters are more difficult to control.

Genetic Algorithm
Genetic algorithms were originally developed with reference to some phenomena in evolutionary biology, including genetics, mutation, natural selection, and hybridisation. The general implementation of genetic algorithms is a computer simulation. When searching by using the genetic algorithm of the decision conflict problem, it does not need to be deduced and can be directly applied to the structural object. The main feature of the genetic algorithm is that it can automatically adjust and optimise the search direction and automatically obtain the data. From an intelligent perspective, genetic algorithms have good parallel execution capabilities and automatic search capabilities. The genetic algorithm completes the automatic search function of data by determining the fitness function and genetic factors, which is the main embodiment of the algorithm in the genetic code. The algorithm automatically improves the survival rate by automatically screening large individual fitness values during the evolution process, thereby improving the search space and the work efficiency of parallel optimisation. In short, in addition to the advantages of high efficiency, powerful function, and low algorithm complexity, the algorithm has good adaptive search capability, which can update and solve optimisation problems [10]. The main purpose of genetic algorithms is to find the most practical algorithms in many complex systems, which have been widely used in search and decision conflicts. It does not need to be directed to structural objects. The algorithm automatically adjusts the search direction and search space, automatically obtains the data, and searches repeatedly until it succeeds. Further, in the case that the genetic algorithm cannot limit the convergence of the function, the method of optimising the probability is adopted, and the efficiency is improved by means of parallel search. On the basis of this feature, genetic algorithms have achieved good application prospects in many fields such as automatic control, artificial intelligence, and combinatorial optimisation. Genetic algorithms were applied in transportation schedule and feature selection.

Basic mathematical model of genetic algorithm
The basic genetic algorithm consists of an eight-tuple in the following formula: C-represents the individual coding method (binary), which is the basic factor in the genetic algorithm. A combination formed by the connection of genes and chromosomes is a solution of curriculum arrangement.

E-indicates the individual's fitness evaluation function. Use the value of the function to distinguish whether the individual meets the requirements.
Po-represents the initial group, the combination of the course arrangement randomly formed by the genetic algorithm; the optimisation of the subsequent genetic algorithm will be developed around the initial group.
M-indicates the size of the group. P-represents the selection operator; the calculation method is filtered by the fitness value, and the larger the value is, the easier is its selection.
ι-represents the crossover operator; the new individual is generated by the father's individual random exchange of genes and is carried out by means of single point intersection.
φ-represents the mutation operator. The father individual randomly changes the individual's own gene value and adopts a single point mutation of the gene.
T-indicates the termination condition of the algorithm. When performing the genetic iteration, we usually set a certain parameter value. In the case of iterative algebra, the operation will terminate.

Genetic algorithm operation flow
When using genetic algorithms for system development, follow these steps: 1. Select the appropriate method to encode the system parameters, and convert the relatively optimised solution set into a chromosome for representation. 2. Determine the initial population of the system. 3. Define the adaptation function.
4. Manipulate genetically the design system. 5. Set the parameters, such as control the size of the group and the probability of genetic manipulation. 6. Determine whether the generated group satisfies a specified index: if it is satisfied, the calculation is exited, and if it is not satisfied, the operation of calculating the fitness function value is returned.
This process is shown in Figure 1.

Application architecture
The system adopts the B/S/S design architecture and uses multiple servers; each server accesses different data. From the perspective of cost, all of the technologies use the open-source technology, from the user layer to the system layer [11]. The software structure contains a client, application layer, middle layer, operating system as shown in Figure 2. 1. Client: Mainly accessed through the browser. The advantage here is that the client does not need to install any programs. At the same time, mobile phones are supported, and students, teachers, and educational administrators can implement mobile services through mobile phones. 2. Application layer: Deployed in a scalable distributed J2EE architecture, deploying a traffic balancing server between the client and the application server. It is recommended to use the open source nginx system for service routing and service balancing operations. After the traffic equaliser, the application gateway is deployed. The application gateway functions to isolate external applications and core applications and enhance the Internet application security [12] . After the application gateway, it is the service layer. The service layer adopts the popular micro-service architecture design of the Internet, adopting the open-source architecture SPRINGMVC, Mybatisplus, MQ, Redis/Cache, Zookeeper, Dubbo, SSO, nginx, and ibatis development framework. The advantage of using the micro-service architecture is to make the application system fragmented, easy to maintain, and upgrade at any time. It is currently the mainstream technology for Internet applications. 3. Middleware and operating system: The middleware is mainly the application container and database system. Considering the cost, we used open-source software and used tomcat6.0 as the application server middleware and MySQL_5 as the database server. The operating system uses an open-source Linux operating system. The functional modules of the system's basic functions and the application scenarios of the open-source technologies are used in the system.

Operating environment
The operating environment is mainly the operating system environment supported by the system, including the mobile terminal, the PC terminal, and the server terminal.

Mobile. Available in both Android and iOS versions: Android minimum support
Android 4.0 and above, and IOS minimum support IOS 7.0 and above. 2. PC side. Browse support: IE9.0 or above, Firefox, Google, Sogou 360, and other browsers.

Server system
Operating system: Linux 6.0, Window 7, or higher. Recommended development environment: Linux 6.0, Apache Http Server 2.2.32, and MySQL 5.0+ are also a common development environment in the enterprise.

Database Design
We used the MySQL database and the MySQL yogEnt client to manage information such as scheduling resources and scheduling constraints, and used database technology to achieve the matching of the class scheduling priority, class time and time period, and conflicts in scheduling resources, which is the purpose of automatic class scheduling. This course scheduling system consists of five elements, namely the course, the instructor, the class, the class address, and the time [13]. On the basis of the characteristics of college teaching, the corresponding relationship is set to the relationship between the instructor and the course. The meaning is that one teacher can teach multiple subjects. When the course is restricted to a class, that is, the course is tied to the class, the relationship with the teacher is a one-to-one relationship. When the teacher is bound by the class time, the relationship with the classroom is one-toone. When the class is constrained by time, it can only be one-to-one with the class. At this time, the class is also one-to-one with the classroom. Data maintenance information management belongs to basic information management, including professional information management, class information management, course information management, teacher information management, and classroom information management.

Fig. 3. Basic information management diagram
After the basic information is set, you can query, modify, delete, etc. In addition, it should have the following functions: Modification management of teaching tasks, allocation of scheduling resources, and classification of classes by classroom, class, teacher, etc., and its export. After the education department or other staff members manage the basic data, they use the computer to discharge the class schedule according to the business requirements of class scheduling and the principle of class scheduling. If there are leaks or misalignments, or conflicts, they can be manually changed 4 De_Name and adjusted by personnel to make the course uniform and finally produce the correct class schedule. The specific course management function is shown in Figure 4: The visitor accesses the web server through the client and needs to determine the identity, including the anonymous identity, to log in to the system according to different functional requirements [14]. The specific process is as follows: 1. If the visitor has an account and password, he/she can directly input the corresponding information. If not, and the anonymous identity cannot meet his/her needs, the user can choose whether to register an identity according to his/her own needs. 2. Thereafter, verify the information of the visitor to check whether it is legal. Moreover, in order to prevent malicious login and malicious destruction of the teaching system, the system adopts anti-brute force cracking measures [15] . If the number of errors is found to exceed three times, it is forced to exit the interface to prevent illegal user violence from entering the system. 3. If the information input by the user is legal, the management authority of the login user is detected, and the corresponding data information is displayed on the browser.

Information management
The business functions implemented by this module are mainly for the management of the basic information in the system, which includes class information, course information, teacher information, and classroom information in universities. The management of these types of information mainly includes the insertion, deletion, modification, and query of information.

Development of a teaching task book
The Academic Affairs Office submits the teaching calendar to the class staff. Each department submits a teaching plan to the class staff. Finally, the Academic Affairs Office develops a teaching plan.

Arrangement of instructors
Each department assists the staff of the Academic Affairs Office to arrange the instructors according to the opening task book.

Statistics training information
The teacher can make a request for the adjustment of an inappropriate schedule to the staff of the Academic Affairs Office, review and approve the information, and update the information.

Class scheduling
The Academic Affairs Office records the classroom information for the classroom management personnel of the experimental centre, and issues the class scheduling instructions to the class staff. The class staff obtains the classroom information, the teacher information, and the information in the course assignment book for class scheduling. Thereafter, the department's academic staff were sent to conduct conflict detection [16]. The teacher can make a request for the adjustment of the inappropriate schedule to the staff of the Academic Affairs Office, review and approve the information, and update the information.

Class design
The design description of the relevant functional modules of this system is as follows: 1. In the course schedule, the number of lessons per week cannot exceed the number in the plan. 2. It is possible to query the computer for the teacher's one-week course schedule, how many classes, and which days of the week in a classroom are empty; that is, data can be queried. 3. You can check the student schedule. 4. The same course in the same class cannot be arranged in four classes (except for practical classes).

Schedule generation
This module is mainly used to implement the curriculum of students and classrooms and teachers. The system is designed with automatic generation and manual generation.

6.9
Class schedule query and class sheet printing This module can realise the retrieval of the curriculum for all the levels of users in the university system, including students, teachers, and administrators, and can print the results of the query [17].

System Test
To ensure the scheduling system meets the users' requirements [18], various tests are needed:

Functional test
Divide the software system into several functional modules, and then, test whether the business logic of each functional module is consistent, whether the code is standardised, and whether the code needs to be streamlined. In addition, the function realisation achieves the expected vision.

System integration test
After the end of the test of the functional module, the assembly moves from the bottom to the next layer. Each layer of the team is tested, and it is finally determined whether the business logic of the entire system meets the requirements.

System overall test
Test the final acquired system, test whether the overall operating environment of the entire system is appropriate, and whether it will affect the operation of each functional module of the system to achieve the desired effect.

Confirmation test
This test is mainly performed by the user. The user applies the system to the actual running environment, designs each level of users, and then applies the various business needs of the user to understand whether the system runs smoothly and whether there is a problem.
Once the system is ready to be used, steps of using the system can be shared via intranet and users can re-read the steps again [19].

Conclusion
Along with the state's increasing emphasis on education, domestic basic education, vocational education, and higher education have higher requirements for teaching quality, and teachers and students have an increasing demand for individualised curriculum. Efficient class scheduling is a difficult problem for educators. At present, many algorithms for course scheduling mainly use graph-based traversal algorithms, greedy algorithms, backtracking methods, and probability-based random algorithms for class scheduling problems, and have achieved certain effects, but with the increasing demand for personalisation, scheduling. As the scale increasing, these algorithms find it increasingly difficult to meet the real-world needs. In this study, we achieved good results by studying the design of the scheduling system based on genetic variation calculations and finally testing the execution speed of the system and verifying the accuracy of the results.