Automatic Course Arrangement Algorithm Analysis

Source: Internet
Author: User

Thread Theory

1.1 Background and Research Significance

1.2 application fields

1.3 Status Quo of the subject

1.4 several algorithms for solving NP problems and their comparison

2. Introduction to several popular Course Scheduling Algorithms

2.1. Automatic Course Arrangement Algorithm

2.2 priority-based Course Arrangement Algorithm

3 description and analysis of time slice-based priority Course Arrangement Algorithm

3.1 basic principles of Course Arrangement

3.2 Basic Requirements for Course Arrangement

3.3 description of time slice-based priority Course Arrangement Algorithm

3.4 algorithm analysis

Materials for participation

Thread Theory

1. Background and Research Significance

The Course Arrangement problem proved to be a complete NP problem as early as 1970s, that is, the computing time of the algorithm increases exponentially. This argument establishes the theoretical depth of the Course Arrangement problem. There is no general algorithm in mathematics to solve the NP problem. However, many NP questions are of great practical significance, for example. The familiar routing algorithm is a typical NP-complete problem. routes need to find the shortest path from multiple nodes to complete information transmission. Since they are all NP problems, many routing algorithms can be used to solve the problem of course arrangement, such as Dijkstra algorithm and node subtree pruning to construct the network Shortest Path Method.

At present, the main idea of NP complete problems is how to reduce its computing complexity. That is, we use an approximate algorithm to replace it, and strive to reduce the time for solving the problem from exponential growth to polynomial growth. The combination of the course schedule problem is to establish a realistic and simple model, which can greatly reduce the complexity of the algorithm and facilitate program implementation. This is a lot of ideas to solve the problem of course scheduling.

In colleges and universities, the main way to cultivate students is teaching. There are a series of management work in teaching activities. The implementation of the teaching plan is an important teaching link. Every semester, administrators should organize teaching plans, assign teaching task books according to the teaching plan, and then arrange the curriculum according to the teaching task book. In these teaching scheduling jobs, there are a lot of tedious data sorting work, more rigorous mental work, and a large number of forms. Therefore, the work is very heavy.

In addition, with the development of teaching reform and the implementation of the "211" project, the new education system has put forward higher requirements for Curriculum Arrangement. Manual Lesson scheduling makes it extremely troublesome to transfer information to the teaching system. However, when computer courses are used, the teaching information can be clearly displayed. To optimize the learning process of students and evaluate the contribution of each teacher to teaching, reasonable decision-making by leaders is of great significance and will certainly promote a virtuous circle of teaching.

2. application fields of the subject

The research of this topic provides guidance for the development of the Course Arrangement System in Colleges and Universities.

The core of the Course Arrangement problem is the conflict and preemption of multi-dimensional resources. It studies similar problems (especially those related to the timetable: for example, questions about exam placement, cinema seating, and airline routes are also a reference.

3. Current Situation of the subject

At the end of the age, some people outside China began to study the problem of course arrangement. In 1962, Gotlieb proposed a mathematical model for the course schedule problem and used the Hungary algorithm to solve the three-dimensional linear transportation problem. After that, people have made a lot of in-depth discussions on issues such as the algorithm and solution of the Course table problem. However, the mathematical models used in most documents are simplified or supplemented by the Gotlieb mathematical model, and no feasible algorithm is provided to solve the lesson schedule problem.

Over the past 40 years, many attempts have been made to solve the course schedule problems. The integer programming model of the Course table arrangement solves the problem by finding a group of 0-1 variables, but the calculation amount is very large. The branch technology that solves the 0-1 linear optimization problem is only applicable to small-scale Course Arrangement. Mihoc and Balas (1965) form the Course table as an optimization problem, krawczk proposes a linear programming method. Junginger simplified the course schedule problem into a three-dimensional transportation problem, while Tripathy considered the course schedule problem as an integer linear programming problem and proposed a mathematical model for the university course schedule.

In addition, some documents try to solve the problem of course arrangement tables from the perspective of graph theory, but the problem of graph dyeing is also an NP complete problem, only when it is extremely simple can the curriculum arrangement be transformed into a two-part graph matching problem. Such a mathematical model is too different from the actual situation, therefore, there is no practical value for most school curriculum arrangement problems.

After 1990s, the foreign research on the course schedule is still very active. ArabindaTripathy of the School of Management at the University of Vastapur in India, Jean Aubin of the University of Montreal in Canada, and Jacques Ferland. At present, there are a variety of solutions to the problem of the course schedule method, such as simulating the manual Course Arrangement Method, graph theory method, Laplace method, and quadratic allocation method. Because of the complex limitations of the course schedule, it is often difficult to describe the problem using mathematical methods, which has become a huge obstacle for solving the problem of the course schedule by using mathematical programming. Foreign Research shows that it is impossible to solve the problem of large-scale Curriculum Arrangement simply by using mathematical methods. However, using the stratified Planning Idea in operational research to break down the problem will be a promising way to succeed.

In China, the research on curriculum issues began in the early 1980s S. representative examples include: UTSS (A University Timetable Scheduling System) System of Nanjing Institute of Technology, and TISER (Timetable Scheduling) System of Tsinghua University) system: intelligent teaching organization management and Course Scheduling of Dalian University of Technology. Most of these systems simulate the manual Course Arrangement process and use heuristic functions for arrangement in the unit of "class. However, these System Course table orchestration systems often rely on the teaching systems of various schools and are not suitable for extensive promotion.

From the actual usage, the software systems developed at home and abroad are still not satisfactory in practicality. On the one hand, the reason is that as a very complex system, it is very difficult to make Course Arrangement comprehensive. On the other hand, due to their respective particularity, the Automatic Course Arrangement Software is difficult to be widely used, in particular, a small change in the scheduling process should cause a major adjustment of all courses, which means that the whole school's courses are greatly changed, which is very difficult to achieve in practical application.

4. Several Algorithms for solving NP problems and their comparison

To solve NP problems, we can only rely on approximation algorithms. So the following describes the design ideas of several common algorithms, including dynamic planning, greedy algorithms, and backtracking.

Dynamic Programming is a subproblem that is resolved layer by layer into a level-1 subproblem that is gradually scaled down until the subproblem can be directly solved. All sub-problems are decomposed into a sub-problem tree based on hierarchies. Root is the original problem. The solution of the original problem depends on the solution of all subproblems In the subproblem tree. A dynamic planning algorithm is usually used to find the optimal solution of a problem in a certain sense. To design a dynamic planning algorithm, follow these steps:

1. analyze the nature of the optimal solution and characterize its structural features.

2. recursively define the optimal solution.

3. Calculate the optimal solution from the bottom up.

4. Construct an optimal solution based on the information obtained when the optimal solution is calculated.

Step 1 ~ 3 is the basic step of the dynamic planning algorithm. If you only need to find the optimal solution, you can skip step 4. If you need to find an optimal solution for the problem, you must perform step 4. In this case, when calculating the optimal solution in step 3, you usually need to record more information to quickly construct an optimal solution based on the recorded information in step 4.

(2) greedy Algorithms

When a problem has an optimal sub-Structural quality, we will think of using dynamic programming to solve it, but sometimes there will be simpler and more effective algorithms, that is, greedy algorithms. As the name suggests, greedy algorithms always make the best choice for the moment. That is to say, the greedy algorithm is not the best overall consideration. His choice is just a local optimal choice in a sense. Although the greedy algorithm does not obtain the overall optimal solution for all problems, it can produce the overall optimal solution for many problems with a wide range, such as the single-source shortest path problem and the minimum support tree problem. In some cases, even if the greedy algorithm cannot obtain the overall optimal solution, the final result is a good Approximate Solution of the optimal solution.

The most famous greedy algorithm is Dijkstra. It is used as a routing algorithm to find the shortest path between two nodes. The idea of Dijkstra algorithm is: If G has n vertices, we need to find n-1 Shortest Paths in total. The solution is as follows: first try, write V0 (first vertex) to the path length of each vertex (final vertex), or there is a path, the length of the path is the weight of the edge; or no path, it is ∞. Then, the shortest path is generated in ascending order of length. In fact, the process of generating the shortest path is to constantly add an intermediate point between the start vertex V and the end vertex W, because every time a shortest path is generated, there is a final vertex U of the path, so those paths that have not yet generated the shortest path will be shorter than the original path because of the U, so it will pass through the U.

(3) backtracking

The backtracking method is called the general solution. It can be used to find all or any solution to the problem. In summary, the Backtracking Method is a systematic and leaping search method. In a state space tree that contains all solutions to the problem, it searches for the root Based on the depth-first policy. When you search for a node that reaches the state space tree, you always first determine whether the subtree with the node as the root certainly does not include the solution of the problem. If it is not included, the system searches for the subtree are skipped and continues searching for its ancestor nodes layer by layer until a node with an unsearched son exists, to a son node of the node that has not been searched. Otherwise, go to the Child tree and continue to search based on the depth-first policy. When the backtracking method is used to find all the solutions to the problem, it must be traced back to the root, and all the sons of the root have been searched before the end. When seeking any solution to the problem, you only need to find a solution to the problem.

2. Introduction to several popular Course Scheduling Algorithms

2.1. Automatic Course Arrangement Algorithm

1. Problem Description

The following is a simplified description of the automatic course arrangement we discuss:

Set the course to {C1, C2 ,., cn}, the total number of courses is n, and the number of times each course is arranged per week (2 consecutive hours) is {N1, N2 ,., nn}; the teaching day of each week is five days, I .e., Monday ~ Friday; a maximum of four courses can be arranged for each teaching day, that is, 1 ~ Sections 2, 3 ~ 4 sections, 5 ~ Sections 6 and 7 ~ Section 8 (1st, 2, 3, and 4 respectively). In this assumption, it is clear that the total teaching period per week is 5 × 4 = 20, and the following constraints exist:

N ≤ 20, (1)

N = 6n, I = 1, Ni ≤ 20. (2)

Automatic Course Scheduling: design appropriate data structures and algorithms to determine {C1, C2 ,., in Cn}, each course teaching period should be occupied, and ensure that only one course occupies any period of time.

2. Main Data Structure

For each course, assign two bytes of "time period allocation word" (unsigned integer): {T1, T2 ,., tn }. the following format is used for any time period allocation word (assumed as Ti:

Ti Data Type C language format is defined as: unsigned int. the highest level of Ti indicates whether the course is valid. 0 indicates valid, and 1 indicates invalid (such as suspension, each course is assigned three consecutive bits, indicating a teaching day (Monday ~ Friday) the value of the time period for the course to be arranged. 0 indicates that the course is not arranged on the current day. 1 ~ 4 indicates the corresponding time period (the value exceeding 4 is invalid ).

In this design, the value of words allocated in a valid time period should be less than 32 768 (hexadecimal 8000 ), the time period allocation words greater than or equal to 32 768 correspond to those courses that are currently not valid (both the course allocation space has been set), so it is easy to stop the course/course class.

3. Course Arrangement Algorithm

Under the preceding assumptions, the goal of the automatic course scheduling algorithm is to determine the {T1, T2,., Tn} corresponding to {C1, C2,., Cn }.

In terms of the possibility of arrangement, there are 20 in total! /(20-N )! Sorting method (for the meaning of N, see formula (2 ). if there are 4 courses and each course has 2 times a week, then N = 8. The possible arrangement of these 8 courses will be 20! /(20-8 )! = 5 079 110 400, that is, more than 5 billion types. if you select a solution without principle, it will take a lot of time. therefore, the premise of course arrangement is that there must be a definite course arrangement principle. we adopt the rotation allocation method as the course arrangement principle: Starting from Monday 1st, press {C1, C2 ,., after completing the courses listed in Cn} (once for each course), continue to arrange the following time period until the number of course classes of all courses matches {N1, n2 ,., until the value specified in Nn. {C [1], C [2],., C [n]} indicates {C1, C2 ,., cn}, for {N1, N2 ,., nn}

And {T1, T2,..., Tn} use the same notation.

Algorithm 1 Course Arrangement Algorithm

Enter {C1, C2,., Cn}, {N1, N2,., Nn }.

Output {T1, T2,..., Tn }.

① Initialization:

Week value: week = 1

Time segment = 1

Characters allocated for each time period in {T [1], T [2],., T [n]} are cleared.

② New scanning course:

Flag = 0

Perform the following operations on the course index value c-index = 1, 2,., n:

If N [c-index]> 0, perform the following operations:

Write the segment value to the week-1 (week-1) 3 ~ of T [c-index ~ The value of N [c-index] in week 3 3-1 minus 1

If N [c-index]> 0, set flag to 1.

If week = 5 and segment = 4

Then: Set flag = 1 and turn ③

Otherwise, if segment = 4

Then: Set segment = 1 and week increases by 1.

Otherwise, the segment value is increased by 1.

Check whether all settings have been completed:

If flag = 1

Then: Turn ②

Otherwise: Go to ③

③ Check for success:

If flag = 1

Then: Too Many course classes

Otherwise, the course is arranged successfully.

④ Algorithm ended

Obviously, the time complexity of this algorithm is O (N) (N is the total number of course classes per week, see formula (2 ), the space used to allocate words in the storage period is 2 n Bytes (n is the number of course courses ).

4. Conflict Detection Algorithm

Sometimes, after the automatic course schedule is completed, you need to manually adjust the schedule of some courses. For example, change the number of weeks in the first course to week and the time segment to the position of segment, perform the following operations based on the above data structure:

T [I] = T [I] & (~ (7 <(week-1) * 3) + (segment <(week-1) * 3 ),

Where &,~ And n are bitwise AND, bitwise inversion, and bitwise Left Shift Operators (the same below ).

The question is how to determine whether other courses are arranged in the same time period.

If the word is T [1], the problem is described as follows: T [1] and {T [2], T [3], T [n]} indicates whether an allocation word has an equal non-zero time period value in the same course allocation bit, or {T [2], T [3],., T [n]} indicates whether there are time periods in conflict with T [1. for simplicity, in the following algorithm description, assume that the maximum number of words allocated in all time periods is 0.

Algorithm 2 Conflict Detection Algorithm

Enter T1 and {T2,., Tn }.

The time period allocation characters in {T2, .., Tn} conflicting with T1 are output.

① Perform the following operations on c-index = 2, 3,., n:

Initialize the shielded word mask = 7

Perform the following operations on the week value week = 1, 2, 3, 4, 5:

If T [1] & mask is equal to T [c-index] & mask, and the two are not equal to 0

Then: T [1] conflicts with T [c-index ].

Mask shifts three places left (or by 8)

② Algorithm ended

The time complexity of this algorithm is O (n) (n is the number of courses)

5. Algorithm Analysis

This algorithm is course-centered and searches for matching and obtains the first matching value. It has the characteristics of low space occupation and fast computing speed. However, it does not select the best data, so it cannot allocate Teaching Resources (teachers, classrooms) reasonably or meet some special requirements (for example, some teachers prefer to attend classes in the morning, some teachers prefer centralized classes; some courses are more appropriate in the morning, and some courses cannot be arranged in the morning ).

2.2 priority-based Course Arrangement Algorithm

In mathematics, the course arrangement problem is a combination of time, teachers, students, and classrooms, with the teaching plan and various special requirements as constraints. The essence is to solve conflicts between various factors. In order to reduce the complexity of the course scheduling algorithm when designing algorithms, we mainly adopt the idea of converting the algorithm to zero and the Priority Algorithm:

1. Course Arrangement preprocessing

1. Division of equivalence classes

Tasks with the same object are divided into the same equivalence class. There is only a location conflict between each equivalence class, but there is no time conflict. Then, process the data in size from large to small. The equivalence class can be divided by grade and then by department, as shown below:

Division of Class Object equivalence classes

Department of Chemical Engineering, Department of automation and machinery.

Level 99 N 1 subclass 1 subclass 2 subclass 3 subclass 4.

Level 98 N 2 subclass 5 subclass 6 subclass 7 subclass 8.

Class 97 N 3 subclass 9 subclass 10 subclass 11 subclass 12.

Level 96 N 4 subclass 13 subclass 14 subclass 15 subclass 16.

In this way, there are four categories by grade: 99 (N 1), 98 (N 2), 97 (N 3), 96 (N 4 ), each Equivalence Class N 1, N 2, N 3, N 4 can be divided into several sub-classes by department, and then each sub-class can be arranged separately, this can greatly reduce the complexity of the algorithm.

2. Classroom category

To make rational use of classrooms, we have adopted the classroom classification method, so as to avoid the phenomenon that courses with a small number of students blindly occupy a large capacity during the course arrangement process.

First, the classroom is divided into several equivalence classes according to their types, as shown below. Then, the equivalence classes of each classroom are divided based on the capacity of the classroom: for example, they are divided into 0 ~ 30 persons, 30-30 persons ~ 60 people, 60 ~ 90 people, 90 ~ 120 people, 120 ~ 180 people and other types

Division of classroom equivalence classes:

Classroom type equivalence class R classroom type equivalence class R

R1's listening Professor R5

Projection classroom R2 physical lab R6

Multimedia Classroom R3 chemistry lab classroom R7

Graphic classroom R4 computer lab R8

3. Time preprocessing

1) construct the time mode Library

The time mode is a combination of time specified for different courses in different weeks based on the educational staff's experience. for example, if the number of weeks for a course is 4, the time combination can be: "11", "41", indicating that the course has been used twice a week, these time models are also graded to achieve better class performance. as shown below

Time mode classification example

Weekly class priority Monday wednesthursday Friday

4 1 11 41

:

4 2 22 43

::

The numbers from Monday to Friday are counted as 1 ~ 5 indicates the number of classes: 12, 34, 56, 78, 12, and 34 respectively ~ 6. For example, the number "42" indicates the 34 section of Thursday.

This time unit. In this way, all reasonable time combinations can be stored in the mode library for each week's learning hours. In this way, you can use various modes in the time mode library for matching during time processing.

2) Time Array

Create a one-dimensional array for classes, teachers, and classrooms. For example, the initial course scheduling time array for a teacher is (123456 123456 123456 123456 ). Five groups of data are displayed, indicating the five days in a week; A group of data contains six characters: "1, 2, 3, 4, 5, and 6", indicating the six time units in a day. After assigning a time for a teacher, the corresponding character is set to 0L. For example, the number of calendar hours for a teacher is (020456 103456 003456 120456 ), it indicates that the instructor has arranged courses for 12 and 56 of Monday, 34 of Tuesday, 12 and 34 of Wednesday, 56 of Thursday, and 12 of Friday, if you want to schedule a course again, you should arrange it in a non-zero time unit L. You can also perform the same processing for the class and classroom, respectively marking the course schedule.

2. Course Arrangement for each subclass

In course arrangement for each subclass, we combine the ideas of division and control, greedy, and backtracking. L first, based on the idea of divide and Control Law, the entire course arrangement process is divided into two stages: time allocation and classroom allocation. Then, according to the greedy algorithm, during time allocation, the best effect is always selected among the unallocated time units.

Unit. When a deadlock occurs in the time allocation, the latest conflict record will be searched up and traced back, and then it will be rearranged to solve the conflict. The specific process is as follows:

1. Set priority

Calculate the priority of the course in the subclass. Set the priority function:

D (g) = J (g) * C1 + T (g) * C2 + P (g) * C3 (1)

Where, J (g) indicates the course level, the optional course level is set to 1, the required course level is set to 2; T (g) indicates the week hours of the course; P (g) indicates the number of participants in the course. C1, C2,

C3 is an adjustable parameter. From formula (1), we can see that the higher the course level, the more weeks, and the more participants, the higher the D (g) value, the higher the priority; otherwise, the smaller the D (g) value, the lower its priority. In this way, the courses can be sorted based on the calculation priority, and the priority is higher than the scheduling priority.

2. query available time units

Step 2: Initialize the maximum configurable time array of a course, which is (1st 123456 123456 123456 123456 ). Step 2: Find all the classes that take the course. Step 2: query the time array of each class, obtain the Time of the class's course schedule, and compare it with the maximum time array of the course ", to obtain the time units that cannot be arranged for the course. Step 2: process the instructor time array and related classroom time array in sequence. In this way, the final configurable time array of the course is the class, teacher, and classroom time array.

.

3. Find the appropriate time mode

After the course schedule time is found, the appropriate time mode should be matched in the time mode library according to the course's weekly hours. After completing the above work, the course time and place are determined. If a life-and-death lock is triggered during processing, you can search for the most recent conflict Record Based on the Backtracking Method and rearrange it to solve the deadlock, if the deadlock problem persists, You can output the course information to the conflict list.

3. manual intervention

Manual intervention is also required for Automatic Computer Course Scheduling, so that colleges and universities can set and adjust some parameters in the course scheduling algorithm according to their specific requirements, and adjust the course table from the computer L the manual intervention process designed by this algorithm includes:

Parameter settings in equivalence class division, classroom type settings, time mode library settings, and parameter settings in priority functions. You can set these parameters and libraries according to your specific requirements. In addition, you can adjust the curriculum that is provided by the computer through human-computer interaction to obtain a satisfactory curriculum.

4. Performance Analysis

This algorithm divides equivalence classes for classes and classrooms and rationally utilizes school resources. However, some special requirements cannot be embodied.

3 description and analysis of time slice-based priority Course Arrangement Algorithm

The Course Arrangement problem is essentially a conflict between time, teachers, classes, classrooms, and courses, to solve this problem rationally, we must first understand some basic principles in the Course Arrangement and some basic requirements for the Course Arrangement.

3.1 basic principles of Course Arrangement

Certain rules should be followed in the Course Arrangement. Only the course arrangement according to basic rules can reduce the occurrence of conflicts. These basic rules mainly include the following:

1) two courses cannot be arranged for students of the same class at the same time (except for some specific electives)

2) two courses cannot be arranged for the same instructor at the same time

3) two courses cannot be arranged at the same time in the same classroom

4) the total number of courses arranged at the same time cannot be greater than the total number of classrooms available

5) the total number of students participating in a course should not be greater than the number of seats in the arranged classroom

6) The properties of the provided classrooms are the same as those of the classrooms required for the courses.

There is a close relationship between time, teachers, classes, classrooms, and courses. Relatively speaking, classrooms are less closely related to them.

3.2 Basic Requirements for Course Arrangement

The course schedule is not arbitrary. In order to achieve the best teaching effect, certain requirements should be followed. These requirements mainly include:

1) try to arrange the best time for the selected courses.

2) there must be a certain interval between course times in a week

3) public courses and other courses involving a wide range of courses with many hours should be prioritized

4) for the same teacher, try to select a relatively fixed number of classrooms for the same class object.

5) Select a relatively fixed classroom for the course of the same class

6) The choice of Connecting classrooms should not be too far apart

7) There are several course classes on the same day.

8) Priority should be given to meeting some special requirements (for example, some classrooms prefer morning classes and can be given priority)

3.3 description of time slice-based priority Course Arrangement Algorithm

Before describing an algorithm, let's clarify some concepts first. Here we call the administrative class A natural class and the class in the same classroom a course class. In the university, some public courses come together with several course classes through multimedia. We call the total number of course classes public. Classes, classrooms, teachers, and courses all maintain their own curriculum. Each table element (such as the first class on Monday) in the Course table is called a time slice.

Based on the time slice priority scheduling algorithm, the course scheduling class is taken as the unit, and the appropriate time slice is selected around the timetable of each pair of images (natural class, classroom, classroom.

<! -- [If! SupportLists] --> 1. <! -- [Endif] --> algorithm Flowchart

<! -- [If! Vml] --> <! -- [Endif] -->

<! -- [If! SupportLists] --> 2. <! -- [Endif] --> pseudo-code description of an algorithm

Input: Instructor (teacher1, teacher ,................ Teachern)

Classroom (room1, room2 ,..................... Roomn)

Class (class1, class2 ,...................... Classn)

Course (course1, course2 ,.................. Coursen)

Priority of teachers, classrooms, classes, and course time sheets

Course class (schudel_class1, schudel_class2 ......... Schudel_classn)

Output: teachers, classrooms, and classes that have completed the course schedule

Procedure schudeling (teacher, room, class, course, schudel_class, public_class)

// Initialize an empty time table and optimize each time slice of the time table // initialize it as advanced

Init Time_table

// Process the course class

For every schudel_class do:

If (! Check_Have_despose (schudel_class) // if the course has not been scheduled

Begin:

Time_table = Time_table & get_all_class_time_table (schudel_class)

Time_table = Time_table & get_room (schudel_class );

Time_table = Time_table & get_teacher (schudel_class );

Course = get_course (schudel_class );

// Assume there are only two or three consecutive classes.

Int iCount2 = 0; // Number of two consecutive sessions in the course

Int iCount3 = 0; // The number of three-member connections in the course

// Obtain the number of course hours per week.

Int course_count = get_couse_count (Course );

// Obtain the weekly connection information

Parse_couse_count (course_count, & iCount2, & iCount3 );

// According to iCount2, iCount3, and Time_table, select N for the course class

// (N = iCount2 + iCount3) the appropriate time slice is saved in the CPoint variable

CPoint po;

LList <CPoint> * cp

Int priority [7] = 0;

// Obtain the sum of daily priorities.

Loop: I = 0 until I = 6 do:

Loop: J = 0 until J = 6 do:

Begin:

Priority [I] = Priority [I] + Time_table.time_piece [I] [j]

End Begin

// Get the day with the highest priority. We think that time is the most idle.

// Suitable for arranging courses

Int number = get_number (priority [7]);

BOOL fail

While iCount2> 0 do:

Begin:

Fail = Get_Time_Pieces (2, & number, po );

If (! Fail) then do

Begin:

ICount2 --;

Cp-> append_list (po );

End begin

Else

Break;

End Begin

While iCount3> 0 do:

Begin:

Fail = Get_Time_Pieces (3, & number, po );

If (! Fail) then do:

Begin:

ICount3 --;

Cp-> append_list (po );

End begin

Else

Break;

End Begin

// According to * cp data and schudel_class data,

// Write back the instructor's lesson schedule

If (! Fail) do

WriteBack (schudel_class, cp );

Else then

RollBack (schudel_class, cp); // erase the previously selected classroom from the instructor.

End Begin

End Schudeling

There are some function explanations in the algorithm:

BOOL check_for_dispose (schudel_class): uses the course class as a parameter to determine whether the course class has been scheduled. If the course class has been scheduled, treu is returned; otherwise, false is returned.

'&' Operation: this operation is an operation on two course tables. A new course table is returned. The obtained time segment is a smaller value of the corresponding time segment of the calculated course table.

CTime_table & get_all_class_time (schudel_class)

CTime_table & get_room (schudel_class)

CTime_table & get_teacher (schudel_class)

Ccourse get_course (schudel_class): takes the course class as the parameter, obtains the course of the course class, and returns

Int get_course_count (Ccourse): takes the course as the parameter to obtain the number of lessons required for the course per week, and returns

Parse_course_count (int &, int &, int &): analyzes the value returned by get_course_count, separate the value with two and three links (Here we assume there are only two links and three links)

Int GetNumber (int *): input an integer array to obtain the subscript of the maximum value in the integer array, and return

WriteBack (schudel_class, Llist <CPoint> *): updates the timetable information of instructors, classes, and classrooms in public_class based on the time slice value in Llist <CPoint> *.

RollBack (schudel_class, Llist <CPoint> *): erase the data written in the previous steps in the course class, instructor, class, and classroom.

Computer Course Arrangement is a complex process. Under the conditions of large data volume and many constraints, it is very important to achieve reasonable course arrangement through manual interference. Manual Interference includes some data input work before the course schedule, manual pre-course scheduling, and appropriate adjustment of the course schedule after the course schedule is completed.

3.4 algorithm analysis

This is a greedy algorithm. Each selection of teachers and classroom resources is based on the current optimal data. This algorithm obtains the optimal values based on the priorities of teachers, classrooms, and classes. Therefore, some special requirements on each object are clearly reflected. When the resources of teachers and classrooms are insufficient, this algorithm can discharge relatively reasonable courses. Compared with the two algorithms described in the previous chapter, they have obvious advantages in processing various special requirements.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.