Intelligent course arrangement method and device, electronic equipment and storage medium

CN122529931APending Publication Date: 2026-08-07WUHAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
WUHAN UNIV
Filing Date
2026-04-14
Publication Date
2026-08-07

AI Technical Summary

Technical Problem

[0005]本申请提供一种智能排课方法、装置、电子设备及存储介质,以解决相关技术难以有效处理教师以自然语言填写的个性化授课偏好,导致排课结果无法兼顾硬约束满足与个性化需求的问题,实现了非结构化偏好的可计算化与排课冲突的自动消解

Benefits of technology

若述已排课程重新分配成功,则将所述当前课程组排入所述被释放时段,否则,将所述已排课程恢复排入所述被释放时段,并将所述当前课程组的当前目标时段记入预设黑名单。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122529931A_ABST
    Figure CN122529931A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of education management, in particular to an intelligent class scheduling method and device, electronic equipment and a storage medium. The method comprises the following steps: obtaining teaching management basic data and teacher questionnaire data, converting the teacher questionnaire data into a constraint model and initializing a global resource state; grouping and sorting the teaching classes to be scheduled, combining the global resource state and the constraint model to determine target time periods of each course group; sequentially scheduling each course group into a class schedule according to the sorting, readjusting the class schedule and rescheduling if there is a conflict, until all the course groups have no conflict, and finally generating a final class schedule. Thus, by converting the teacher questionnaire data into a calculable constraint model and combining the global resource state to make a time period decision, and by readjusting the already scheduled class schedule to eliminate the conflict when there is a conflict, the problem that related technologies cannot effectively handle the personalized teaching preferences filled in by teachers in natural language, resulting in the problem that the class scheduling result cannot take into account the satisfaction of hard constraints and personalized needs, is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of educational management technology, and in particular to an intelligent scheduling method, device, electronic device and storage medium. Background Technology

[0002] Course scheduling is a core component of academic affairs management in universities. Essentially, it is a complex combinatorial optimization problem with multiple constraints, multiple objectives, and highly dynamic characteristics. With the expansion of higher education and the increasing demand for personalized teaching, course scheduling faces a complex interplay between maximizing resource utilization and satisfying the personalized needs of teachers and students.

[0003] Among related technologies, scheduling schemes can be mainly divided into the following categories: First, scheduling systems based on traditional heuristic algorithms, such as genetic algorithms, tabu search, or simulated annealing algorithms; second, scheduling software based on centralized rule-driven scheduling, which relies on a pre-set complex rule base and manually configures a large number of parameters to achieve scheduling; and third, attempts based on generative artificial intelligence, which use large language models to directly generate scheduling schemes.

[0004] However, the above methods are all ineffective in handling teachers' personalized teaching preferences filled in by natural language, resulting in scheduling results that cannot balance hard constraints and personalized needs, which urgently need to be addressed. Summary of the Invention

[0005] This application provides an intelligent scheduling method, device, electronic device, and storage medium to solve the problem that related technologies have difficulty in effectively handling personalized teaching preferences filled in by teachers in natural language, resulting in scheduling results that cannot simultaneously meet hard constraints and personalized needs. It realizes the computability of unstructured preferences and the automatic resolution of scheduling conflicts.

[0006] To achieve the above objectives, the first aspect of this application proposes an intelligent course scheduling method, comprising the following steps: Acquire basic academic affairs data and teacher questionnaire data, convert the teacher demand text in the teacher questionnaire data into a constraint model, and initialize the global resource state based on the basic academic affairs data; Based on the aforementioned basic academic data, the classes to be scheduled are grouped into multiple course groups, and the scheduling order of each course group is determined based on the global resource status. Based on the global resource status, a set of candidate time periods for each course group is determined, and based on the global resource status and the constraint model, the target time period for the corresponding course group is determined from the set of candidate time periods for each course group. Based on the target time period for each course group, each course group is sequentially placed into the target timetable according to the scheduling order of each course group. If there is a scheduling conflict in the current course group, the target timetable is adjusted and the current course group is re-placed, until there is no scheduling conflict in each course group, and the final timetable is generated.

[0007] According to one embodiment of this application, the step of converting the teacher demand text in the teacher questionnaire data into a constraint model includes: Identify structured time descriptions and unstructured natural language constraints in the teacher's requirements text; The structured time description is mapped to a standard time period in a preset set of standard time periods, and the unstructured natural language constraints are semantically parsed to generate structured constraint data. The standard time period and the structured constraint data are merged, and a constraint vector with teacher-course as the key is generated based on the merging result. The constraint model is obtained based on the constraint vector, wherein each dimension of the constraint vector corresponds one-to-one with each standard time period.

[0008] According to one embodiment of this application, determining the scheduling order of each course group based on the global resource status includes: Determine the number of available time slots and the number of time slots already occupied by teachers for each course group in the global resource status; Based on the number of available time slots and the number of time slots already occupied by teachers, calculate the resource shortage level for each course group; The scheduling order for each course group is determined based on the resource availability of each course group.

[0009] According to one embodiment of this application, determining the candidate time slot set for each course group based on the global resource status includes: For each course group, obtain the set of available time slots for at least one teaching class corresponding to the current course group in the global resource state; Calculate the intersection of the available time slots for each teaching class; If the intersection is not an empty set, the intersection is used as the candidate time slot set for the current course group; otherwise, the union of the available time slot sets for each teaching class is calculated, and the union is used as the candidate time slot set for the current course group.

[0010] According to one embodiment of this application, determining the target time period for a corresponding course group from the candidate time period set for each course group based on the global resource state and the constraint model includes: The resource occupancy of each candidate time period in the candidate time period set is evaluated based on the global resource status, and the degree of matching between each candidate time period and the constraints in the constraint model is evaluated based on the constraint model. Based on the resource usage and the matching degree, the target time period for the current course group is determined from the candidate time period set.

[0011] According to one embodiment of this application, adjusting the target course schedule includes: Identify scheduled courses that conflict with the current course group; Remove the scheduled courses from the target timetable to obtain the freed time slots, and reallocate available time slots for the scheduled courses; If the reassigned courses are successfully reassigned, the current course group will be placed in the released time slot; otherwise, the scheduled courses will be restored to the released time slot, and the current target time slot of the current course group will be added to a preset blacklist.

[0012] The intelligent scheduling method proposed in this application obtains basic academic data and teacher questionnaire data, transforms the teacher questionnaire data into a constraint model, and initializes the global resource state. The teaching classes to be scheduled are grouped and sorted, and the target time slots for each course group are determined by combining the global resource state and the constraint model. Each course group is then sequentially added to the timetable according to the sorting order. If conflicts exist, the timetable is adjusted and re-added until all course groups are conflict-free, generating the final timetable. Thus, by transforming teacher questionnaire data into a computable constraint model and combining it with the global resource state for time slot decisions, and resolving conflicts by adjusting the already scheduled timetable when conflicts arise, this method solves the problem that related technologies struggle to effectively handle personalized teaching preferences filled in by teachers in natural language, leading to scheduling results that cannot simultaneously satisfy hard constraints and personalized needs. It achieves the computability of unstructured preferences and the automatic resolution of scheduling conflicts.

[0013] To achieve the above objectives, a second aspect of this application provides an intelligent scheduling device, comprising: The first processing module is used to acquire basic academic affairs data and teacher questionnaire data, convert the teacher demand text in the teacher questionnaire data into a constraint model, and initialize the global resource state based on the basic academic affairs data. The second processing module is used to group the teaching classes to be scheduled based on the academic affairs basic data to obtain multiple course groups, and to determine the scheduling order of each course group based on the global resource status. The determination module is used to determine the candidate time period set for each course group based on the global resource status, and to determine the target time period for the corresponding course group from the candidate time period set for each course group based on the global resource status and the constraint model. The generation module is used to sequentially arrange each course group into the target timetable based on the target time period of each course group and the scheduling order of each course group. If there is a scheduling conflict in the current course group, the target timetable is adjusted and the current course group is re-arranged, until there is no scheduling conflict in each course group, and the final timetable is generated.

[0014] According to one embodiment of this application, the first processing module, which converts the teacher demand text in the teacher questionnaire data into a constraint model, is specifically used for: Identify structured time descriptions and unstructured natural language constraints in the teacher's requirements text; The structured time description is mapped to a standard time period in a preset set of standard time periods, and the unstructured natural language constraints are semantically parsed to generate structured constraint data. The standard time period and the structured constraint data are merged, and a constraint vector with teacher-course as the key is generated based on the merging result. The constraint model is obtained based on the constraint vector, wherein each dimension of the constraint vector corresponds one-to-one with each standard time period.

[0015] According to one embodiment of this application, the second processing module, in determining the scheduling order of each course group based on the global resource status, is specifically used for: Determine the number of available time slots and the number of time slots already occupied by teachers for each course group in the global resource status; Based on the number of available time slots and the number of time slots already occupied by teachers, calculate the resource shortage level for each course group; The scheduling order for each course group is determined based on the resource availability of each course group.

[0016] According to one embodiment of this application, the step of determining the candidate time slot set for each course group based on the global resource status, wherein the determining module is specifically used for: For each course group, obtain the set of available time slots for at least one teaching class corresponding to the current course group in the global resource state; Calculate the intersection of the available time slots for each teaching class; If the intersection is not an empty set, the intersection is used as the candidate time slot set for the current course group; otherwise, the union of the available time slot sets for each teaching class is calculated, and the union is used as the candidate time slot set for the current course group.

[0017] According to one embodiment of this application, the step of determining the target time period for a corresponding course group from the candidate time period set for each course group based on the global resource state and the constraint model, the determining module is specifically used for: The resource occupancy of each candidate time period in the candidate time period set is evaluated based on the global resource status, and the degree of matching between each candidate time period and the constraints in the constraint model is evaluated based on the constraint model. Based on the resource usage and the matching degree, the target time period for the current course group is determined from the candidate time period set.

[0018] According to one embodiment of this application, the generation module for adjusting the target course schedule is specifically used for: Identify scheduled courses that conflict with the current course group; Remove the scheduled courses from the target timetable to obtain the freed time slots, and reallocate available time slots for the scheduled courses; If the reassigned courses are successfully reassigned, the current course group will be placed in the released time slot; otherwise, the scheduled courses will be restored to the released time slot, and the current target time slot of the current course group will be added to a preset blacklist.

[0019] The intelligent scheduling device proposed in this application acquires basic academic data and teacher questionnaire data, transforms the teacher questionnaire data into a constraint model, and initializes the global resource state. It then groups and sorts the classes to be scheduled, determining the target time slots for each course group based on the global resource state and the constraint model. Each course group is then sequentially added to the timetable according to the sorting order. If conflicts exist, the timetable is adjusted and re-added until all course groups are conflict-free, generating the final timetable. Thus, by transforming teacher questionnaire data into a computable constraint model and combining it with the global resource state for time slot decisions, and resolving scheduling conflicts by adjusting the existing timetable, this device solves the problem that related technologies struggle to effectively handle personalized teaching preferences filled in by teachers in natural language, leading to scheduling results that cannot simultaneously satisfy hard constraints and personalized needs. It achieves the computability of unstructured preferences and the automatic resolution of scheduling conflicts.

[0020] To achieve the above objectives, a third aspect of this application provides an electronic device, including: a memory, a processor, and a computer program stored in the memory and capable of running on the processor, wherein the processor executes the program to implement the intelligent scheduling method as described in the above embodiments.

[0021] To achieve the above objectives, a fourth aspect of this application provides a computer-readable storage medium having a computer program stored thereon, which is executed by a processor to implement the intelligent scheduling method as described in the above embodiments.

[0022] To achieve the above objectives, a fifth aspect of this application provides a computer program product comprising a computer program that, when executed by a processor, is used to implement the intelligent scheduling method as described in the above embodiments.

[0023] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description

[0024] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein: Figure 1 This is a flowchart of an intelligent course scheduling method provided according to an embodiment of this application; Figure 2 This is a schematic diagram of the logical architecture of an intelligent scheduling system according to an embodiment of this application; Figure 3 This is a schematic diagram of an unstructured constraint modeling process based on a questionnaire agent according to an embodiment of this application; Figure 4 This is a schematic diagram of the controlled decision-making and tool invocation mechanism of a scheduling agent according to an embodiment of this application; Figure 5 This is a block diagram of an intelligent scheduling device provided according to an embodiment of this application; Figure 6 This is a schematic diagram of the structure of an electronic device provided according to an embodiment of this application. Detailed Implementation

[0025] The embodiments of this application are described in detail below. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this application, and should not be construed as limiting this application.

[0026] The intelligent scheduling method, apparatus, electronic device, and storage medium according to embodiments of this application are described below with reference to the accompanying drawings.

[0027] Figure 1 This is a flowchart of an embodiment of the intelligent course scheduling method of this application.

[0028] Before introducing the intelligent scheduling method proposed in the embodiments of this application, let's briefly introduce the relevant technical background.

[0029] In related technologies, course scheduling schemes are mainly divided into the following categories, but all of them have obvious limitations: (1) Course scheduling system based on traditional heuristic algorithms: Traditional automated time scheduling often employs genetic algorithms, tabu search, or simulated annealing. These methods demonstrate good logical rigor in handling hard constraints such as no classroom conflicts and no teacher overlap. However, their weakness lies in their inflexibility in handling soft constraints, namely, teachers' personalized preferences. Teachers' preferences typically contain a large amount of unstructured information, such as avoiding scheduling classes on Wednesday afternoons due to family reasons or preferring courses to be arranged in consecutive time slots. Traditional algorithms struggle to directly translate this ambiguous natural language into parameters that the algorithm can recognize, resulting in time scheduling outcomes that, while logically valid, lack humanization and flexibility.

[0030] (2) Course scheduling software based on centralized rule-driven approach: Such systems rely on pre-set, complex rule bases and require manual configuration of numerous parameters to schedule courses. Their limitations lie in poor scalability; even minor adjustments to teaching policies or resource allocation often necessitate modifications to the underlying code or a complete refactoring of the rule base, resulting in extremely high maintenance costs. Furthermore, these systems lack intelligent decision-making and global coordination capabilities when faced with sudden scheduling changes, such as the addition or removal of courses.

[0031] (3) Attempts based on generative artificial intelligence (AIGC): In recent years, with the development of Large Language Models (LLMs), methods have begun to emerge that attempt to directly generate course scheduling plans using these models. While LLMs possess excellent natural language understanding capabilities and can capture complex teacher needs, they face two fatal problems in practical applications: illusion and unreliable logic. LLMs are essentially probabilistic text generation, unable to guarantee that the generated results strictly adhere to physical constraints. This often results in illusions such as scheduling within already occupied time slots or fabricating teacher information, rendering the results completely unenforceable. Lack of real-time state awareness: Traditional generative schemes typically treat course scheduling as a one-off task. The model cannot perceive and update the global resource status of the academic affairs system in real time during the generation process, making it difficult to handle large-scale, multi-dimensional resource scheduling conflicts.

[0032] Based on the above problems, this application proposes an intelligent scheduling method. By converting teacher questionnaire data into a computable constraint model and combining it with the global resource status to make time-slot decisions, the method resolves conflicts by adjusting the existing schedule when conflicts occur. This solves the problem that related technologies cannot effectively handle personalized teaching preferences filled in by teachers in natural language, resulting in scheduling results that cannot simultaneously meet hard constraints and personalized needs. This method realizes the computability of unstructured preferences and the automatic resolution of scheduling conflicts.

[0033] Furthermore, the intelligent scheduling method proposed in this application also relates to an intelligent scheduling system. For example... Figure 2 As shown, the system can be logically divided into five functional levels, and the composition, hierarchical design, and connection relationships of each module are as follows: (1) Data interaction and display layer (i.e., interaction module): This layer can be represented as a comprehensive academic affairs interaction website. As the only interface between the system and users (i.e., teachers and academic affairs management personnel), it is responsible for the release, completion and collection of teacher questionnaires, supports the export of structured data (such as Excel / JSON), and displays the final course scheduling results and visualization charts. This layer can transmit the original questionnaire text and basic course plan data to the backend global status management component.

[0034] (2) Semantic perception and constraint modeling layer (i.e., perception module). This layer can be represented as a questionnaire agent, used to extract teacher preference information from the website or exported questionnaire records, and output two types of boundary conditions: one is a directly structured time preference constraint table; the other is a standard time period constraint mask vector used for deterministic backoff and scoring. At the same time, this layer can retain the original text of other teacher needs (i.e., other_raw) as input for subsequent decision-making modules to perform cross-course semantic reasoning.

[0035] (3) Logical Reasoning and Decision-Making Center Layer (i.e., Decision Module): This layer can be represented as the scheduling agent, serving as the central hub of the entire system and building upon the thinking chain capabilities of the large language model. This layer does not directly participate in modifying the underlying data. Instead, it analyzes the current scheduling task (output by the perception module) and the real-time resource status (provided by the data center), outputting a series of atomic tool call instructions. It is responsible for handling global conflicts, determining scheduling priorities, and adjusting the decision path in real time based on the execution results fed back by the tools. When scheduling each course group, this layer can input the global status (teacher occupancy, grade-major occupancy, and already scheduled timetable) along with the structured preferences, original text, and candidate time slots output by the perception module into the large language model. It then performs strategy reasoning through controlled prompt words and outputs the selected time slots in strict JSON format. This layer does not directly write to the timetable but instead calls the tool functions of the execution module to complete the allocation.

[0036] (4) Atomic Execution and Utility Function Layer (i.e., Execution Module): This layer can be represented as a business logic utility library, containing a series of utility functions implemented with hard code, including querying resource usage, calculating legal candidate time periods, executing allocation writes, performing conflict repair and retrospective adjustments, scoring timetables and outputting violations. As a relay between the decision-making module and the data center, this layer can ensure that any timetable writes pass hard constraint verification, thus avoiding model illusions from a mechanism perspective.

[0037] (5) Dynamic state management layer (i.e. data center), which can be represented as a global state management component, is used to maintain resource data models such as teacher occupancy table, grade-major occupancy table, and teaching class failure time blacklist, and updates the state synchronously after the tool function is executed, providing a unique, real-time and accurate context for the decision module, and eliminating scheduling conflicts caused by information lag from the underlying mechanism.

[0038] In other words, this intelligent scheduling system can achieve university scheduling based on the collaboration of two intelligent agents (a questionnaire agent and a scheduling agent). Furthermore, the system does not directly use a large language model as a timetable generator, but rather places it within a controlled tool invocation framework. It achieves an executable, interpretable, and iteratively optimized scheduling process through a combination of rule constraints, structured states, intelligent decision-making, execution verification, and feedback optimization. Its core logic lies in constructing a closed loop of perception-decision-execution-feedback optimization: First, the questionnaire agent performs structured extraction and constraint vectorization modeling of teacher preferences; second, the scheduling agent performs group scheduling driven by the global resource state; then, the execution module completes hard constraint verification and writing; the scoring module outputs scores and violations; the feedback module generates executable suggestions based on the timetable, scores, and violations, and determines whether convergence has occurred; the system then fine-tunes and re-scores until a deliverable local optimum is reached, finally outputting the timetable and visualization results. This closed loop can deeply couple the semantic understanding capabilities of large language models with the logical rigor of programmatic tools, thereby enabling progressive decision-making and automated generation from natural language requirements to legitimate course scheduling results.

[0039] For ease of understanding, the intelligent scheduling method proposed in the embodiments of this application will be described in detail below.

[0040] For example, such as Figure 1 As shown, this intelligent scheduling method includes the following steps: In step S101, basic academic affairs data and teacher questionnaire data are obtained, and the teacher demand text in the teacher questionnaire data is converted into a constraint model. The global resource state is initialized based on the basic academic affairs data.

[0041] It is understood that, in this embodiment of the application, the basic academic affairs data refers to the course plan (i.e., a list of all courses to be offered in a semester and teaching arrangement information such as the instructor, grade, major, and class hours for each course), teaching class identifier (i.e., a unique identification number for each teaching class in the system), grade, major, instructor, and other structured teaching arrangement information, which is the basic input for course scheduling. Teacher questionnaire data refers to the teaching preference information filled in by teachers through the questionnaire system, including preferred scheduling times, undesirable scheduling times, and other teaching needs described in natural language. Teacher questionnaire data can be directly exported from the website database or exported as Excel or JSON format for archiving. To achieve repeatability and auditability, the system can generate a timestamped JSON file for each run of the structured questionnaire results, for example, parsed_questionnaire_YYYYMMDD_HHMMSS.json. Examples of the original fields for teacher questionnaire data are as follows: Teacher Name, Course ID, Course Name, Grade, Major, Preferred Scheduling Time (preferred), Unavailable Scheduling Time (unavailable), and Other Needs (other). Examples of basic academic data fields are as follows: Teaching Class Identifier (section_id), Course ID (course_id), Course Name (course_name), Teacher (teacher), Grade (grade), Major (major). Teacher requirement text refers to personal teaching preferences expressed in natural language, such as "Courses should be concentrated as much as possible, not spread across multiple weekdays," "Lab classes should be scheduled for the afternoon of the same day as the theory class," "Do not schedule classes on Friday afternoons," etc. The constraint model refers to converting the teaching preferences filled in by teachers in natural language into a structured constraint representation that can be recognized and computed by a computer, including constraint types such as prohibition, neutrality, or priority for specific time periods. Global resource status refers to the real-time record of the occupancy of all restricted resources (such as teacher time, grade-major time) during the scheduling process, used to determine scheduling conflicts and assist in decision-making.

[0042] Specifically, the system can set up a front-end questionnaire website as a data interaction and display layer to collect basic academic data and teacher questionnaire data. This layer can be implemented using the Flask web application framework, configuring the port, database path, proxy forwarding, and security parameters through environment variables, using SQLite (a lightweight database) as lightweight persistent storage, and employing WAL (Write-Ahead Logging) mode to improve concurrent read and write stability. After collection, the above data serves as the raw input for subsequent processing. Since teacher demand texts (i.e., descriptions of teacher preferences) are usually unstructured natural language text that cannot be directly recognized and processed by scheduling algorithms, the system can transform these texts into computable constraint models. Simultaneously, the system can initialize the global resource status based on the basic academic data, i.e., establish resource records such as teacher occupancy tables and grade-major occupancy tables, to track the occupancy of various resources in real time during the scheduling process, providing accurate status basis for subsequent scheduling decisions.

[0043] As one possible implementation, in some embodiments, the teacher demand text in the teacher questionnaire data is transformed into a constraint model, including: identifying structured time descriptions and unstructured natural language constraints in the teacher demand text; mapping the structured time descriptions to standard time periods in a preset set of standard time periods, and performing semantic parsing on the unstructured natural language constraints to generate structured constraint data; merging the standard time periods and the structured constraint data, and generating a constraint vector with teacher-course as the key based on the merging result, and obtaining a constraint model based on the constraint vector, wherein each dimension of the constraint vector corresponds one-to-one with each standard time period.

[0044] It is understood that, in this embodiment, structured time descriptions refer to time expressions in teacher questionnaire data that can be directly identified through rule matching, such as descriptions with clear time references like "Monday 3-5 periods," "Wednesday morning," and "Friday afternoon." Unstructured natural language constraints refer to complex time preferences in teacher questionnaires that cannot be directly identified through rule matching and require semantic understanding to grasp their meaning, such as "Don't schedule two courses consecutively," "Try to schedule them in the morning," and "Schedule lab classes in the afternoon of the same day as theory classes." The preset standard time slot set refers to a set of fixed time units predefined by the system, discretizing the week's teaching time into several standard time slots, each corresponding to a specific week and period. Standard time slots refer to specific units in the preset standard time slot set, such as "Monday 3-5 periods" and "Wednesday 6-8 periods." Structured constraint data refers to data in a unified format that can be directly processed by a computer after semantic parsing of unstructured natural language constraints. Constraint vectors refer to numerical vectors indexed by teachers and courses, with each dimension of the vector corresponding to a standard time slot, and different values ​​representing the type of constraint the teacher imposes on that time slot.

[0045] Specifically, the system can use a questionnaire agent to extract teacher requirement text from teacher questionnaire data using large language models (such as DeepSeek or Qwen series), and transform the teacher requirement text into machine-computable constraint representations and store them in the global state management component. This agent can be implemented using a hybrid approach of rule extraction, large language model semantic enhancement, and time mask vectorization. First, the system can predefine a set of standard teaching time periods (i.e., a preset set of standard time periods), discretizing the legal scheduling time periods within a week into a standard set of length 20. For example, each day from Monday to Friday corresponds to four standard segments: periods 1-2, periods 3-5, periods 6-8, and periods 10-12. Then, the questionnaire agent can extract explicit times (such as "Wednesday, periods 3-5") and typical descriptions (such as "morning," "afternoon," and "evening") from the teacher questionnaire data based on rules and limited semantic parsing. Specifically, the questionnaire agent can parse explicit time period descriptions in the questionnaire based on regular expressions, keyword lists, and time phrase mapping rules, and map the parsing results to standard time periods in a preset set of standard time periods. For example, "Wednesday, periods 3-5" can be directly mapped to the corresponding standard time period, and "morning" can be mapped to specific time periods such as "periods 1-2" or "periods 3-5". The parsing and mapping results are normalized into standard tokens to generate structured records (i.e., structured time descriptions). For complex natural language constraints that cannot be fully expressed by rules alone, such as descriptions like "theoretical classes are scheduled in the morning, and experimental classes are scheduled in the afternoon of the same day", "two classes should not be scheduled consecutively", and "courses should be concentrated on the same day as much as possible", the system can call a large language model for semantic parsing through a preset Prompt. This process can be based on the ChatOpenAI (chat-style OpenAI, a chat model interface) model interface of LangChain (a language chain, an open-source large language model application development framework). It creates model instances through the unified LLMFactory.create() factory method, supporting both local Ollam (an open-source local large language model deployment tool) and Bailian Cloud model deployment modes, and uniformly sets temperature parameters (e.g., temperature=0.3) to improve output stability. Questionnaire semantic parsing requires the model to output in strict JSON format: preferred_slots, unavailable_slots, notes, and extra (i.e., structured constraint data; preferred_slots are preferred time periods, unavailable_slots are prohibited time periods, notes are summarized structured descriptions, and extra is a further structured additional semantic field, typically used to store information that cannot be directly converted into standard time periods but is suitable for Boolean expression), transforming the originally ambiguous natural language description into computable information with a unified format.Meanwhile, the system can also create a cache file for the semantic parsing results, using the input text and model fingerprint to generate the cache key, thereby avoiding repeated triggering of the large language model for the same questionnaire.

[0046] Secondly, the system can use vectorization processing (such as `_vectorize_constraints`, a function (or method)) to map structured preference data (i.e., the merged result of combining standard time slots and structured constraint data) into 20-dimensional constraint vectors, namely `teacher_course_constraint_vectors` (i.e., teacher-course-constraint-vector). Each dimension corresponds to a standard time slot and uses a three-value code: -1 represents prohibition or strong dislike of scheduling, 0 represents neutral, and +1 represents preference. For example, a teacher named Zhang filled in the following preferences for the course "Computer Networks": "Do not schedule on Monday morning" (i.e., periods 1-2 and 3-5 on Monday are not allowed); "Preferably scheduled on Wednesday afternoon" (i.e., periods 6-8 on Wednesday); other times are also acceptable. Then, the constraint vectors for the course "Computer Networks" by teacher Zhang are shown in Table 1:

[0047] Therefore, the final 20-dimensional constraint vector can be represented as: [-1,-1,0,0,0,0,0,0,0,0,+1,0,0,0,0,0,0,0,0,0].

[0048] The constraint vector is stored with teacher-course as the key, i.e., teacher_course_constraint_vectors are generated, which are used for candidate scoring, deterministic backoff and preference satisfaction analysis in subsequent time periods.

[0049] The prompts from the scheduling agent integrate a complete summary of the scoring rules, the meaning of the constraints, and the natural language original text of the "other_raw" section (referring to the raw text of the teacher's other needs) in the questionnaire. When selecting and fine-tuning time slots, the scheduling agent can integrate the following information: the violation list output by the scoring module, the preferences encoded in the 20-dimensional constraint vector, and the original text of the teacher's other needs in the questionnaire. This forms a two-layer constraint modeling system: a rule vector (i.e., the 20-dimensional constraint vector) plus a layer of semantically understandable raw text (for the large language model to understand semantically). After the above processing, the system obtains a constraint vector table and a structured preference library that includes both prohibited time periods and soft constraint preference time periods, providing a unified input boundary for all subsequent decisions.

[0050] Furthermore, the system can maintain two types of preference structures simultaneously: one is a course-level teacher preference structure, which stores a teacher's fine-grained preferences for a specific course; the other is a teacher-level aggregated preference structure, which is aggregated from course-level preferences and used for feedback summaries, compatibility, and global preference analysis. Additionally, the system can retain the `other_raw` field for the scheduling agent to read directly during the inference phase.

[0051] The system's global state management component is used to initialize the global resource state. Specifically, the system can create a singleton state object ScheduledState (a data structure that stores all resource usage and course arrangement information during the scheduling process) based on the academic affairs basic data to save the unique and trusted context throughout the scheduling process (i.e., the unique and authoritative state data source that all modules depend on during the scheduling process). It can then perform unified reading and writing through the get_current_state (which reads data from the current global resource state) and set_current_state (which updates data from the global resource state) interfaces, thereby completing environment modeling and one-time initialization.

[0052] The state object (i.e., ScheduledState) can load all the key elements involved in scheduling, including but not limited to the following three categories: (1) Resource status: including teacher availability table (teacher_availability), which records the time resource availability of each teacher; grade-major availability table (grade_major_availability), which records the time availability of students in each grade and major; assigned schedule table (assigned_schedule), which records the teaching classes and their time slots that have been successfully scheduled; and section-blocked slots blacklist, which records the course-time slot combinations that have been attempted to be scheduled but failed. (2) Constraints and preferences: including course-level constraint vector library (teacher_course_constraint_vectors) obtained from questionnaire analysis, which is a set of constraint vectors with teacher-course as the key; course-level teacher preference structure (teacher_course_preferences), which stores the fine-grained preferences of a teacher for a certain course; and teacher-level aggregated preference structure (teacher_preferences), which is composed of course-level preferences and represents the overall summary preferences of a teacher. When making scheduling decisions, the system can prioritize the use of course-level preference structures; when conducting feedback analysis and global summarization, the system can use teacher-level aggregation preference structures. (3) Task context: includes a list of pending teaching classes (pending_sections), which records teaching classes that have not yet been scheduled; a compact view of scheduled courses (schedule_compact), which is used for subsequent feedback analysis; and auxiliary information such as scheduling feedback history and learning tips.

[0053] The global state management component can be implemented as a dynamic resource matrix: teacher-level time resource usage is recorded, grade-major-level time usage is recorded, and course-level scheduling status, failed periods, and combined class information are recorded. Both the intelligent agents (i.e., the questionnaire agent and the scheduling agent) and utility functions make decisions and perform validations based on this state object, ensuring that all modules access the same real-time state data during the scheduling process. This avoids state drift in multi-threaded or multi-round inference, thus providing a unique and continuously updated dynamic resource matrix for subsequent agent inference.

[0054] In step S102, the teaching classes to be scheduled are grouped based on the basic academic data to obtain multiple course groups, and the scheduling order of each course group is determined based on the global resource status.

[0055] It is understood that, in this embodiment, "teaching classes to be scheduled" refers to all teaching classes that need to be scheduled within a semester. Each teaching class corresponds to a specific class for a course, for example, "Computer Networking - Information Security - Class 01". A course group refers to the set of courses obtained by grouping the teaching classes to be scheduled according to three fields: grade, course name, and major. Teaching classes within the same course group have the same grade, course name, and major; for example, "2023-Computer Networking - Information Security" is a course group. The scheduling order refers to the order in which each course group is processed during the scheduling process.

[0056] Specifically, for all teaching tasks in a semester, the system can first group and sort teaching classes at the atomic execution and utility function layer to construct batch-processable scheduling units. That is, all classes to be scheduled (including combined classes across majors) are divided according to three fields: grade, course name, and major. Classes with the same grade, course name, and major are grouped into the same course group. For example, the "Computer Networks" course for the 2023 Information Security major, regardless of the number of parallel classes under this course, is considered the same course group. For combined classes across majors (i.e., the same course offered to different majors), the system can also group them into the same course group. Through grouping, the system can aggregate previously scattered individual teaching classes into several course groups. This facilitates unified time slot decisions within the same course group and allows for the reuse of already scheduled time slots when classes are combined across majors.

[0057] Based on this, the system can determine the scheduling order of each course group according to the global resource status. The global resource status records the time usage of each teacher and the time usage of each grade and major, and sorts multiple course groups accordingly.

[0058] It should be noted that the system can set up a special class merging mechanism for multiple teaching classes with the same teacher, grade, and course name. This mechanism consists of the following three parts: (1) Class merging set construction: The system no longer restricts class merging to course groups within the same major, but constructs a real class merging set group_section_ids according to the same grade, the same teacher, and the same course name. This construction method can support two class merging scenarios at the same time: one is class merging of courses with the same name within the same major, and the other is class merging of courses with the same name by the same teacher in different majors. (2) Soft class merging time slot transfer: If a course group of a certain major has selected a scheduling time slot, the system can record that time slot as a reference time slot for the same grade, the same teacher, and the same course name. When processing course groups of other majors in the future, the system will increase the priority of the reference time slot in the candidate time slot set, and if necessary, re-inject it into the candidate list to ensure that subsequent course groups across majors can use the same time slot as much as possible. (3) Execution layer class merging exemption: When calling the assignment write tool assign_class_func, if the allowed class merging conflict flag is set to true (i.e., allow_group_conflict=True) and a real class merging set is passed in, the execution layer can further determine whether the conflicting objects meet the following conditions when a conflict is found in the same time period: they belong to the same real class merging set, the course names are consistent, and they belong to the same course and teacher scenario that allows sharing. If the above conditions are met, writing in the same time period is allowed, and it is not judged as a teacher conflict. In the student-side conflict verification, student conflicts are exempted only in the group sharing scenario where students are in the same grade, major, and have the same course name, thereby ensuring that the class merging permission does not violate the real student time mutual exclusion constraint.

[0059] As one possible implementation, in some embodiments, the scheduling order of each course group is determined based on the global resource status, including: determining the number of available time slots and the number of time slots already occupied by teachers for each course group in the global resource status; calculating the resource stress level of each course group based on the number of available time slots and the number of time slots already occupied by teachers; and determining the scheduling order of each course group according to the resource stress level of each course group.

[0060] It is understood that, in this embodiment, the number of available time slots refers to the total number of scheduling time slots available to all classes in a course group in the global resource state. This number is affected by factors such as teacher time occupation, grade-major time occupation, and the blacklist of failed time slots. The fewer available time slots, the more scheduling restrictions the course group faces. The number of time slots already occupied by teachers refers to the number of standard time slots that a course group's instructors have already occupied by other courses in the global resource state. This number reflects the busyness of teachers' time resources. The more time slots already occupied, the fewer free time slots teachers have available, and the more scheduling restrictions the course group faces. Resource scarcity refers to a quantitative indicator used to measure the difficulty of scheduling a course group. The fewer available time slots or the more time slots already occupied by teachers, the higher the resource scarcity, indicating that the course group should be given priority.

[0061] Specifically, without relying on complex mathematical programming solvers, the system can use heuristic indicators to assess the conflict sensitivity and resource scarcity of each course group. These indicators can include: the number of available time slots (i.e., the number of candidate time slots), the number of time slots already occupied by teachers (i.e., the existing class hours and their distribution involving teachers), and whether the course is a critical course or a laboratory course. Based on these indicators, the system can calculate the resource stress level of each course group. Generally, course groups with fewer available time slots have more limited scheduling options and higher resource stress levels; course groups with more time slots already occupied by teachers have scarcer teacher time resources and higher resource stress levels; furthermore, critical courses or laboratory courses typically have higher scheduling priority, and their resource stress levels are correspondingly higher.

[0062] Finally, the system can determine the scheduling order based on the resource scarcity of each course group, prioritizing them according to their resource scarcity level from highest to lowest. The system can prioritize scheduling courses with the most scarce resources and the highest conflict sensitivity, preventing low-priority courses from occupying key teachers or key time slots, leaving high-priority courses without available time slots later. Course groups with higher resource scarcity are given higher priority in scheduling, thus avoiding situations where resource-scarce courses are unable to schedule due to subsequent courses taking up limited available time slots.

[0063] In step S103, a set of candidate time periods for each course group is determined based on the global resource status, and the target time period for the corresponding course group is determined from the set of candidate time periods for each course group based on the global resource status and constraint model.

[0064] It is understood that, in the embodiments of this application, the candidate time slot set refers to the set of all possible standard time slots for scheduling generated by the system for a certain course group. This set is generated based on the global resource status, excluding time slots that are already occupied or conflicting, and represents the range of scheduling times that the course group can choose. The target time slot refers to the specific time slot that the system finally selects for the course group from the candidate time slot set. This time slot is determined after comprehensively considering the global resource status (such as whether teachers are available and whether students are available) and the constraint model (such as teacher preferences).

[0065] Specifically, the system queries the teacher occupancy table, grade-major occupancy table, and failed time slot blacklist in the current global resource status, filtering out all unoccupied standard time slots not on the blacklist as the candidate time slot set for the course group. This set represents all possible scheduling time options for the course group under the current resource constraints. Subsequently, based on the global resource status and constraint model, the system determines the target time slot for each course group from the candidate time slot set. When making decisions, the system assesses the resource occupancy of each candidate time slot based on the global resource status to ensure that the selected time slot does not have teacher or student conflicts; on the other hand, it assesses the degree of matching between each candidate time slot and the teacher scheduling constraints based on the constraint model, prioritizing time slots that conform to teacher preferences and do not violate prohibitive constraints. Through the above comprehensive evaluation, the system selects an optimal target time slot for each course group from the candidate time slot set as the final scheduling time for that course group.

[0066] As one possible implementation, in some embodiments, the candidate time slot set for each course group is determined based on the global resource state, including: for each course group, obtaining the available time slot set of at least one teaching class corresponding to the current course group in the global resource state; calculating the intersection of the available time slot sets of each teaching class; if the intersection is not an empty set, using the intersection as the candidate time slot set for the current course group; otherwise, calculating the union of the available time slot sets of each teaching class, and using the union as the candidate time slot set for the current course group.

[0067] Specifically, the system can adopt a decision-making and execution separation architecture for controlled decision-making and tool invocation. The scheduling agent is only responsible for reasoning and decision description, and all modifications to the timetable are completed through tool functions to form a complete closed loop. First, the system can query the teacher occupancy table, grade-major occupancy table, and failed time slot blacklist in the current global resource status, filtering out all standard time slots that are not occupied and are not on the blacklist. Based on this, the scheduling agent can call the query_teacher_schedule_func to obtain the current occupancy status of all relevant teachers for each class in the current course group to be scheduled, and call the candidate time slot calculation tool get_available_slots_func. Taking into account teacher occupancy, grade-major occupancy, and the failed time slot blacklist, it calculates the set of available time slots for each class in the course group to be scheduled. The system can first calculate the intersection of the available time slots for each teaching class to obtain the time slots that are available to all teaching classes, so that multiple teaching classes in the group can be scheduled in the same time slot. If the intersection is empty, the system will calculate the union, which means that there are no time slots that are available to all students. The system still provides a larger candidate space for the large language model, first selects the most reasonable time slot at the course group level, and then allocates it to each class. Fine-tuning or backtracking is performed when necessary.

[0068] After generating the candidate time slot set, the system can further employ load balancing technology to sort the candidate time slots. Specifically, the system can statistically analyze the distribution of the number of courses for the same grade on each weekday in the current timetable, that is, count how many classes have been scheduled each day from Monday to Friday. Then, according to the principle of prioritizing weekdays with fewer courses, the candidate time slots are sorted, and time slots on weekdays with fewer courses are selected as scheduling times. This avoids excessive concentration of courses on a single day (e.g., Monday is fully booked while Friday is free), and achieves a balanced distribution of the timetable across weekdays.

[0069] Through the above processing, the system obtains a set of candidate time slots for the course group, which represents all possible scheduling time options for the course group under the current resource constraints.

[0070] As one possible implementation, in some embodiments, the target time period for each course group is determined from the candidate time period set for each course group based on the global resource status and constraint model. This includes: evaluating the resource occupancy of each candidate time period in the candidate time period set based on the global resource status, and evaluating the degree of matching between each candidate time period and the constraints in the constraint model based on the constraint model; and determining the target time period for the current course group from the candidate time period set based on the resource occupancy and the degree of matching.

[0071] It is understood that, in this embodiment, resource occupancy refers to whether the candidate time slot has been occupied by other courses. Specifically, this includes whether teacher time is occupied (i.e., whether the teacher already has other courses scheduled for that time slot) and whether grade-major time is occupied (i.e., whether students in that grade or major already have other courses scheduled for that time slot). Resource occupancy reflects the feasibility of the candidate time slot at the hard constraint level. Constraints refer to the set of rules formed after converting teachers' natural language preferences into computable constraints, including prohibited time slots (times when teachers explicitly do not want to schedule classes), preferred time slots (times when teachers want to prioritize scheduling classes), and neutral time slots (times when teachers have no special requirements). The degree of matching refers to the extent to which the candidate time slot satisfies the constraints in the constraint model, reflecting the degree to which the candidate time slot meets the personalized needs of teachers at the soft constraint level.

[0072] Specifically, the system can query the teacher occupancy table and grade-major occupancy table in the global resource status to determine whether there are teacher time conflicts (i.e., whether the teacher has already scheduled other courses in that time slot) or student time conflicts (i.e., whether the grade or major has already scheduled other courses in that time slot). Simultaneously, the system can determine which type of constraint each candidate time slot belongs to based on the prohibited, preferred, and neutral time slots defined in the constraint model: if the candidate time slot belongs to a preferred time slot, the matching degree is high; if it belongs to a prohibited time slot, the matching degree is low; if it belongs to a neutral time slot, the matching degree is moderate. In other words, by assessing the resource occupancy of each candidate time slot based on the global resource status, it can ensure that the selected time slots do not have teacher or student conflicts; by assessing the matching degree between each candidate time slot and the teacher scheduling constraints based on the constraint model, time slots that meet teacher preferences and do not violate prohibited constraints can be prioritized.

[0073] Building upon this foundation, the scheduling agent simultaneously retrieves the following information from the prompt: the candidate slot set `candidate_slots`, the historical scheduling distribution of the corresponding teachers, a summary of scoring rules, and a list of historical violations. Based on this information, the agent makes slot decisions, reasoning to determine the most suitable time slot as the selected time slot `selected_time`. For scenarios with weak reliance on large language models or where the model is unavailable, the system can also provide a deterministic backoff selector based on a 20-dimensional constraint mask. This selector scores candidate slots according to the constraint vector without calling the model at all. Subsequently, the system determines the target time slot for the current course group from the candidate slot set based on the resource usage and matching degree of each candidate slot. The system prioritizes candidate slots with good resource usage (i.e., no conflicts) and high matching degree (meeting teacher preferences) as the target time slot, and uses this target time slot as the final scheduling time for the course group. This ensures that hard constraints are met while maximizing the satisfaction of teacher preferences.

[0074] It should be noted that the scheduling agent, as the core module for time slot selection, does not directly output a complete timetable. Instead, it is a tool-calling agent built on the LangChain framework. Its core technology is implemented as follows: (1) The system can adopt the LangChain agent architecture and build the running framework of the scheduling agent through the following components: using ChatPromptTemplate to build the system prompt template; using MessagesPlaceholder to maintain the intermediate operation record of the agent; using StructuredTool.from_function() to encapsulate the scheduling capability into a structured tool; calling create_tool_calling_agent() to build an agent that supports tool calls; and having AgentExecutor responsible for executing the agent call chain. The above components together constitute the running architecture of the scheduling agent based on LangChain, so that the large language model does not directly modify the state, but selects the time slot, calls the tool, and receives tool feedback under the constraints of prompt words. (2) The system can adopt Prompt engineering technology to explicitly write the following constraints into the scheduling prompt: core hard constraint rules, standard time format, morning / afternoon / evening period mapping rules; candidate time periods must be precisely selected from the candidate time period set; the writing tool is not allowed to be called, only the selected time period is allowed to be output; it is necessary to make a judgment by comprehensively considering the global timetable, the teacher's already scheduled timetable, the group aggregation preference and the teacher's preference. This prompt design belongs to controlled output Prompt engineering, and its goal is to restrict the large language model to a group-level time period selector. (3) The system can adopt a tool-calling decision method. The scheduling agent runs in the LangChain framework and queries the environment information through tools, such as querying the teacher's scheduling tool and obtaining the available time period tool. The scheduling agent finally only outputs the selected time period in a JSON format similar to the following: {"selected_time":"Wednesday, period 3-5"}, and then the execution layer completes the actual writing. This "large language model decision, tool execution writing" approach can avoid the model illusion directly polluting the timetable state from the architecture perspective. (4) The system can adopt deterministic backoff technology. When the LangChain agent is unavailable, the model output is illegal, or it fails to output a legal result within the candidate time period set, the system can perform deterministic backoff through the deterministic backoff selector. This method can directly read the 20-dimensional constraint vector corresponding to the course, score each time period in the candidate time period set, and select the optimal value, forming a hybrid decision architecture of "large language model first, rule as a fallback".

[0075] In step S104, based on the target time period of each course group, each course group is sequentially scheduled into the target timetable according to the scheduling order of each course group. If there is a scheduling conflict in the current course group, the target timetable is adjusted and the course groups are re-scheduled until there is no scheduling conflict in each course group, and the final timetable is generated.

[0076] It is understood that, in this embodiment of the application, scheduling conflict refers to the resource occupation conflict between a course group and an already scheduled course when the course group is scheduled into the target timetable. This mainly includes teacher time conflicts (the same teacher already has other courses scheduled at the same time) and student time conflicts (the same grade or major already has other courses scheduled at the same time). The target timetable refers to the dynamically updated course schedule record during the scheduling process. It is initially empty and is updated once after each course group is successfully scheduled, eventually evolving into the final timetable.

[0077] Specifically, the system processes course groups one by one according to the scheduling order. For each course group, the system attempts to schedule it into the current target timetable based on its target time slot. If the target time slot of the course group does not conflict with any already scheduled courses (i.e., the teacher is available during that time slot, and there are no other courses for the same grade and major during that time slot), the course group can be directly written into the target timetable, and the occupancy status of the relevant resources can be updated. If the current course group has scheduling conflicts, i.e., its target time slot conflicts with one or more already scheduled courses in terms of teacher or student time, the system can adjust the current target timetable. The purpose of the adjustment is to release conflicting time slots by rearranging already scheduled courses, freeing up scheduling space for the current course group. After the adjustment is completed, the system re-attempts to schedule the current course group into the adjusted target timetable. The system repeats the above process, processing each course group in the scheduling order, and repeatedly adjusting and retrying for course groups with conflicts, until all course groups are successfully scheduled and there are no scheduling conflicts. At this point, the target timetable is the final timetable.

[0078] As one possible implementation method, in some embodiments, the target timetable is adjusted, including: identifying scheduled courses that conflict with the current course group; removing the scheduled courses from the target timetable to obtain the released time slots, and reallocating available time slots for the scheduled courses; if the reallocation of the scheduled courses is successful, the current course group is scheduled into the released time slots; otherwise, the scheduled courses are restored to the released time slots, and the current target time slot of the current course group is added to a preset blacklist.

[0079] It is understood that, in this embodiment, the released time slot refers to the scheduling time slot originally occupied by the course after it has been removed from the target timetable. At this time, the time slot becomes idle and can be scheduled for other courses. The preset blacklist refers to a storage structure used to record scheduling failures, preventing the system from repeatedly trying the same course-time slot combination in subsequent scheduling processes, thereby improving scheduling efficiency.

[0080] Specifically, after determining the target time slot for each course group, the system enters the atomic instruction issuance and physical verification phase. The scheduling agent does not directly modify the timetable data, but instead sends atomic instructions to the execution module. For example, it calls the allocation writing tool `assign_class_func` for a single course and the conflict resolution tool `resolve_conflict_func` for conflicting courses. Upon receiving the instruction, the execution module's allocation writing tool performs a secondary verification strictly according to physical constraints before writing, including: checking whether the teacher's time slot is already occupied, checking whether there are already conflicting courses in the same grade and major, checking whether the length of the class session exceeds the upper limit, and checking whether the combined class rule is violated. If the verification passes, the execution module updates the global states of the assigned_schedule (i.e., the target timetable), the teacher availability table `teacher_availability`, and the grade-major availability table `grade_major_availability`, and returns a success result. If any verification fails, the writing is rejected, and the failure reason is returned in a structured form (such as teacher time conflict, grade and major student time conflict, single course session exceeding the upper limit, etc.) for the scheduling agent to refer to in the next step of reasoning.

[0081] When the execution module returns conflict information or the scoring module detects a serious violation, the system enters the conflict resolution and backtracking phase, using the conflict resolution tool `resolve_conflict_func` to resolve conflicts. First, the system can identify scheduled courses that conflict with the current course group. That is, when the system attempts to schedule the current course group into the target timetable, if it finds that the target time slot conflicts with a scheduled course in terms of teacher or student time, it identifies that scheduled course as the conflicting party. Based on this, the system can perform feedback-based logical refactoring. The scheduling agent does not blindly retry the same instruction but combines the structured error information returned by the tool with the violation list output by the scoring module to identify the preceding courses involved in the conflict chain, such as a set of courses where the same teacher is occupied by multiple courses in the same time slot. Subsequently, the system can use augmented backtracking driven by the conflict resolution tool to fine-tune individual conflicts using the conflict resolution tool. That is, the system can remove the scheduled course from the target timetable, thereby obtaining the released time slot (i.e., the time slot originally occupied by the scheduled course). Without disrupting the overall structure of the scheduled courses, the system can invoke a valid time calculation tool to recalculate the set of feasible time slots for the conflicting scheduled courses under the current global resource state. It then selects candidate time slots from this set that simultaneously satisfy teacher preference and avoidance preference, and calls the assignment writing tool `assign_class_func` to attempt to rewrite the conflicting scheduled courses into these candidate time slots. After successful migration, the target course is placed in the original conflicting time slot (i.e., the released time slot), realizing an augmented path of "release-rescheduling." That is, it does not pursue a complete global recalculation but rather seeks feasible repair paths in the local state space. For courses already in the target timetable, the tool first completely removes their records from the teacher occupancy table and the grade-major occupancy table, and then attempts to reschedule across multiple time slots. If multiple reassignment attempts fail, the system restores the scheduled course to the released time slot (i.e., rolls back to the state before adjustment), ensuring state consistency. Finally, the system can employ a failure blacklist and search pruning strategy. After multiple failed attempts, the system adds a course-time combination to the failed time slot blacklist. This combination is then directly removed during subsequent candidate time slot calculations, thus avoiding exponential repeated attempts and improving the convergence speed of the backtracking phase.

[0082] Through the aforementioned heuristic backtracking and state consistency control, the system can make small-scale local adjustments to some scheduled courses with acceptable search complexity, gradually resolving global conflicts.

[0083] It's important to note that after each complete round of batch scheduling, the system can enter the scoring and feedback optimization phase. First, the system can call the scoring tool `calculate_score_raw` to uniformly score the current timetable (i.e., the target timetable), outputting a final score `final_score` along with detailed scores forming `details`, and simultaneously generating a complete violation list. This violation list can include various violations such as teacher conflicts, grade-major conflicts, unmet preferences, and illegal time formats. Subsequently, the feedback module `analyze_schedule_with_llm` can call the model instance generated by `LLMFactory.create()`, taking the current scoring results, violation list, compact timetable representation, and teacher preference summary as input, and calling a large language model for analysis, generating the following outputs: an overall evaluation (including strengths and weaknesses), a list of actionable suggestions for the execution layer `action_items`, and a flag indicating whether to stop iteration `stop_optimization`. These actionable suggestions can clearly indicate which conflicting courses should be prioritized for fixing, which teacher preferences can be improved by changing time slots, etc., directly driving the next round of fine-tuning and conflict resolution. The system can write the list of executable suggestions generated in each round of feedback into the learning file `schedule_learning.json`, which can then be re-injected into the agent's input as global prompts during subsequent runtimes. This forms a context-based continuous learning mechanism based on file persistence, rather than learning through parameter fine-tuning. In other words, this stage employs a closed-loop optimization method combining rule scoring, large language model feedback, and local fine-tuning. The system first identifies two types of courses requiring optimization: courses scheduled during teacher-avoided time slots and courses with priority preferences that are not being met. Subsequently, the system attempts to fine-tune by re-acquiring candidate time slots and locally changing time slots, and re-scoring after each round of fine-tuning. The optimization loop is controlled by the stop iteration flag `stop_optimization` output by the feedback module, rather than simply relying on a preset fixed score threshold, thus ensuring that the termination condition aligns with the actual room for improvement in the timetable.

[0084] After each round of scoring, the main scheduling process allows for targeted fine-tuning of a small number of sensitive courses based on the list of actionable suggestions returned by the feedback module, followed by re-scoring. The iteration termination condition is based on the stop-iteration flag output by the feedback module; that is, the loop only ends when the large language model deems continued iteration unlikely to significantly improve the timetable quality, no longer relying on a preset fixed score threshold. After the iteration ends, the system performs a global consistency check: comparing the number of scheduled courses with the number of already scheduled course entries to ensure course quantity completeness; confirming the absence of hard violations such as teacher conflicts, conflicts within the same grade and major, and illegal time slots. Finally, the system outputs the final timetable, which not only covers all teaching tasks but also allows for the generation of timetable images by grade or major through the visualization module. Simultaneously, the system retains key decision-making evidence and improvement suggestions from this iteration in logs and learning files, enabling traceability and sustainable learning in the scheduling process.

[0085] To facilitate a better understanding of the intelligent scheduling method proposed in the embodiments of this application by those skilled in the art, the following is combined with... Figures 2-3 Further details are provided.

[0086] like Figure 2 As shown, this embodiment details the process of transforming teacher preferences into machine logic. The questionnaire agent performs "structured modeling and backoff vectorization" on the teacher questionnaire, and its output simultaneously serves two types of capabilities of the scheduling agent: (i) the structured preferences and original text constraints required for LLM decision-making; (ii) deterministic backoff when LLM is unavailable or the output is invalid.

[0087] The questionnaire agent processing flow includes the following steps: 1) Extract rules from preferred / unavailable text to identify standard time period tokens (such as "Wednesday, Periods 6-8") and generalized tokens (such as "morning / afternoon / evening" or "week X morning"). 2) When necessary, invoke the semantic parsing large language model to parse the natural language preferences into strict JSON (see Appendix A for details), and write the parsing results to the disk cache to avoid repeatedly calling the large language model for the same text; 3) Generate a standard time-period mask vector (i.e., a 20-dimensional constraint vector) for the structured preferences to express the strength of soft and hard constraints; 4) Retain the original text of other_raw (other requirements original text) (e.g., "two courses on the same day, one in the morning and one in the afternoon") for semantic reasoning during the scheduling phase.

[0088] (See Appendix A for details: Semantic parsing prompt word template, output JSON Schema, allowed token set and constraint rules.) The intelligent scheduling system creates model instances through LLM Factory (Large Language Model Factory), supporting cloud API or local deployment; the temperature coefficient is set to 0.3 to improve stability; the questionnaire semantic parsing timeout is controlled at 20 seconds; other sampling parameters can use default values ​​or be configured in the examples (see Appendix D for details).

[0089] The constraint vector table contains a structured preference field and a 20-dimensional constraint vector field; -1 indicates prohibition / strong avoidance, where +1 indicates preference and 0 indicates neutrality (see Appendix B for details).

[0090] The system activates the global state management component, loading the course task list and questionnaire constraints into the in-memory state model to establish a resource matrix that can be updated in real time, including: a teacher availability table (teacher_availability); a grade-major availability table (grade_major_availability); a blacklist of failed teaching sessions (section_blocked_slots); and an assigned schedule (assigned_schedule). This state is maintained by a unified state manager, and must be updated synchronously after any allocation tool or conflict resolution tool is executed to ensure the uniqueness of the decision context (see Appendix E: State Table Field Definitions, Update Mechanism, and Singleton Consistency Constraints).

[0091] like Figure 3 As shown, the scheduling agent groups the classes to be scheduled by "grade-course name-major" and aggregates the preferences of multiple teachers within each group to form group-level preference constraints. The system uses heuristic planning for the scheduling order: it prioritizes courses with fewer candidate time slots and higher resource scarcity; it processes groups of courses with the same name taught by the same teacher but across different majors adjacently to use the combined class reference time slot; and it applies a daily load balancing bias based on the grade level to reduce the over-concentration of courses on a single day. The fewer the number of candidate time slots and the more teachers have already occupied them, the higher the scarcity level, and these are prioritized for scheduling; and it processes courses taught by the same teacher but across different majors adjacently to improve the consistency and overall feasibility of combined classes (see Appendix F for details).

[0092] Once the scheduling phase begins, the scheduling agent executes the following process cyclically by course group: 1) Candidate time slot generation: For each class in the group, the system calls the valid time slot calculation tool to obtain the set of available time slots for each class. The system prioritizes the intersection within the group as candidates; if the intersection is empty, the system uses the union, and the decision module performs unified time selection and subsequent fine-tuning to avoid skipping the entire group and causing absences.

[0093] 2) Semantic Decision-Making: The scheduling agent injects the following information into the Prompt: current course group information and candidate slots (candidate_slots), aggregated preferences (aggregated_preferences), per-teacher preferences (per_teacher_preferences, including the original other_raw text), global assigned schedule (global_assigned_schedule_compact), related teacher assigned schedules (teacher_assignments_so_far), and a reference for mapping period to morning / afternoon / evening. The LLM must output strict JSON: {"selected_time":"Week X, Period ab"}, and this time slot must come from the candidate slot list. If the LLM output is invalid or not in the candidates, the system reverts to a deterministic strategy, selecting the preferred time slot from the candidate slot list to ensure execution feasibility. An example of the observation-inference-decision-execution process of the scheduling agent in each group is shown in Appendix G. The key point is that the model does not directly write to the timetable, but only outputs the selected time slot (selected_time), and the writing is completed by the tool for verification.

[0094] 3) Execute the write operation. The system calls the allocation tool to write the course schedule to the teaching classes within the course group. For cases involving the same teacher, the same course, or cross-major situations, the `allow_group_conflict` option is allowed to merge classes simultaneously, avoiding misjudging merged classes as teacher conflicts (see Appendix C for details: tool name, input parameter type, return structure, and call sequence).

[0095] When the execution layer returns a conflict reason or the scoring module detects a serious violation (such as teacher conflict or grade-major conflict), the system triggers a conflict repair and backtracking mechanism: for some failed classes within a course group, the system retry sequentially according to the candidate time slot list; for serious conflicts, the system calls the conflict resolution tool to attempt to rearrange the conflicting courses to free up resource slots. The backtracking depth mainly uses single-step augmentation and multiple candidate retries, combined with a failure blacklist to avoid exponential repetition. Triggering conditions include consecutive failures and the occurrence of serious violations; backtracking strategies include moving the conflicting party, releasing key resource slots, and retrying candidate time slots (see Appendix H for details).

[0096] After completing the initial course scheduling, the system calls the scoring tool to calculate scores and a list of violations, and then enters a feedback iterative optimization loop: 1) Input the current class schedule, scoring details, violations, and historical feedback into the feedback module; 2) The feedback module outputs an overall summary (including advantages and disadvantages), a list of actionable suggestions (action_items), and a flag indicating whether to stop iteration (stop_optimization) (i.e. whether it is believed that continuing iteration will not significantly improve the quality of the timetable). 3) The system performs fine-tuning based on the list of executable suggestions, prioritizing courses that violate preferences and attempting to switch to candidate time slots that meet the preferred (preference) and do not violate the disliked (prohibition constraint); 4) Re-evaluate and proceed to the next round; 5) Terminate when the feedback module outputs stop_optimization=true or the maximum number of iterations is reached.

[0097] Convergence is determined by both stop_optimization and the maximum number of rounds. After iteration terminates, the system performs a final score and consistency check, and outputs the final timetable and visualization results (see Appendix I for details).

[0098] After the course scheduling task is completed, the system outputs the following: the final timetable data structure (including section_id, course_name, teacher, grade, major, and time); the final grades and a list of violations; suggestions and summaries generated by the feedback module for explanation and continuous learning; and a visual timetable image generated by grade and major. By recording the grades, feedback, and fine-tuning logs for each round, the system achieves traceability of the course scheduling process and provides academic administrators with decision-making support and interpretable reports.

[0099] The methods and logic shown in the above embodiments of this application can be implemented by computer program instructions, which can be stored in a computer-readable storage medium and executed by an electronic device to realize the automated scheduling function.

[0100] The contents of Appendix AI are explained below.

[0101] Appendix A: Questionnaire Agent Semantic Parsing Prompt Template and Output JSON Schema A.1 Semantic Parsing Prompt. Explanation: This Prompt is used to parse the natural language of preferred_text / unavailable_text / other_text in the teacher questionnaire into strict JSON and limit the boundaries of output time tokens. In the Prompt, {teacher} / {course} / {preferred_text} / {unavailable_text} / {other_text} and {allowed_slots} are runtime-filled variables, where allowed_slots is the system's standard set of 20 time slots (Monday-Friday × 4 slots).

[0102] You are the "Scheduling Preference Semantic Parser". Please parse the teachers' natural language preferences into strict JSON.

[0103] ##enter -teacher:{teacher} -course:{course} -preferred_text:{preferred_text} -unavailable_text:{unavailable_text} -other_text:{other_text} ##Standard time periods supported by the system (highest priority output) {allowed_slots_json} ## Rules (must be followed) 1) The output must be a **JSON object**, do not output any explanatory text.

[0104] 2) preferred_slots / unavailable_slots can only contain: - One of the above standard time periods, such as "Wednesday, periods 6-8". -Or "morning" / "afternoon" / "evening" - Or "week X morning / afternoon / evening" (e.g., "Friday morning") 3) If negative intentions such as "do not schedule / not scheduled / free / have a meeting / business trip" appear, they should be placed in unavailable_slots.

[0105] 4) If positive intentions such as "hope / try to / prioritize / focus / best" appear, they should be placed in preferred_slots.

[0106] 5) For requirements that cannot be specified down to a specific session, such as "continuous teaching / as close together as possible / concentrated in the morning": -Put into notes - And provide boolean flags in extra (e.g., prefer_contiguous=true, prefer_morning=true). ## Output JSON schema (strictly adhere to field names) { "preferred_slots":[], "unavailable_slots":[], "notes":"", "extra":{} } A.2 Output JSONSchema field definitions preferred_slots:List[str]: A list of preferred time slot tokens unavailable_slots:List[str]: List of tokens for prohibited / avoided time slots notes:str: Requirements that cannot be precisely quantified to the number of sessions (e.g., "as consecutive as possible" or "two courses on the same day"). extra:Dict[str,Any]: Extended field (e.g., prefer_contiguous=true) A.3 Standard Time Slot Set (20-dimensional slot_order) The system's standard time period set is as follows (in order for mask encoding): Monday: 1-2, 3-5, 6-8, 10-12 Tuesday: 1-2, 3-5, 6-8, 10-12 Wednesday: 1-2, 3-5, 6-8, 10-12 Thursday: 1-2, 3-5, 6-8, 10-12 Friday: 1-2, 3-5, 6-8, 10-12 Appendix B: Constraint Vector Table Data Structure, Encoding Method, and Storage B.1 Structured Questionnaire Recording After normalization, each teacher questionnaire record is recommended to be disclosed in the following JSON structure (fields consistent with the current system): teacher:str (required) course_id:str (recommended; if missing, you can use the teaching class / course generation function as a substitute) course:str (required, course name) grade:str (required) major:str (recommended, required) preferred: List[str] (can be empty; the original preferred text has been segmented / extracted) unavailable:List[str] (nullable) other:str (can be empty; "other needs" in the original text) _raw_text:Dict (used to store the rawest text for semantic enhancement) B.2 20-dimensional constraint vectors (teacher_course_constraint_vectors) The system is maintained in state: teacher_course_constraint_vectors:Dict[str,Dict[str,Any]] First-level key: teacher Second-level key: course_name (course name; fuzzy matching tolerance exists) value: must contain at least:

[0107] B.3 Mask Encoding Rules The mask is encoded according to the standard time slot_order[i]: mask[i]=-1: avoid (disclose as hard constraint or strong soft constraint; the system will give strong penalty when deterministic backoff; it will also be filtered due to resource occupation / conflict during candidate calculation) mask[i]=0: neutral; mask[i]=+1: preference (soft constraint, bonus when deterministic backoff) The coverage strategy first applies unavailable (-1), then applies preferred (+1), but preferred must not cover unavailable.

[0108] B.4 Storage and Cache Files output / questionnaire_llm_semantic_cache.json: Questionnaire semantic enhancement result caching (same input text + model fingerprint hit caching, reducing LLM calls). output / schedule_learning.json: Continuous learning storage for scheduling feedback action_items (with hints injected across runs). Appendix C: Utility Function Interface Table The execution module's utility functions are all located in core / tools.py, and the scheduling agent uses these tools to achieve controlled writes. The following provides the field-level interface definitions and failure reason enumerations (based on the current implementation).

[0109] C.1 query_teacher_schedule_func (status query tool) Function name: query_teacher_schedule_func(input_dict)->Dict[str,Any] Input (input_dict)

[0110] Output successful

[0111] Failure returns {"error":"teacher is required"} (teacher is missing). C.2 get_available_slots_func (Valid time slot calculation tool) Function name: get_available_slots_func(input_dict)->Dict[str,Any] Input (input_dict)

[0112] Output successful

[0113] Failure returns {"error":"teacher,grade and section_id are required"} (required fields are missing). The calculation rules are disclosed. A fixed set of standard time slots (Monday to Friday × 4 slots) is then filtered as follows: teacher usage is mutually exclusive across the entire school; grade-major usage is mutually exclusive within the same grade and major; time slots that have failed to be tried before on the section blacklist will not be retried. The slots are then sorted, first by teacher daily workload to avoid overload on any single day, and then by day of the week and starting period.

[0114] C.3 assign_class_func allocation and writing tool Function name: assign_class_func(input_dict)->Dict[str,Any] Input (input_dict)

[0115] The system outputs "success": "True" and writes it to "state.assigned_schedule", updating "teacher_availability" and "grade_major_availability".

[0116] Enumeration of reasons for failure (success=False, reason=...)

[0117] Combined Class Permission: Multiple classes (including classes within the same major and across majors) taught by the same teacher in the same grade should be scheduled to be taught in the same time slot whenever possible. This reduces time fragmentation caused by teachers repeating lessons and improves the compactness of students' schedules and their satisfaction. The system provides a combined class conflict exemption mechanism at the execution layer: when allow_group_conflict=True and the combined class set group_section_ids is passed in, if the conflicting courses detected in the proposed time slot all belong to the combined class set of the same grade, teacher, and course with the same name, and the course name is consistent with the current course, then they are allowed to be written into the time slot at the same time and are not judged as teacher time conflicts. In the conflict verification on the student side, the hard constraint of mutual exclusion within the same grade and major is still followed, but the simultaneous teaching of courses with the same name within the same combined class set is regarded as intra-group sharing, and therefore is not judged as intra-group conflict for students.

[0118] C.4 resolve_conflict_func (conflict resolution / backtracking tool) Function name: resolve_conflict_func(input_dict)->Dict[str,Any] Input (input_dict)

[0119] Output successful

[0120] Output failure {"success":False,"reason":"..."} Common reasons for failure include: incomplete parameters; no available time slots for the current course; no conflicting course found; inability to obtain available time slots for the conflicting course; inability to reallocate time for the conflicting course; inability to allocate time for the current course; and inability to switch to other available time slots (while maintaining the original allocation). The method disclosed is based on augmentative reordering: first, move the conflicting course to a new time slot, then place the target course into the original conflicting time slot. For courses already in the timetable, first remove the occupied slots and then reorder; if this fails, a rollback is performed.

[0121] C.5 calculate_score_raw (scoring and violation output) Function name: calculate_score_raw(input_json_str)->Dict[str,Any] The key fields for inputting JSON are as follows:

[0122] Outputs the final score (`final_score`), statistics on fulfillment / violation / conflict status, and a list of violations (`details`). Violation types include: `teacher_conflict`, `grade_major_conflict`, `invalid_format`, `weekend`, `time_change`, `preference_violated`, and `preference_unsatisfied`. Conflicts involving multiple classes of the same course should be excluded. If the course names are identical for the same teacher and at the same time, it is considered a combined class and not counted as a `teacher_conflict`.

[0123] C.6 Tool Call Overall Timing 1) Obtain questionnaire and course data, and merge the states. 2) For each course group: Calculate candidate time slots, and LLM outputs selected_time or rolls back. 3) Execute assign_class_func to write 4) For severe conflicts: resolve_conflict_func fixes them. 5) Score using `calculate_score_raw`, provide feedback using `analyze_schedule_with_llm`, make minor adjustments, and re-evaluate. 6) Final scoring and output, visualized generation Appendix D: Model Selection, Deployment Mode, and Parameter Settings D.1 Model and Deployment Form The system uses LLMFactory.create() to create model instances uniformly, supporting: cloud APIs, such as the Bailian OpenAI compatible endpoint, and local deployments, such as Ollam.

[0124] D.2 Key Parameters temperature=0.3 is used to reduce randomness and enhance output stability; timeout=20s is used for questionnaire semantic parsing; if the other sampling parameters top_p and max_tokens are not explicitly given, the default values ​​of SDK / platform are used, which can be configured in the example as follows: steady-state output is preferred to avoid long text.

[0125] D.3 Model Selection Criteria The selection of the model mainly considers its ability to understand Chinese semantics and follow instructions, its stability in strict JSON output, and its security when coupled with the tool execution layer.

[0126] Appendix E: Data Model, Update Mechanism, and Consistency Control of the Global State Management Component E.1 State Data Model (SchedulingState) Core fields (subject to system implementation): Raw data and analysis: parsed_questionnaire raw_questionnaire course_sections teacher_course_preferences teacher_preferences teacher_course_constraint_vectors Core status of course scheduling: assigned_schedule: List[Dict] teacher_availability:Dict[str,List[TimeSlot]] grade_major_availability:Dict[str,List[TimeSlot]] section_blocked_slots:Dict[str,List[TimeSlot]] pending_sections Feedback and continuous learning: schedule_feedback_history last_schedule_feedback schedule_feedback_hints schedule_learning_store E.2 Update Mechanism Only execution-level tools are allowed to write to and update assigned_schedule / teacher_availability / grade_major_availability. Conflict resolution tools need to maintain pairs of removed / restored occupants during reordering to ensure state consistency.

[0127] E.3 Consistency Control and Concurrency The state_manager uses a singleton _current_state, which does not allow overwriting by default unless force=True. This mechanism ensures that the decision-making module and the execution module share a unique context, avoiding state drift caused by concurrent writes.

[0128] Appendix F: Rules for Measuring Course Scheduling Order, Conflict Sensitivity, and Resource Scarcity F.1 Grouping and Sorting Principles Grouping key: (grade, course_name, major). Courses with the same name and multiple classes are grouped together; cross-major courses are grouped adjacently for easy reference when combining classes. Sorting preference: Grade first, followed by course, teacher, explicit preference, and major.

[0129] F.2 Conflict Sensitivity The fewer the number of candidate time slots, the higher the sensitivity to conflict, and the higher the priority will be. The more teachers occupy the time slots, the scarcer the resources, and the higher the priority will be. Combined classes (same grade, same subject, same teacher) will prioritize using the already scheduled time slots to reduce the risk of subsequent conflicts.

[0130] F.3 Day Load Balancing In the candidate sorting stage, the workload of scheduled days for the same grade is introduced as the sorting key: priority is given to days with lower workloads to reduce the concentration of courses on a particular day.

[0131] Appendix G: Example of the course scheduling decision-making process using the 2023 cohort of "Computer Networks" courses as an example G.1 Environmental Observation Taking a course cluster of 2023 cohorts with the course title "Computer Networks" as an example, the system first identifies multiple teaching classes corresponding to this course under different professional directions from the basic academic data and questionnaire analysis results, including several teaching classes under the Information Security major, Cybersecurity major, and Cybersecurity Experimental Class direction. According to the current implementation of this invention, the main course scheduling process first groups the courses according to (grade, course name, major), so this course cluster will be split into multiple basic course groups, such as "2023-Computer Networks-Information Security", "2023-Computer Networks-Cybersecurity", and "2023-Computer Networks-Cybersecurity (Experimental Class)". On this basis, the system then constructs a real combined class set according to the same grade, same teacher, and same course name to support courses with the same name from the same or different majors to be taught simultaneously when conditions are met.

[0132] For a given basic course group, the system provides the scheduling agent with complete environmental input during the scheduling process. This input first includes course group information, namely the grade, course_name, major, list of teaching classes within the group, and their corresponding teacher information for the current course group to be scheduled; secondly, it includes global state information, namely the teacher's already scheduled course schedule and the global scheduled course schedule. The former represents the courses and time slots that the relevant teachers have already undertaken before this round of scheduling, while the latter represents a compact view of the global scheduled course schedule up to the current moment; thirdly, it includes constraint information, namely aggregated_preferences and per_teacher_preferences, where the former represents the aggregated result of the preferences of most teachers in the group, and the latter represents the course-level preferences of each teacher for the corresponding course, including preferred, unavailable, notes, and other_raw text; finally, it also includes a candidate time slot set, candidate_slots, which is generated by the system first calling the valid time calculation tool for each teaching class in the group, and then taking the intersection or union of the available time slot sets for each class.

[0133] For the "Computer Networks" course cluster, the system can obtain various typical preference information from the questionnaires. For example, some teachers will explicitly indicate the preferred weekdays or periods for scheduling and clearly state the dates they do not want to be scheduled for; some teachers will request that the course be scheduled in the evening as much as possible; others will propose more complex natural language constraints, such as wanting this course to be scheduled on the same day as another course they teach, but in the morning and evening respectively. These preferences are first converted into structured preference fields by the questionnaire processing module through rule extraction and semantic enhancement using a large language model, and then further mapped into course-level constraint vectors, thus becoming the input boundary for scheduling decisions.

[0134] G.2 Decision Rules Upon receiving the above input, the scheduling agent does not directly generate the entire timetable. Instead, it selects the most suitable time from the candidate time slot set `candidate_slots`. According to current system constraints, the agent's output must be strict JSON, for example, `{"selected_time":"Week X, Period ab"}`. If the time output by the model is not in `candidate_slots`, the system automatically falls back to the first item in the candidate set to ensure that the agent's output is always within the legal range allowed by the execution layer. At the same time, the system explicitly restricts the agent in the Prompt to only making selections; it cannot directly modify the state or directly call the write tool.

[0135] For any basic course group in the 2023 Computer Networks course cluster, the scheduling agent must follow the following constraints when making a selection: First, the selected time slot must come from the legal candidate set calculated by the system based on factors such as teacher occupancy, conflicts between students of the same grade and major, and a blacklist of failures; Second, if the same teacher teaches multiple classes of the same course in the same grade, the system allows simultaneous teaching when the conditions for combining classes are met; Third, when making a selection, the agent needs to comprehensively consider the preferences of the majority of teachers in the course group, the strong preferences of individual teachers, the global timetable distribution, and the priority relationship of combining classes of the same course by the same teacher, so as to make the optimal time slot decision within the legal boundaries.

[0136] G.3 Decision Output Taking the 2023-Computer Networks-Information Security foundational course group as an example, if teachers in this group have a clear preference for Tuesdays and a clear constraint against Mondays and Fridays, then, assuming a standard Tuesday time slot exists in `candidate_slots`, the scheduling agent will usually prioritize a valid time slot on Tuesday, such as periods 3-5 on Tuesday. This choice is directly supported by the course-level preference structure, and is also influenced by global state constraints, the distribution of existing timetables, and other candidate teaching classes. If the system runs on the 2023-Computer Networks-Cyberspace Security foundational course group, since different teachers in this group may prefer Monday or Tuesday evenings, or Wednesdays or other courses scheduled on the same day, the agent needs to balance multiple teacher preferences and, in conjunction with the global timetable progress, select a time slot that satisfies both hard constraints and preferences as much as possible.

[0137] G.4 Execution and Verification After the scheduling agent provides `selected_time`, the system does not immediately consider the scheduling complete. Instead, it passes the result to the execution layer for tool-based writing and constraint verification. The execution layer sequentially calls `assign_class_func` for each class within the current course group, passing in the target time slot, course name, grade, major, teacher information, `allow_group_conflict=True`, and the actual combined class set `group_section_ids`. The execution layer then checks again whether the time format is valid, whether the number of teaching sessions in a single session exceeds the limit, whether the teacher's time slot is already occupied by a non-combined class, whether there are other conflicting courses in the same grade and major, and whether the current conflicting objects meet the combined class permission conditions. Only when all these conditions are met is the timetable status truly written, and `assigned_schedule`, `teacher_availability`, and `grade_major_availability` are updated synchronously.

[0138] For courses like the "Computer Networks" course cluster, which may have a need for combined classes with the same instructor but different majors, the system also provides a compensation mechanism for combined class reference time slots. If a reference time slot is temporarily not in the candidate set due to the filtering logic of ordinary teacher occupation, but the time slot is actually a legitimate scenario that allows combined class sharing, the system will re-inject it into the candidate set and re-evaluate its feasibility based on the actual combined class set before execution. This can avoid scenarios where combined classes with the same instructor can be misjudged as unavailable by teacher mutual exclusion rules, thus ensuring that the combined class strategy for cross-major or same-major courses with the same name can be truly implemented. If only some classes in the current course group can be successfully written to selected_time, while the remaining classes cannot be scheduled due to local conflicts, the system will not immediately abandon the course group, but will try other alternative time slots in the candidate set for the classes that were not successfully assigned, in order to complete the partial completion.

[0139] G.5 rating, feedback and subsequent fine-tuning After the "Computer Networks" course cluster completes its initial scheduling with other courses, the system enters the scoring and feedback phase. At this point, the system calls `calculate_score_raw` to quantitatively score the current schedule, obtaining `final_score`, `details`, and `violations`. Subsequently, the system calls `analyze_schedule_with_llm`, inputting a compact representation of the entire schedule, scoring results, violations, teacher preference summaries, and historical feedback information into a large language model to generate the current schedule's summary, strengths, weaknesses, action items, and stop_optimization judgments. For course clusters like "Computer Networks" with multiple teacher preference disagreements, the feedback results typically focus on the satisfaction level of certain teachers' preferences, the same-day distribution relationship with related courses, and the scheduling issues of individual classes in undesirable time slots.

[0140] After feedback is generated, the system performs local fine-tuning on a small number of courses whose preferences are not met based on `action_items`. This fine-tuning does not involve a global rescheduling; instead, it first identifies courses currently scheduled in avoidance periods or those that haven't met priority periods. Then, it calls `get_available_slots_func` to retrieve the set of valid candidate slots for each course in its current state and searches for a better time slot. If a better time slot is found, it attempts to reschedule using `assign_class_func`; if the rescheduling fails, it reverts to the original time slot. After fine-tuning, the system re-evaluates the courses and calls the feedback module again to determine if there is still significant room for optimization. The entire scheduling process only ends when the feedback module returns `stop_optimization=true`, or when the system determines that continued automatic iteration is unlikely to significantly improve the timetable quality.

[0141] G.6 Example Explanation As can be seen from the above examples, this application does not directly generate the final timetable by having the agent call a large language model. Instead, it completes the scheduling through a multi-stage closed-loop mechanism involving candidate set generation, agent selection, execution layer writing, rule scoring, and feedback fine-tuning. In this process, the scheduling results of the "Computer Networks" course cluster are influenced by the teacher's natural language preferences, as well as by the hard constraints of grade-major, permission for classes with the same teacher for the same course, the global timetable progress, and subsequent feedback optimization mechanisms. This achieves a balance between executability, interpretability, and sustainable optimization capabilities.

[0142] Appendix H: Backtracking / Conflict Resolution Mechanism H.1 Triggering conditions: Returning if allocation fails (teacher time conflict, student time conflict / inter-group conflict, no available time slot, etc.); serious grading violations (teacher_conflict, grade_major_conflict, etc.).

[0143] H.2 Repair and rollback strategies: Intra-group retry: For failed teaching classes, retry in the candidate time slots in turn; Augmented repair: resolve_conflict_func prioritizes moving the conflicting party to the new time slot, and then inserts the target class into the original time slot; Rollback guarantee: If the reordering fails, restore the original allocation and occupancy table to avoid state corruption.

[0144] The H.3 blacklist mechanism records the time periods when sections_blocked_slots failed, and removes them during subsequent candidate calculations to improve convergence efficiency.

[0145] Appendix I: Convergence Determination, Iteration Termination, and Final Verification I.1 Convergence Determination (Feedback Module stop_optimization) The feedback module uses deliverable local optima as the criterion and outputs `stop_optimization`: `true`: Continuing iterations is unlikely to significantly improve performance; hard conflicts have been resolved, and most remaining issues are minor biases. `false`: There are still clearly actionable improvements; conflicts can be resolved at different times, and bias violations are repairable.

[0146] I.2 Termination Conditions The feedback module outputs `stop_optimization=true` as the termination condition; safety limit: maximum number of feedback rounds to prevent infinite loops; if there are no structural violations: a stop check will still be performed once; if there are no correctable items, the process terminates.

[0147] I.3 Final Verification Mechanism Course completeness check: The number of courses to be scheduled matches the number of scheduled items (if any are missing, a completion mechanism is triggered and logged); Hard conflict check: Whether teacher_conflict / grade_major_conflict in the final violation item is 0 or within an acceptable range; Output consistency: The final feedback is generated based on the final timetable and final grade to avoid misalignment between the feedback score and the final score.

[0148] In summary, the intelligent course scheduling method proposed in this application has at least the following beneficial effects: (1) This application strictly limits the large language model to the decision-making and analysis role, and does not allow it to directly generate the final timetable or modify the underlying data structure. All scheduling actions are completed through controlled utility functions. Before writing, the utility functions perform hard constraints such as teacher uniqueness verification, grade-major mutual exclusion verification, and class hour length verification, and refuse to write and return structured error information when conflicts occur. Through this layered design of "large language model decision-making and tool execution writing", the unexecutable scheme caused by illusion or missed constraints when simply using the large language model for scheduling is effectively avoided, ensuring that the output timetable can be directly implemented in engineering.

[0149] (2) This application, through the collaboration of the questionnaire processing module and the prompts of the scheduling agent, maps teachers' natural language preferences into a 20-dimensional constraint vector table on the one hand, and retains the original text of other needs on the other hand, and incorporates them into the model inference during the decision-making stage. In this way, it can use the constraint vector to score and select in a computable manner in deterministic backoff, and can also make semantic-level judgments by the feedback module and the scheduling agent in complex preference scenarios, thus taking into account both the computability of formal expression and the rich expressive power of natural language preferences, and significantly improving the adaptability of the timetable to teachers' personalized needs.

[0150] (3) This application uses course groups as the basic processing unit at the execution layer to schedule classes involving the same teacher, the same course, or classes combined across majors. During the sorting stage, it prioritizes scheduling course groups with the most scarce resources and the fewest candidate time slots. At the same time, the system provides conflict resolution and backtracking mechanisms: for courses already scheduled, if a global conflict is subsequently discovered, key resources can be released by migrating individual course time slots, thus making room for subsequent courses. Through the combination of "group priority planning + heuristic backtracking", the system effectively alleviates the deadlock in traditional algorithms where courses scheduled first occupy key resources and courses scheduled later are completely unsolvable, and approaches the globally optimal scheduling scheme under complex constraints.

[0151] (4) The system feeds back the scoring results and violations to the feedback module, which generates actionable suggestions and persists them as an experience base. During cross-semester operation, the system persists the high-value experiences generated by the feedback as learning files, which are then injected into the system as global prompts during the next scheduling, so as to realize the continuous improvement of scheduling strategies and the accumulation of experience.

[0152] (5) This application does not completely bind the system to a specific large language model or external service. Instead, it designs the steps of questionnaire parsing, course scheduling feedback, and time slot selection into a hybrid mode of "large language model priority and rule fallback" through a unified large language model factory and clear interfaces. In environments where large language models cannot be used, the system can still rely on 20-dimensional constraint vectors and deterministic scoring rules to generate basic feasible solutions. In scenarios where the model is more powerful or better trained, the system can make full use of the semantic understanding and global analysis capabilities of the large language model. This design not only enhances the robustness of the system under different deployment conditions but also reserves sufficient expansion space for future model replacement or upgrades.

[0153] The intelligent scheduling method proposed in this application obtains basic academic data and teacher questionnaire data, transforms the teacher questionnaire data into a constraint model, and initializes the global resource state. The teaching classes to be scheduled are grouped and sorted, and the target time slots for each course group are determined by combining the global resource state and the constraint model. Each course group is then sequentially added to the timetable according to the sorting order. If conflicts exist, the timetable is adjusted and re-added until all course groups are conflict-free, generating the final timetable. Thus, by transforming teacher questionnaire data into a computable constraint model and combining it with the global resource state for time slot decisions, and resolving conflicts by adjusting the already scheduled timetable when conflicts arise, this method solves the problem that related technologies struggle to effectively handle personalized teaching preferences filled in by teachers in natural language, leading to scheduling results that cannot simultaneously satisfy hard constraints and personalized needs. It achieves the computability of unstructured preferences and the automatic resolution of scheduling conflicts.

[0154] Next, the intelligent scheduling device proposed according to the embodiments of this application is described with reference to the accompanying drawings.

[0155] Figure 5 This is a block diagram of an intelligent scheduling device according to an embodiment of this application.

[0156] like Figure 5 As shown, the intelligent scheduling device 10 includes: a first processing module 100, a second processing module 200, a determination module 300, and a generation module 400.

[0157] The first processing module 100 is used to acquire basic academic affairs data and teacher questionnaire data, convert the teacher demand text in the teacher questionnaire data into a constraint model, and initialize the global resource state based on the basic academic affairs data. The second processing module 200 is used to group the teaching classes to be scheduled based on the basic academic data, obtain multiple course groups, and determine the scheduling order of each course group based on the global resource status. The determination module 300 is used to determine the candidate time period set for each course group based on the global resource status, and to determine the target time period for the corresponding course group from the candidate time period set for each course group based on the global resource status and constraint model. The generation module 400 is used to sequentially schedule each course group into the target timetable based on the target time period of each course group and according to the scheduling order of each course group. If there is a scheduling conflict in the current course group, the target timetable is adjusted and the courses are re-scheduled into the current course group until there is no scheduling conflict in each course group, and the final timetable is generated.

[0158] Optionally, in some embodiments, the teacher demand text in the teacher questionnaire data is converted into a constraint model. The first processing module 100 is specifically used for: Identify structured time descriptions and unstructured natural language constraints in teacher requirement texts; The structured time description is mapped to the standard time period in the preset standard time period set, and the unstructured natural language constraints are semantically parsed to generate structured constraint data. The standard time period and structured constraint data are merged, and a constraint vector with teacher-course as the key is generated based on the merging result. A constraint model is obtained based on the constraint vector, where each dimension of the constraint vector corresponds one-to-one with each standard time period.

[0159] Optionally, in some embodiments, the scheduling order of each course group is determined based on the global resource status, and the second processing module 200 is specifically used for: Determine the number of available time slots and the number of time slots already occupied by teachers for each course group in the global resource status; Based on the number of available time slots and the number of time slots already occupied by teachers, calculate the resource shortage level for each course group; The scheduling order for each course group is determined based on the resource availability of each group.

[0160] Optionally, in some embodiments, the candidate time slot set for each course group is determined based on the global resource status. The determining module 300 is specifically used for: For each course group, obtain the set of available time slots for at least one teaching class corresponding to the current course group in the global resource status; Calculate the intersection of the available time slots for each teaching class; If the intersection is not empty, the intersection is used as the candidate time slot set for the current course group; otherwise, the union of the available time slot sets for each teaching class is calculated, and the union is used as the candidate time slot set for the current course group.

[0161] Optionally, in some embodiments, based on the global resource state and constraint model, the target time period for each course group is determined from the candidate time period set for each course group. The determining module 300 is specifically used for: The resource occupancy of each candidate time period in the global resource status assessment candidate time period set is evaluated, and the degree of matching between each candidate time period and the constraints in the constraint model is evaluated based on the constraint model. Based on resource usage and matching degree, the target time slot for the current course group is determined from the candidate time slot set.

[0162] Optionally, in some embodiments, the target timetable is adjusted, and the generation module 400 is specifically used for: Identify scheduled courses that conflict with the current course group; Remove the scheduled courses from the target timetable to obtain the freed time slots, and reallocate available time slots to the scheduled courses; If the reassigned courses are successfully reassigned, the current course group will be placed in the released time slot; otherwise, the scheduled courses will be restored to the released time slot, and the current target time slot of the current course group will be added to the preset blacklist.

[0163] It should be noted that the foregoing explanation of the intelligent scheduling method embodiment also applies to the intelligent scheduling device of this embodiment, and will not be repeated here.

[0164] The intelligent scheduling device proposed in this application acquires basic academic data and teacher questionnaire data, transforms the teacher questionnaire data into a constraint model, and initializes the global resource state. It then groups and sorts the classes to be scheduled, determining the target time slots for each course group based on the global resource state and the constraint model. Each course group is then sequentially added to the timetable according to the sorting order. If conflicts exist, the timetable is adjusted and re-added until all course groups are conflict-free, generating the final timetable. Thus, by transforming teacher questionnaire data into a computable constraint model and combining it with the global resource state for time slot decisions, and resolving scheduling conflicts by adjusting the existing timetable, this device solves the problem that related technologies struggle to effectively handle personalized teaching preferences filled in by teachers in natural language, leading to scheduling results that cannot simultaneously satisfy hard constraints and personalized needs. It achieves the computability of unstructured preferences and the automatic resolution of scheduling conflicts.

[0165] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device may include: The memory 601, the processor 602, and the computer program stored on the memory 601 and capable of running on the processor 602.

[0166] When the processor 602 executes the program, it implements the intelligent scheduling method provided in the above embodiments.

[0167] Furthermore, electronic devices also include: Communication interface 603 is used for communication between memory 601 and processor 602.

[0168] The memory 601 is used to store computer programs that can run on the processor 602.

[0169] The memory 601 may include high-speed RAM (Random Access Memory) memory, and may also include non-volatile memory, such as at least one disk storage.

[0170] If the memory 601, processor 602, and communication interface 603 are implemented independently, then the communication interface 603, memory 601, and processor 602 can be interconnected via a bus to complete communication between them. The bus can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation,Figure 6 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0171] Optionally, in a specific implementation, if the memory 601, processor 602, and communication interface 603 are integrated on a single chip, then the memory 601, processor 602, and communication interface 603 can communicate with each other through an internal interface.

[0172] The processor 602 may be a CPU (Central Processing Unit), an ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of this application.

[0173] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the above-described intelligent scheduling method.

[0174] This application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the intelligent scheduling method described above.

[0175] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0176] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

[0177] Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of this application.

Claims

1. An intelligent course scheduling method, characterized in that, Includes the following steps: Acquire basic academic affairs data and teacher questionnaire data, convert the teacher demand text in the teacher questionnaire data into a constraint model, and initialize the global resource state based on the basic academic affairs data; Based on the aforementioned basic academic data, the classes to be scheduled are grouped into multiple course groups, and the scheduling order of each course group is determined based on the global resource status. Based on the global resource status, a set of candidate time periods for each course group is determined, and based on the global resource status and the constraint model, the target time period for the corresponding course group is determined from the set of candidate time periods for each course group. Based on the target time period for each course group, each course group is sequentially placed into the target timetable according to the scheduling order of each course group. If there is a scheduling conflict in the current course group, the target timetable is adjusted and the current course group is re-placed, until there is no scheduling conflict in each course group, and the final timetable is generated.

2. The method according to claim 1, characterized in that, The step of converting the teacher demand text in the teacher questionnaire data into a constraint model includes: Identify structured time descriptions and unstructured natural language constraints in the teacher's requirements text; The structured time description is mapped to a standard time period in a preset set of standard time periods, and the unstructured natural language constraints are semantically parsed to generate structured constraint data. The standard time period and the structured constraint data are merged, and a constraint vector with teacher-course as the key is generated based on the merging result. The constraint model is obtained based on the constraint vector, wherein each dimension of the constraint vector corresponds one-to-one with each standard time period.

3. The method according to claim 1, characterized in that, Determining the scheduling order of each course group based on the global resource status includes: Determine the number of available time slots and the number of time slots already occupied by teachers for each course group in the global resource status; Based on the number of available time slots and the number of time slots already occupied by teachers, calculate the resource shortage level for each course group; The scheduling order for each course group is determined based on the resource availability of each course group.

4. The method according to claim 1, characterized in that, The process of determining the candidate time slot set for each course group based on the global resource status includes: For each course group, obtain the set of available time slots for at least one teaching class corresponding to the current course group in the global resource state; Calculate the intersection of the available time slots for each teaching class; If the intersection is not an empty set, the intersection is used as the candidate time slot set for the current course group; otherwise, the union of the available time slot sets for each teaching class is calculated, and the union is used as the candidate time slot set for the current course group.

5. The method according to claim 1, characterized in that, The step of determining the target time slot for each course group from the candidate time slot set for each course group based on the global resource status and the constraint model includes: The resource occupancy of each candidate time period in the candidate time period set is evaluated based on the global resource status, and the degree of matching between each candidate time period and the constraints in the constraint model is evaluated based on the constraint model. Based on the resource usage and the matching degree, the target time period for the current course group is determined from the candidate time period set.

6. The method according to claim 1, characterized in that, The adjustment of the target course schedule includes: Identify scheduled courses that conflict with the current course group; Remove the scheduled courses from the target timetable to obtain the freed time slots, and reallocate available time slots for the scheduled courses; If the reassigned courses are successfully reassigned, the current course group will be placed in the released time slot; otherwise, the scheduled courses will be restored to the released time slot, and the current target time slot of the current course group will be added to a preset blacklist.

7. An intelligent scheduling device, characterized in that, include: The first processing module is used to acquire basic academic affairs data and teacher questionnaire data, convert the teacher demand text in the teacher questionnaire data into a constraint model, and initialize the global resource state based on the basic academic affairs data. The second processing module is used to group the teaching classes to be scheduled based on the academic affairs basic data to obtain multiple course groups, and to determine the scheduling order of each course group based on the global resource status. The determination module is used to determine the candidate time period set for each course group based on the global resource status, and to determine the target time period for the corresponding course group from the candidate time period set for each course group based on the global resource status and the constraint model. The generation module is used to sequentially arrange each course group into the target timetable based on the target time period of each course group and the scheduling order of each course group. If there is a scheduling conflict in the current course group, the target timetable is adjusted and the current course group is re-arranged, until there is no scheduling conflict in each course group, and the final timetable is generated.

8. An electronic device, characterized in that, include: A memory, a processor, and a computer program stored in the memory and capable of running on the processor, the processor executing the program to implement the intelligent scheduling method as described in any one of claims 1-6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, The program is executed by the processor to implement the intelligent scheduling method as described in any one of claims 1-6.

10. A computer program product, characterized in that, It includes a computer program, which, when executed by a processor, is used to implement the intelligent scheduling method according to any one of claims 1-6.