Administrative class course arrangement method based on improved genetic algorithm
Patent Information
- Application Number
- CN202511421403.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-30
- Publication Date
- 2026-01-16
Smart Images

Figure CN121353035A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of educational management technology, and in particular to an administrative class scheduling method based on an improved genetic algorithm. Background Technology
[0002] In the daily teaching management of primary and secondary schools, class scheduling is the most common scenario and a highly challenging task. With the continuous expansion of education, the increasing complexity of the curriculum, and the diversification of teaching resources, traditional manual scheduling methods have revealed many drawbacks. On the one hand, manual scheduling requires a significant amount of time and energy. Faced with numerous courses, classes, teachers, and varying teaching requirements, schedulers are prone to oversights, leading to scheduling conflicts. For example, a single teacher might be assigned to teach multiple classes at the same time, or the same class might be assigned multiple courses at the same time. Furthermore, scheduling must consider the rationality of course arrangements and the individualized needs of different teachers. On the other hand, when teaching needs change, such as the temporary addition of courses, adjustments to teacher assignments, or changes in classroom resources, manually adjusting the scheduling plan is extremely difficult, inefficient, and unable to quickly adapt to new requirements.
[0003] While some existing automatic scheduling algorithms have alleviated the pressure of manual scheduling to some extent, they still have shortcomings. For example, when simple genetic algorithms are applied to scheduling problems, the randomness of the initial population makes them prone to getting stuck in local optima, resulting in a non-global optimum and failing to fully utilize teaching resources. At the same time, the convergence speed of the algorithms is slow, and the computation time is too long when processing large-scale administrative class scheduling data, which cannot meet the timeliness requirements of actual teaching management. Summary of the Invention
[0004] To address the aforementioned issues, this invention provides an administrative class scheduling method based on an improved genetic algorithm, which enhances the utilization rate of teaching resources, the rationality of teaching task allocation, and better meets teachers' personalized teaching needs.
[0005] To achieve the above objectives, the technical solution adopted by the present invention is as follows:
[0006] An administrative class scheduling method based on an improved genetic algorithm includes the following steps:
[0007] S1. Collect class information, course information, teacher information, class hour information, and teaching tasks to obtain teaching data;
[0008] S2. Based on the teaching data, the scheduling information of each course is encoded to obtain a scheduling gene sequence. According to the importance of the course, the scheduling gene sequence is constructed into an initial population, and each individual in the initial population represents a scheduling scheme.
[0009] S3. Calculate the initial fitness value of each individual in the initial population to statistically analyze the number of curriculum conflicts and the rationality index of curriculum distribution;
[0010] S4. Perform genetic operations iteratively on the data from step S3, and obtain a temporary population through elite retention and roulette wheel selection strategies during the iteration process. The temporary population prioritizes conflicting segments through a chromosome gene conflict strategy and introduces adaptive mutation probability during the iteration process.
[0011] S5. When the genetic operation iteration reaches the preset maximum number of iterations, the iteration is terminated, or the optimal fitness of the population no longer changes after several consecutive generations, and the resource utilization and course conflict elimination criteria are met, the algorithm is considered to have converged, and the individual with the highest fitness in the current population is selected as the final course scheduling scheme output.
[0012] Furthermore, in step S2, the gene positions of the scheduling gene sequence are represented as teaching task number, course number, class number, and teacher number.
[0013] Furthermore, in step S2, core courses in the scheduling gene sequence are prioritized according to heuristic rules and the importance of the courses to generate a portion of initial scheduling individuals. The remaining scheduling gene sequences are randomly generated to form the remaining individuals. The initial scheduling individuals and the remaining individuals form an initial population, and the population size is set to N.
[0014] Further, in step S3, the initial fitness value of an individual is calculated using a fitness function:
[0015] Formula (1)
[0016] in, The fitness function; For the first The number of conflicts with a hard constraint. This indicates no conflict. Indicates the number of conflicts; For the first Deviation of a soft constraint; Hard constraints The weights; soft constraints The weights; For balance coefficient, ,and This is to reinforce the priority of hard constraints.
[0017] Furthermore, in step S4, during each generation of evolution, the top M individuals with the highest fitness are elite individuals, and the remaining NM individuals are surplus individuals. The elite individuals are copied to the next generation population. The surplus individuals are selected according to the roulette wheel selection method, based on the proportion of individual fitness to total fitness. The surplus individuals are sampled and selected to the next generation population. The individuals obtained by retaining the elite individuals and the roulette wheel selection are used to form a temporary population for crossover and mutation operations.
[0018] Furthermore, for Hard constraints on conflict-free individuals, through soft constraints Determine the priority of retention;
[0019] The probabilistic strategy of the roulette wheel selection method is as follows: by imposing high-weight penalties through hard constraints, the fitness values of individuals with hard conflicts are reduced; by imposing soft-weight constraints, the fitness values of individuals without conflicts are made to form a gradient.
[0020] Furthermore, in step S4, the method for handling conflicting segments using the chromosome gene conflict strategy is as follows:
[0021] S4.1 For each individual in the temporary population, construct an array structure with the same length as the individual's chromosome, and initialize the default value to 0 for each individual.
[0022] S4.2 When calculating the constraints of an individual, if the corresponding chromosome segment combination conflicts with other combinations and does not meet the constraints, the value of the corresponding combination position in the corresponding data structure is 1, to indicate that the corresponding position of the individual chromosome does not meet the constraints.
[0023] Furthermore, in step S4, when the population gets stuck in a local optimum, the mutation probability is dynamically adjusted according to the evolutionary state of the population, and the opportunity to introduce new genes is increased to escape the local optimum.
[0024] The beneficial effects of this invention are:
[0025] Firstly, encoding the course scheduling information clearly links the key elements of the scheduling problem, facilitating subsequent algorithmic operations. Through a selection strategy combining initial population generation, elite retention, and roulette wheel selection, along with an adaptive parameter adjustment mechanism, the algorithm's efficiency is significantly improved. It can process large-scale administrative class scheduling data in a short time, quickly generating scheduling plans to meet the school's timely scheduling needs before the start of a new semester or when adjusting teaching plans. The algorithm mimics the biological evolutionary process, continuously iterating to find the optimal scheduling solution. Compared to traditional deterministic algorithms, it has stronger intelligent search capabilities, uncovering better scheduling combinations that are difficult for humans to discover, thus improving the overall level of teaching management. Attached Figure Description
[0026] Figure 1 This is a flowchart of a preferred embodiment of the present invention.
[0027] Figure 2 This is a flowchart of the genetic operation iteration of a preferred embodiment of the present invention.
[0028] Figure 3 This is a chromosome gene design diagram of a preferred embodiment of the present invention.
[0029] Figure 4 This is a design diagram of a chromosome gene conflict fragment recording array according to a preferred embodiment of the present invention. Detailed Implementation
[0030] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0031] It should be noted that when a component is described as "fixed to" another component, it can be directly on the other component or may have a component in between. When a component is considered "connected to" another component, it can be directly connected to the other component or may have a component in between. When a component is considered "set on" another component, it can be directly set on the other component or may have a component in between. The terms "vertical," "horizontal," "left," "right," and similar expressions used in this document are for illustrative purposes only.
[0032] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein in the specification of this invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0033] Please also see Figures 1 to 4 A preferred embodiment of the present invention provides an administrative class scheduling method based on an improved genetic algorithm, comprising the following steps:
[0034] S1. Collect class information, course information, teacher information, class hour information, and teaching tasks to obtain teaching data.
[0035] S2. Based on the teaching data, the scheduling information of each course is encoded to obtain the scheduling gene sequence. According to the importance of the course, the scheduling gene sequence is constructed into an initial population, and each individual in the initial population represents a scheduling scheme.
[0036] In step S2, the gene positions of the scheduling gene sequence are represented as teaching task number, course number, class number, and teacher number. This embodiment adopts a multi-dimensional encoding method based on teaching task, course type, class, teacher, and time slice to uniformly encode each course, its corresponding teaching class, teacher, and time slice, constructing a complete scheduling gene sequence. This encoding method can clearly link the various key elements in the scheduling problem, facilitating subsequent algorithm operations.
[0037] In step S2, core courses in the scheduling gene sequence are prioritized based on heuristic rules and the importance of the courses to generate a portion of initial scheduling individuals. The remaining scheduling gene sequences are randomly generated to form the remaining individuals. The initial scheduling individuals and the remaining individuals form the initial population, and the population size is set to N.
[0038] This embodiment, based on school teaching practices such as prioritizing major courses like Chinese during the morning's prime time, first constructs some relatively reasonable scheduling schemes as the foundation of the initial population. Then, it supplements the remaining individuals through random generation to ensure that the initial population has a certain degree of diversity, including both empirically-based optimal solutions and random individuals exploring unknown spaces.
[0039] S3. Calculate the initial fitness value of each individual in the initial population to statistically analyze the number of curriculum conflicts and the rationality of curriculum distribution.
[0040] In step S3, the initial fitness value of an individual is calculated using the fitness function:
[0041] Formula (1)
[0042] in, The fitness function; For the first The number of conflicts with a hard constraint. This indicates no conflict. Indicates the number of conflicts; For the first Deviation from soft constraints, such as insufficient daily frequency of core subjects or excessive physical education classes, etc. The smaller the value, the better; Hard constraints The weight, Much larger ,like This ensures that the negative impact of hard constraint conflicts on fitness is far greater than that of soft constraints. soft constraints The weight, It can be dynamically adjusted according to the needs of the school; for example, key schools can increase the weight of the continuity of core subjects. For balance coefficient, ,and This is to reinforce the priority of hard constraints.
[0043] The fitness function in this embodiment is a core indicator for evaluating the quality of each chromosome in the scheduling scheme population. Its design directly affects the algorithm's search efficiency for the optimal solution and the practicality of the scheduling results. This invention's fitness function, tailored to the specific characteristics of administrative class scheduling scenarios, combines the inviolability of hard constraints with the need for flexible optimization of soft constraints, constructing a multi-factor weighted fusion evaluation model.
[0044] In this embodiment of the course scheduling problem, hard constraints are the bottom line for ensuring teaching order, such as the absence of course conflicts; soft constraints are key to improving teaching quality, such as the rationality of course distribution; therefore, the fitness function must satisfy:
[0045] Hard constraint priority: Hard constraint conflicts directly render the course scheduling scheme invalid, and must be strictly satisfied through high-weight penalties;
[0046] Soft constraint flexibility: Soft constraints dynamically adjust their weights according to the needs of the teaching scenario, balancing the personalized needs of different schools;
[0047] Synergy with genetic manipulation: Fitness values should be able to effectively distinguish between good and bad schemes, providing accurate selection criteria for subsequent elite preservation and roulette wheel selection strategies, and avoiding the loss of high-quality genes or interference from low-quality genes.
[0048] S4. Perform genetic operations iteratively on the data from step S3, and obtain a temporary population through elite retention and roulette wheel selection strategies during the iteration process. The temporary population prioritizes conflicting segments through a chromosome gene conflict strategy and introduces adaptive mutation probability during the iteration process.
[0049] In step S4, during each generation of evolution, the top M individuals with the highest fitness are designated as elite individuals, and the remaining NM individuals are designated as surplus individuals. Elite individuals are replicated to the next generation to ensure that superior genes are not lost. The surplus individuals are selected using a roulette wheel selection method, with their selection probability determined by their fitness ratio to the total fitness. These surplus individuals are then sampled and selected for the next generation, increasing the probability that individuals with high fitness will be selected for crossover and mutation operations. This ensures that the population evolves towards the optimal direction while maintaining a certain level of diversity. The individuals retained as elites and those obtained through roulette wheel selection form a temporary population for crossover and mutation operations.
[0050] for Hard constraints on conflict-free individuals, through soft constraints The priority of retention is determined; this embodiment uses soft constraints to further refine the merits, ensuring that elite individuals are not only legitimate but also of high quality. For example, in two conflict-free course scheduling schemes, individuals with a more balanced distribution of core subjects are selected based on their merits. Smaller sizes are preferred.
[0051] The probabilistic strategy of the roulette wheel selection algorithm is as follows: High-weight hard constraints reduce the fitness values of individuals in hard conflict; soft constraints create a gradient in the fitness values of conflict-free individuals. In this embodiment, high-weight hard constraints significantly reduce the fitness values of individuals in hard conflict, bringing their probability of selection by the roulette wheel close to zero, thus preventing inferior genes from entering the crossover and mutation phase. Simultaneously, the weight differences in soft constraints create a gradient in the fitness values of conflict-free individuals, ensuring that the roulette wheel can effectively select superior individuals for evolution.
[0052] In step S4, the method for handling conflicting segments using the chromosome gene conflict strategy is as follows:
[0053] S4.1 For each individual in the temporary population, construct an array structure with the same length as the individual's chromosome, and initialize all arrays to 0. Figure 3 The image shown is a diagram of chromosome gene design.
[0054] S4.2 When calculating the constraints of an individual, if the corresponding chromosome segment combination conflicts with other combinations and does not meet the constraints, the value of the corresponding combination position in the corresponding data structure is 1, indicating that the corresponding position of the individual chromosome does not meet the constraints. Figure 4 The diagram shown is a design diagram of a chromosome gene conflict fragment recording array.
[0055] In this embodiment, conflicting segments are prioritized during population iteration, as they will inevitably undergo exchange and mutation. This ensures that the number of conflicts continuously decreases during the iteration process, accelerating the algorithm's convergence.
[0056] In step S4, when the population gets stuck in a local optimum, the mutation probability is dynamically adjusted according to the evolutionary state of the population, and the opportunity to introduce new genes is increased in order to escape the local optimum.
[0057] In the early stages of the algorithm, when the population diversity is relatively rich, a low mutation probability is adopted to prevent excessive disruption of the existing optimal scheduling structure. As the evolution progresses, if it is found that the population is trapped in a local optimum, that is, the fitness no longer improves after several consecutive generations, an adaptive mutation probability is introduced to gradually increase the mutation probability, increase the chance of introducing new genes, and prompt the algorithm to break out of the local optimum and explore a better scheduling scheme.
[0058] S5. When the genetic operation iteration reaches the preset maximum number of iterations, the iteration is terminated, or the optimal fitness of the population no longer changes after several consecutive generations, and the resource utilization and course conflict elimination criteria are met, the algorithm is considered to have converged, and the individual with the highest fitness in the current population is selected as the final course scheduling scheme output.
[0059] In this embodiment, the maximum number of iterations is set to MaxGen. The iteration process terminates when the number of generations the algorithm runs reaches MaxGen; or when the optimal fitness of the population no longer changes for several consecutive generations and the fitness reaches a set threshold. The iteration terminates when either of these conditions is met, and the individual with the highest fitness is selected for decoding and output. Furthermore, the scheduling results are visualized for easy viewing and adjustment by teaching administrators, and ultimately applied to the school's actual teaching arrangements.
Claims
1. An administrative class scheduling method based on an improved genetic algorithm, characterized in that, The method comprises the following steps: S1. Collecting class information, course information, teacher information, class hour information and teaching tasks to obtain teaching data; S2. Encoding the arrangement information of each course according to the teaching data to obtain an arrangement gene sequence, and constructing the arrangement gene sequence into an initial population according to the importance of the courses, wherein each individual in the initial population represents an arrangement scheme; S3. Calculating the initial fitness value of each individual in the initial population to count the number of course conflicts and the rationality index of course distribution; S4. Iterating the genetic operation of the data of step S3, and obtaining a temporary population through the strategies of elite reservation and roulette wheel selection in the iteration process, and preferentially processing the conflict fragments in the temporary population through the chromosome gene conflict strategy, and introducing a self-adaptive mutation probability; S5. When the genetic operation iteration reaches a preset maximum number of iterations, or the optimal fitness of the population of consecutive generations no longer changes, and the resource utilization rate and the course conflict elimination standard are met, it is determined that the algorithm converges, and the individual with the highest fitness in the current population is selected as the final arrangement scheme output.
2. The administrative class scheduling method based on the improved genetic algorithm according to claim 1, characterized in that: In step S2, the gene position of the arrangement gene sequence is represented as a teaching task number, a course number, a class number and a teacher number.
3. The administrative class scheduling method based on the improved genetic algorithm according to claim 1, characterized in that: In step S2, a part of the initial arrangement individuals are generated by preferentially arranging the core courses in the arrangement gene sequence through heuristic rules and according to the importance of the courses, and the remaining arrangement gene sequence generates the remaining individuals through random generation; the initial population is composed of the initial arrangement individuals and the remaining individuals, and the population size is set to N.
4. The administrative class scheduling method based on the improved genetic algorithm according to claim 3, characterized in that: In step S3, the initial fitness value of the individual is calculated through the fitness function: Equation (1) wherein, is a fitness function; is a number of conflicts of the jth hard constraint, denotes no conflict, denotes a number of conflicts; is a deviation degree of the jth soft constraint, is a weight of the jth hard constraint, is a weight of the jth soft constraint, is a balance coefficient, , and to strengthen the priority of the hard constraint. 5. The administrative class scheduling method based on the improved genetic algorithm according to claim 4, characterized in that: In step S4, in the evolution process of each generation, the first M individuals with the highest fitness are elite individuals, and the remaining N-M individuals are remaining individuals; the elite individuals are copied to the next generation population, the remaining individuals are selected according to the roulette wheel selection method, the probability of being selected is determined according to the proportion of the individual fitness in the total fitness, the remaining individuals are sampled and selected to the next generation population, and the individuals obtained through the elite reservation and roulette wheel selection form a temporary population for crossover and mutation operations.
6. The administrative class scheduling method based on the improved genetic algorithm according to claim 5, characterized in that: For hard constraint conflict-free individuals of soft constraints are judged by the priority of the reserved ; The probability strategy of the roulette wheel selection method is: reducing the individual fitness value of the hard conflict through the hard constraint high weight penalty; and forming a gradient among the fitness values of the non-conflict individuals through the soft constraint weight.
7. The administrative class scheduling method based on improved genetic algorithm according to claim 1, characterized in that: In step S4, the method for processing the conflict fragments by the chromosome gene conflict strategy is: S4.1 In each individual of the temporary population, an array structure with the same length as the chromosome of the individual is constructed, and the initial default value is 0; S4.2 When calculating the constraint condition limit of the individual, if the corresponding chromosome fragment combination has a conflict with other combinations and does not meet the constraint condition, the value of the corresponding combination position of the corresponding data structure is 1, indicating that the corresponding position of the individual chromosome does not meet the constraint condition.
8. The administrative class scheduling method based on improved genetic algorithm according to claim 1, characterized in that: In step S4, when the population falls into a local optimum, the mutation probability is dynamically adjusted according to the evolution state of the population, and the opportunity of introducing new genes is increased to jump out of the local optimum.