#### Abstract

University class scheduling problem is one of the most important and complex issues in the academic field. This problem is recognized as one of the NP-HARD issues due to its various limitations. On the contrary, genetic algorithms are commonly used to solve NP-HARD problems, which is one of the decision-making problems and is basically one of the most fundamental classes of complexity. The university course planning includes severe constraints such as classroom, classroom curriculum, and faculty. At the same time, some soft constraints should be considered, such as student and faculty preferences and favorite class time. In this research, as a novel contribution, an integer model for scheduling university classes is presented. In this model, the preferences of professors and students are in accordance with the satisfaction values obtained through questionnaires. Moreover, a genetic algorithm has been developed to solve the model. The results show that the classroom timeline by this algorithm goes well during each run. Moreover, considering an exploratory search for the genetic algorithm can greatly improve the performance of this algorithm.

#### 1. Introduction

Curriculum planning and schedules are among the most complex problems confronting colleges, schools, and educational institutions. In this regard, an attempt is made to assign a collection of specific services, such as classrooms, instructors, and courses, to a set of teaching hours under specific conditions. Universities and schools have different requirements. The allocation of units to classes and professors to units is one of the most significant disparities between universities and colleges. In most colleges, the professor assigned to a course is not specified ahead of time [1, 2].

In other words, a professor can teach multiple courses, while each course is listed in professor schools. In addition, in colleges, the class assigned to each subject is unknown in advance, while in schools, this is not the case [3].

To put it another way, there are lots of constraints to providing appropriate planning for educational classes. One of them is the availability of professors. Not all instructors are available at all times and offer their free time. Other things like the number of classes and courses are provided. The number of classes, courses, the room’s availability, or the class’s place must be considered for planning [1].

The following constraint is the students’ preferences and conditions. For example, top students finish about four semesters of their studies. In other words, they must pass about 18 courses per semester on average. It is obvious that, in the same semester, all the courses should be planned differently from one another so that the student can complete the course without any overlapping plans. All these courses are registered as a group. For a specific unit, the number of students in a group becomes very large, and it is impossible to plan them for a specific period in a class. Therefore, holding a parallel class is likely to happen. Suppose 100 students pass a specific course in the same semester, and on the contrary, the capacity of a class is a maximum of 30 students, so four parallel classes will be opened for that course.

It should be noted that the program of that parallel class is not necessarily the same. It depends on the instructor’s availability. In addition, there are facilities for a specific course where some classes are merged into one class. Suppose a teacher can teach a number of courses. This makes the timetable more difficult. On the contrary, the timetable of the university program includes several sections. Timetable constraints in the first stage are 8 hours of classes per day and five days per week. Secondly, there are two types of lecturers, full-time and part-time lecturers.

In general, a maximum of 16 theory units per week is planned for a part-time lecturer, while a maximum of 12 units is planned for a full-time lecturer. There is no particular limit for the room where the classroom is held. However, for some specific courses, there is also a workshop and laboratory modes, which have different schedules and make the schedule more difficult[2, 4].

Researchers all around the world have assessed the optimization of curriculum planning and course scheduling in different universities. Cruz–Rosales et al. [3] created a two-stage model in which they first considered a feasible solution using novel approaches such as local search and taboo search and then soft constraints using the simulated annealing process. By simulated annealing (SA) algorithm and graph coloring, they obtained a solvable solution. Next, the SA algorithm then eliminates soft constraints, as well as rearranges time intervals and moves courses between time intervals [3].

A meta-innovative approach based on the forbidden quest was presented by Aldeeb et al. [5]. Different neighborhood structures are discussed in this study. The problem of scheduling courses at the university’s department of statistics with four separate neighborhood structures was solved, and the results were compared. Assi et al. [6] provided a model for scheduling the exams at Napier University by removing unscheduled courses using an evolutionary genetic algorithm and local search.

Muklason et al. [7] proposed an integer programming model for the class schedule that ensured the constraints met the requirements. The objective function of this study is to represent the desires of students and professors. Mokhtari et al. [8] provided a study on the topic of nurses’ class planning, which is comparable in terms of modeling to educational planning. With the aid of mixed-integer programming, a two-stage creative model was proposed to improve the program’s user-friendliness and high versatility in switching between nurses. Luo et al. [9] developed a model to minimize professors’ working days and hours of unemployment between the two groups, using simultaneous linear programming of integers combined with real numbers as a convergent approximation tool to the neighborhood.

After a complete review of the literature, the main contribution of this research can be summarized as follows:(i)Optimizing the university class scheduling problem considering the preference of teachers(ii)Optimizing the university class scheduling problem considering the preference of students(iii)Considering the deviation of ideal plans in optimizing the studied problem(iv)Proposing a metaheuristic algorithm to optimize the proposed mathematical model

In the rest of the study and in Section 2, the methodology, including the proposed mathematical model and the genetic algorithm, will be discussed. In Section 3, the numerical results obtained from solving the model are presented, and in Section 4, the research summary is presented.

#### 2. Methodology

##### 2.1. Proposed Mathematical Model

In this section, an integer linear programming model is presented. In this regard, the principles of proposing a new mathematical model are inspired by [10–14]. Based on modeling from the subject literature [15–17], the objective function of the model is divided into two parts. The first part is for professors, and the second part is for students. Moreover, since it was required to maximize the number of classes in a specific time period, its negative deviations are minimized too. In the following, variables, parameters, and sets are defined. Next, various constraints of the model are presented, and then, the objective of the function and determination of the cost coefficients are presented.

###### 2.1.1. Indices and Sets

: index of courses : index of courses’ code : index of professors : index of days : index of periods : index of student groups : the set of courses that must be presented : a set of one-unit courses (courses that require half a session per week) : sets of two-unit courses (courses that require one session per week) : three-unit course set (courses that require one and a half sessions per week) : four-unit course set (courses that require two sessions per week) : courses that can be presented by the professor : courses in which the*s*th group of students is applying for registration : the codes that can be provided for the

*i*th course : professors who can teach my course. : the set of time intervals, : set of even time intervals, : set of odd time intervals, : set of time intervals of

*k*th time packets

###### 2.1.2. Decision Variables

: binary variable takes 1 if the code of the class is provided at the hour of day *d*, and is 0 otherwise : binary variable takes 1 if the code of the class is provided by the *l*th professor at the hour of the day and the *s*th group of students participate in it, and 0 otherwise : binary variable will take 1 if the code of the three-unit class has two sessions in an odd week and one session in an even week, and if it has one session in an odd week and two sessions in an even week, it will take 0 : positive and negative deviations of the number of classes of the *s*th group of students in the *t*th time block on the day from the desired number of classes : binary variable is equal to 1 if the *s*th group of students in the *k*th time block has class, and 0 otherwise , : positive and negative deviations of the number of classes of teachers in the *k*th time block on the day from the desired number of classes : binary variable is equal to 1 if a teacher has a class in *k*th time block on day *d*, and 0 otherwise : binary variable is equal to 1 if the teacher teaches the *i*th course, and 0 otherwise : binary variable is equal to 1 if group of students enrolls in code of course and 0 otherwise

###### 2.1.3. Parameters

: minimum number of hours that the professor must teach (for faculty members) : maximum number of hours that the*l*th professor should teach (for professors who are not faculty members) : capacity of the

*i*th class (the maximum number of students who can enroll in the

*i*th class) : number of students in the

*s*th student group : number of available rooms for class scheduling in the

*t*th interval from the

*d*th day : desired number of classes of the

*l*th teacher in the

*k*th time package on the

*d*th day : desired number of classes of the

*s*th student group in the

*k*th time block on the

*d*th day : number of units for the course : cost factor of the formation of the

*J*th class of the

*i*th class by the

*l*th teacher at hour of the day : coefficient of the cost of forming the class code

*J*of the

*i*th class by the

*l*th teacher at the hour of the day and registering the

*s*th group of students in it. : importance of cost factor in the objective function : importance of number of classes (negative deviation) in the objective function : importance of the number of classes (positive deviation) in the objective function : importance of students’ preferences in the class schedule : importance of teachers’ preferences in the class schedule

###### 2.1.4. Hard Constraints

*(1) One-Unit Courses*. Constraint (1) has been presented for one-unit courses, which specifies that one of the half-intervals must take the value of one on different days and at different time intervals:

*(2) Two-Unit Courses*. For two-unit courses, Constraints (2)-(3) are used. Constraint (2) makes one of the even half-intervals equal to one and is equivalent to the fact that the first part of a class is formed in one of the even half-intervals, and Constraint (3) equals the next half-interval. It places one so that the continuation of the class is also formed exactly after the first half of the class:

*(3) Three-Unit Courses*. As the courses suggest, for the assignment of these courses, three half-intervals of one must be taken. There are two situations here: either two half intervals of even and one half interval of odd value or two odd half intervals and an even one are taken. Constraints (4)-(5) show that if takes the value of one, we will have two even half-intervals and one odd half-interval, and vice versa, if it takes the value of zero:

Constraint (6) guarantees that two of the three half intervals that are supposed to have a value of one are consecutive so that it can be considered as a full session:

Constraint (7) guarantees that each course does not have more than two half-periods (one session) per day:

*(4) Four-Unit Method*. There are four series of constraints for four-unit courses. Constraint (8) makes two of the even half-intervals equal to one, and it is equivalent to the fact that the first part of a class is formed in two even half-intervals. Moreover, Constraint (9) of their next half-interval is equal to that (one) so that the continuation of the class is formed exactly after the first half of the class:

Constraint (10) guarantees that each four-unit course does not have more than half a period (one session) per day:

###### 2.1.5. Constraint of Professors

Constraint (11) guarantees the noninterference of the courses related to each professor in each time period:

Constraint (12) is related to the minimum and maximum teaching hours of professors, which are the minimum teaching hours for faculty members and the maximum teaching hours for some nonfaculty professors who set a maximum time for teaching:

Constraints (13)-(14) guarantee that each code teaches each course by one and only one professor. If the *l*th teacher teaches the *j*th code of the *i*th course, the variables related to that teacher can take values. The first Constraint (13) makes it possible to be scheduled in the timetable only when a professor has taught the course code. Furthermore, Constraint (14) guarantees that each course code is taught by only one professor:

###### 2.1.6. Constraint of Students

Constraint (15) guarantees the noninterference of courses related to each group of students in each time period:

Constraint (16) shows that if a course is offered in a day and hour, the number of students who apply for that course should register in the code of that course:

Constraints (17) and (18) guarantee that each student group can register one and only one-course code, and if it is registered, the variables related to that code can be set. In fact, the following constraint shows that if course was presented with units for the students of group *s*, it will be , and the number of half the interval will be one.

These constraints guarantee that each group of students can register in one and only one of the course codes they want, and if they register, the variables related to that code can be set. In fact, Constraint (17) shows that if course of code *j* is presented with units for students of the group , it will be and the number of half interval will be one. Constraint (18) shows that each group of students must register in one code for the courses they want. Moreover, Constraint (19) shows the number of classes available in each time period:

###### 2.1.7. Soft Constraints

The soft constraints include the following. Constraint (20) from the professors’ point of view shows the minimum number of classes that professors want to have in each time frame package:

Constraint (21), which is raised from the perspective of students, shows the minimum number of classes that students have in each time package:

###### 2.1.8. Objective Function

Equation (22) shows the objective function of the mathematical model. In general, the different parts of the objective function are measured with coefficients *a*, and their relative importance is determined. The first part is for the cost of forming a class, and the second part is the cost of choosing a class of students. The third and fourth sections try to maximize the number of classes in the time package as much as possible, so its negative deviations are minimized. The fifth section makes the class less time-bound.

##### 2.2. The Structure of the Genetic Algorithm

The genetic algorithm (GA) is a classic metaheuristic algorithm based on the evolutionary ideas of natural selection and genetics [18]. In this way, GA represents the intelligent use of a random search algorithm to solve optimization problems. Although genetic algorithms use random phenomena, it has an evolutionary process to achieve the best possible solution [19]. The main aspects of GA are designed in such a way that they can simulate the processes necessary for evolution in natural systems. Among the most important of these processes are those that follow the laws that were first proposed by Charles Darwin and named “Survival of the Fittest.” The reason for this is that, in nature, the competition between living organisms to obtain scarce resources leads to the dominance of the fittest organisms over the weaker ones [20, 21].

In order to solve mathematical models using genetic algorithms, it simulates the principle of fitness with an encoding scheme. It produces several solutions as a “generation.” Each generation contains a population of strings of characters that are similar to the chromosomes found in our DNA. Each person (solution) will represent a point in the search space and a possible solution. Next, the members of each generation enter into a process similar to the process of evolution of living organisms [22].

Genetic algorithms operate using specific principles, such as the genetic structure and behavior of chromosomes in a population of individuals [23]. These basics are(i)Selecting a set of solutions and generating new solutions using crossover and mutation(ii)Members who are more successful in each competition produce more offspring than members who do not perform well(iii)Genes from good-performing members spread within the population, so good parents sometimes produce offspring that are better than either parent

Therefore, each successive generation will be better suited to live in its surroundings. A summary of the steps of the genetic algorithm is presented in Figure 1.

To use a genetic algorithm, a population of individuals is maintained within a search space. Each of these people is actually a possible solution to the problem. Each member is coded with a finite-length vector of components or variables and with the help of special alphabets. These special alphabets are usually binary alphabets. To implement a genetic algorithm structure, each member is interpreted as a chromosome which is known as solution representation. Therefore, a chromosome (a solution to the problem) consists of several genes (variables). To show the abilities of each member to compete with other members of the population, each possible answer is assigned a fitness score. The member with an optimal fitness score (or, more generally, close to optimal) is our favorite [24, 25]. The main reason for choosing GA for optimizing the proposed mathematical model is its acceptable performance in the previous related research items. The flowchart of the proposed genetic algorithm is illustrated in Figure 2.

##### 2.3. Solution Representation

The encryption method used in this study is permutation encryption. In this technique, chromosomes are coded as integers. Each integer is a unique gene for a specific period, and the sequence of integer genes representing genes in a chromosome determines the order of the sequence of periods to be programmed [25]. For example, a five-gene chromosome represented by 4 3 2 1 5 means that the first period is programmed by the integer 4 for the first time. Next, subsequent courses are followed by others in succession. The length of courses is equal to the total number of courses planned in a course group. If there are four periods for planning, and each of them is planned twice a week, the length of the chromosome is 8.

The selection process is based on a short selection. Chromosomes are classified according to their fitness function value from largest to smallest. Some chromosomes, starting from the smallest fitness strands, are replaced by new ones [26]. A new chromosome is obtained by reversing the position of all bits in an old chromosome. Unlike other selection methods, short selection does not copy the best chromosome for the population. For example, Table 1 contains the classified chromosomes of five genes. If the selection probability is 0.4, it means that the number of old chromosomes to be replaced with new ones is 2 = 0.4 × 5. Chromosomes 1 2 5 3 4 are replaced by 4 3 5 2 1, while chromosomes 5 2 3 4 1 are replaced by 1 4 3 2 5.

##### 2.4. Crossover Operator

In this research, a random-based crossover is applied. In the operator, the multiplication of chromosomes is performed based on population size and rate of crossover. The number of crossovers and the number of mutations must be the same. An example of a crossover is presented in Figure 3.

##### 2.5. Mutation Operator

In this research, a random-based mutation is applied. For the mutation operator, two cells are selected randomly; then, the value of these cells are moved with each other. An example of mutation is presented in Figure 4.

##### 2.6. Timetable Design

A schedule is actually a schedule that various constraints must accompany. Constraints are almost universally used by people with scheduling problems [16, 18, 20]. Constraints, in turn, are roughly divided into two categories: soft and hard constraints. A hard constraint is a constraint in any work schedule; it does not create any considerations. For example, a lecturer cannot be in two places simultaneously [22, 23]. Soft constraints may be broken, but their violation should be minimized. In addition to constraints, a number of exceptions must be considered when building an automatic scheduling system. For example, each class should be scheduled exactly once, students’ classes should not have two instructors at the same time, and reservations should not be made if the instructor is not available.

On the contrary, some classes need special rooms. Some classes must be held consecutively. While soft constraints for some professors prefer hours to be scheduled, most students do not want to have empty courses on their schedule. The distance students have to travel should be kept to a minimum. Classes should be evenly distributed throughout the week, classrooms should be reserved close to their office or home, and classrooms that are much larger than the standard classroom size should be reserved. In addition, there are exceptional limits that have been considered. For example, a part-time instructor can be scheduled for more than six units, while for full-time, it is twelve units.

#### 3. Numerical Results

Some tests are conducted to make sure how the system works. There are four groups of courses from year 1 to year 4. In experiments, we want to create a timeline for a particular semester’s data. A certain number of courses and professors are planned.

From Table 2, it can be concluded that , and all chromosome genes include , , , , , , , , , , , , , , , , , , , , , , , and .

This means that there are 13 columns and 100 rows in the target matrix after receiving the basic data, such as what room can be used for a specific teacher in a limited time and day, and also according to the capacity of that room. This system is run with ten chromosomes in a population, and ten generations are set in the experiment. Regardless of the probability of selection, crossover, and mutation, the maximum of the best value of the fitness function, i.e., 1, is obtained. This means that less time is needed to develop the program, and all courses can be planned based on it.

The timetable in which the class session will be held should also be defined. The system can define the available room for it, so after assigning a room, the status of that room is no longer available for that day and time.

##### 3.1. Findings

As previously mentioned, the problem is planned and solved in conjunction with real data taken from the Faculty of Electrical Engineering of one of the international universities, which we will discuss below, to discuss the findings of the proposed model. This problem contains five courses with three units, three courses with two units, and one course with one unit, for a total of 39 units (39 half intervals). Table 3 contains a list of courses with descriptions. Furthermore, it has nine professors; each professor can teach a few or no courses. Moreover, Table 4 includes information on professors. These courses are available for twelve different student classes (groups of ten).

Since each class has a capacity of 30 students, each class must enroll three groups of students, as shown in Table 5. In each section, there are between nine and eleven selected units. Every week, we have three working days. It is also considered, given that we have 39 credits and the institute’s objectives of broadcasting activities in the classroom. There are a few details in the model that is not included. There are no minimum or maximum time constraints for professors, for example. All objective coefficients are set to one since we are just searching for a reasonably suitable response and testing the model’s correctness. Two-time packages per day (morning and evening) are considered, with at least three-morning classes and four-evening classes.

The problem’s outputs are provided using the GAMS software. The outputs are divided into three categories after extracting and classifying the variables that take the value: the first category is the institution’s results, the second category is the professors’ results, and the third category is the students’ results. Table 6 will be used to display the following results.

After converting the final solution to the schedule, we reach the following schedule. It should be noted that there is a break between 3 and 4 (two hours for lunch from 12 to 14). The results are presented in Tables 7 and 8.

#### 4. Conclusion

The scheduling problem is one of the issues that has been the focus of many researchers in recent years. This problem is used in different fields in the real world. One of the practical aspects in which the scheduling problem is used is the scheduling problem of university courses, which is a complex decision-making issue at the beginning of each academic semester for university teaching groups. Educational groups in universities have always been in pursuit of providing courses and having a suitable timetable schedule according to the needs and educational laws. This issue has received more attention in recent years, and today, it has been raised as a decision-making issue. One of the most challenging tasks for university administrators and planners is scheduling university courses. The presence of multiple and overlapping constraints in planning is the primary cause of these difficulties. On the one hand, students and professors each have their own set of constraints. As an influential factor, university rules can impose constraints on planning in this region.

The proposed genetic algorithm and heuristic search are able to solve the timetable scheduling problem in academic institutions. The main finding of this research is that using the proposed approximate solution method can provide some solutions that satisfy all constraints, including the students’ and professors’ preferences. In this regard, in the optimal solution, planning includes allocating the courses to the available time periods which are achieved in a way that student satisfaction is maximized. Although some entities, such as class location, are not included in the target matrix, the system is able to determine which room to use for a specific cell in a timeline. If it is placed in the target matrix, it is likely that instead of adding the number of columns, a three-dimensional target matrix will be created.

On the other hand, there are limitations in this study that will be solved as a problem in the future. First, each parallel class of a subject group shown in a target matrix must be scheduled for each period defined in that timetable. Secondly, a course is only possible if it has at least the number of course units in the target matrix. If that period is divided into two parts, the name of that period must be different, and it can be assumed as two periods. Third, the system’s main goal is to maximize the number of successful units in planning. Otherwise, it should be designed based on that definition.

On the contrary, using the proposed mathematical modeling tools is suggested as an effective method for scheduling university classes. This model helps in the optimization of mathematical relationships in order to achieve the best possible solution to a variety of problems. The results of this study show that the use of optimization tools can create a straightforward program with all possible constraints.

#### Data Availability

The data used to support the findings of the study can be obtained from the corresponding author upon request.

#### Conflicts of Interest

The authors declare that they have no conflicts of interest.