An Evolutionary Algorithm for Solving Academic Courses Timetable Scheduling Problem

: Scheduling Timetables for courses in the big departments in the universities is a very hard problem and is often be solved by many previous works although results are partially optimal. This work implements the principle of an evolutionary algorithm by using genetic theories to solve the timetabling problem to get a random and full optimal timetable with the ability to generate a multi-solution timetable for each stage in the collage. The major idea is to generate course timetables automatically while discovering the area of constraints to get an optimal and flexible schedule with no redundancy through the change of a viable course timetable. The main contribution in this work is indicated by increasing the flexibility of generating optimal timetable schedules with different copies by increasing the probability of giving the best schedule for each stage in the campus with the ability to replace the timetable when needed. The Evolutionary Algorithm (EA) utilized in this paper is the Genetic Algorithm (GA) which is a common multi-solution metaheuristic search based on the evolutionary population that can be applied to solve complex combinatorial problems like timetabling problems. In this work, all inputs: courses, teachers, and time acted by one array to achieve local search and combined this acting of the timetable by using the heuristic crossover to ensure that the essential conditions are not broken. The result of this work is a flexible scheduling system, which shows the diversity of all possible timetables that can be created depending on user conditions and needs.


Introduction:
Artificial Intelligence (AI) is one of the most important branches of computer sciences that has been created for machines supporting to help in taking decisions and solving complex problems as humans do. This generally consists of taking characteristics from human individual behavior and applying them as computer procedures 1 .
A flexible approach can be taken depending on the user's demands, which affects how to make intelligent behavior appears artificially 2 . GA is a heuristic technique that depends on natural evolution. It deals with a population named chromosomes as a candidate for problem-solving. The algorithm picked one chromosome from the population according to fitness values established by the fitness function; this performs the main role in the Genetic Algorithm. The major idea behind this work is the generation of course timetables automatically while discovering the area of constraints like the availability of classrooms, courses and times since these timetables are generated using GA to get an optimal and flexible schedule with no redundancy through the change of a viable course timetable 3,4 .
The aim can be divided into two objectives: The primary objective is to be able to optimize the algorithm used to generate timetable systems and to get optimal timetable with no clashes. The minor objective is to expand the area of course scheduling systems by making it universal thereby bringing about uniformity in the creation of timetables as it applies to different campuses this is to create timetables that agree with the requirements of any educational institution.
There are many gaps and limitations in the previous systems as a traditional generation of timetables, which may include the following 5,6 .
•Processing of a specific course timetable needs long-time because of data duplicated.
•Many administrative errors occurred due to conflicts in time requirements.
• Creation of timetable by staff is slow.
•The resulted timetable is not ideal due to clashing course requirements and allocations.
•Lots of work papers is needed.
•Updating the timetable is more difficult.
The main contribution in this work is indicated by increasing the flexibility of generating optimal timetable schedules with different copies (probabilities) by increasing the probability of giving the optimal schedule for each stage in the campus with the ability to replace the timetable when needed.

Related Work
Timetabling is a process concerned with making a timetable having events arranged according to a time when they take place must be subject to the timing constraints of each entity placed in the Table 7 . These courses are usually taught by different lecturers in different classrooms to specify some timing conditions in their lectures. Given all courses and course details for each course, the classical manual timetabling system is timeconsuming, heavy resources involve many steps and needs re-processing the same data several times 8,9 . Genetic algorithm is a random and probabilistic search, it produces the child population by comparing it to their parent population because it picked the parents are the fittest among the whole population set, and the bad parents die off in the next generation 9,10 . This algorithm is continued until some termination criteria' are agreed upon by the user 11, 12 . In 2014, Asif A., and Sachin B. 13 built a model that was utilized to generate an agreeable timetable using the probabilistic factors. Therefore, the authors used the genetic algorithm with the heuristic approach to build and improve the academic timetable. The goal of this work is to effectively use the infrastructure when the lecturers and the students are the stakeholders through the improvement process. For execution, each of the crossover, mutation, and the fitness function is to be computed. In a genetic algorithm, each chromosome has a fitness function. After analysis, if the fitness value is high then it refers to the better solution and after that, the parents are chosen according to their fitness to increase progeny for a new generation where fitter chromosomes have a greater opportunity to increase, the result of this work gave only one good solution for solving timetable problem.
In 2015, Sandesh Timilsina, Rohit Negi, and Yashika Khurana 14 implemented different genetic algorithmic methods in the scope of timetable scheduling. The first of this method is the 3D cutting method which has been tested in small and large timetable scheduling problems. The problem of small size was fixed easily without collides. This method was stopped at about 95 collides when trying to solve the large problem, so intelligent operators were added to improve the method which decreased the collides to about 20 collides in the least amount of runtime. The second method was set evaluation which has been tested on the final exam scheduling for all courses. The outcomes of fitness function were spotted for likelihoods of crossover that ranging from 0.00, 0.30, 0.40, 0.50, 0.60, 0.65, 0.70, 0.75, and 1.00. The last method is the Advanced-GA method which was used to fix the timetable-scheduling problem and finally, the solution from manmade was compared to the result of the last method. The result displayed that the man-made solution was fit to face all the uphill constraints but the genetically developed solution was not fit to be faced with all the uphill constraints. Furthermore, the genetically developed solution was fit to be faced with smooth constraints better than the man-made solution.
In 2016, Esraa A. Abdelhalim and Ghada A. El-Khayat 15 introduced a work that used some heuristics to generate a good quality timetable based genetic algorithm, the proposed algorithm was tested by Alexandria University in Egypt and also tested against two difficult benchmark problems. Testing proved that the proposed work produced a good tool for managing university timetables.
In 2017, Jumoke Soyemi, John Akinode, and Samson Oloruntoba 16 used the genetic algorithm to design an Electronic Lecture Timetable Scheduler (ELTS) for the learning institutions to conquer the limitations for the manual system of the timetable by making the manual procedure simpler, guarantee optimal distribution of resources, decrease the danger of collision of classrooms and lecturers. The ELTS facilitated the tedious tasks of the manual timetable procedure by improving the matters related to the manual procedure to get better the activities of the academy within the institution.
In 2018, M F Syahputra and others 17 implemented the genetic algorithm to organize the timetable procedure for the theoretical and practical category in university. The algorithm is used to process data which include the schedules of lecturers, courses, and classrooms, gained from university. The result of the organizing timetable using a genetic algorithm is related to a random function, which will influence the best result gained from the experiment. In each experiment, the final population is related to the final fitness value, which affects the result of the organizing timetable procedure created by the algorithm. Finally, the organizing timetable procedure is the optimal timetable that corresponds with accessible periods, classrooms, courses, and lecturer schedules. In 2018, Izah R. Ahmad and others 18 , created a timetable using genetic algorithm (GA) by Java programming languages to solve many restrictions such as the class size with student's ability, irritability time to each class and lecturer who is a responsible for each class, the number of classes in one day, and the subject of participation and lecturer. The genetic algorithm with Java programming languages managed to decrease the conflicts and to improve the fitness function.
In (2019), Deeba Kannan, Kuntal Bajpayee, and Samriddho Roy 19 used genetic algorithm to solve the timetable scheduling problem complexity as type of solving NP-hard problems. Therefore, this work focus on the minimization of the complexity of time, decreasing the conflict ratio, and minifying the encoding of the search space are the major points to solve the timetable-scheduling problem. Thus, the (GA) has many features managed through them to execute the above points and solve the problem.
In May 2020, Ashis Kumar Mandal and others 20 investigated an assignment approach for a partial exam for solving the problem of examination timetabling; the approach called partial graph heuristic organized with a modified great deluge algorithm (PGH-MGD), the result of this approach only produced good solutions that are competitive with those of the previous methods.
Many modern works were produced utilized different optimization algorithms and heuristics techniques for solving timetabling schedule problems like particle swarm optimization and local search algorithm 21 , Prey-predator algorithm 22 , adaptive evolutionary memetic algorithm 23 , cellular memetic algorithm 24 and constructive ordering heuristics 25 . All works proved that the scheduling timetable for education purposes still a complex problem and needs more and more studies.
The main gap in the previous studies as we found that all the data presented as a constant and the resulted timetable is restricted to the number of courses. In our work, all data presented as factors, where more than one timetable can be created, with the possibility of adding or removing some courses. This is useful in some situations, for example, in the case of generating a timetable for students who have special cases, such as those who have met in some courses, and other uncommon and crisis cases that may encounter the educational process in universities at present.

The Proposed System Environment
This work suggested a solution for the timetabling problem that many universities faced with the beginning of each academic year and this work aimed to reduce the high cost and the slowness of manual procedure that involved in the generation of optimal timetables. The system input consists of the various courses, halls of lectures, departments, programs, classrooms, lecturers, and the specification of conditions from which the timetable is constructed. The proposed scheduling system for this work generates optimal timetables using the genetic algorithm principle mainly the selection and the crossover. Figure 1 shows the requirement of the system working environment as the first step to prepare the inputs to the designed website page, then implements the genetic algorithm program to get the optimal timetable.

HARD CONSTRAINS
These are constraints that must be pursued during the search and without meeting these constraints, the solution is not true. These constraints are:  One teacher cannot give two courses at the same time.
Download an interactive HTML page

Fill teachers and courses information
Fill information about student groups and courses they will be learned Fill room's information

Soft Constraints
These constraints that are not mandatory for a solution must be pursued, but the quality of the courses schedule is decided by following these constraints:  In the timetable of teacher, no more than two lectures a day, each one 1 hours and 30 minutes, breaks are preferred 30 minutes or more.  In the students' timetable, we have to put three lectures a day at maximum with 30 minutes breaks between lectures so that they have more time for self-study at home.  We must ensure that a group of students does not have to attend college only to attend one class, there has to be a maximum of three classes in a day and a minimum of two classes so that it will be worth it to come to college on a particular day.

Assumptions and Dependencies
 At max 4 variables for which computation is required.  Number of lectures for batches is not greater than available time for the week.  Number of rooms provided are sufficient enough to hold the classes.  No ambiguity in the information provided, that is repetition won't be handled by the software.  Input is done correctly, a bug due to spelling mistake won't be handled, that is for example, at one place its "prolog" at another is "prolog", so these two will be taken as two subjects even might user intended to write the same thing.  No preferences are allowed for any teacher.

Functional Requirements
 The page should be available on the internet for the user.  The page should provide a query if the user wants to make the timetable.  Option about exiting should always be there.  The system should be able to take input about teacher and store it.  The system should be able to check if the number of teachers doesn't overflow and if they do then it should show error message accordingly.  Then it should be able to provide options about reducing batches or increasing the teachers.  The system should be able to check if the number of teachers is sufficient for the number of batches by using information about the maximum working hours of the teacher.  The system should be able to take input about rooms and store it.  Then the system should be able to give options about adding new rooms.

Proposed System Block Diagram
The system block diagram is shown in Figure 2 and displays how our proposed system works from the observer's point of view. The use cases in the diagram will display what a system does rather than how and will display the interactions between the system and the user. Use cases act many users named "actors" and they can interact with the system in different ways.

Initial Population: -
The population contains a group of chromosomes. Each one of these chromosomes is made of a set of genes and the chromosome meets the given hard and soft constraints such as the number of lectures wanted, the time, the available classrooms and labs, lecturers. In this work, the proposed chromosome generation characterized in our case study by the college of computer science in the University of Technology-Baghdad, Iraq which has six branches: Software Engineering (SW), Information System (IS), Artificial Intelligence (AI), Data Security (DS), Computer Networks (NW), and Multimedia (MM), these branches are represented by the following binary representation as indicated in the Table 1: All branches have students of 4 classes from class 1 to class 4 with the following binary representation as indicated in the Table 2: This configures the first chromosome part indicated by branch and class and the generated code. The department building consists of 18 classrooms and 7 labs, numbered from (0 to 24) with the following binary representation as indicated in the Table 3: The maximum number of teachers is 64 lecturers represented with the following binary code as indicated in the Table 4: The lectures time is indicated with a maximum of 3 lectures a day started in three different times (8:30,10:30 and 12:30) are coded by the binary representation of numbers (1, 2 and 3) respectively, each lecture has 1 hour and thirty minutes (1:30) only, the three times are coded as in the following as indicated in the Table 5 : The days when the students and lecturers can meet are five days: Sunday, Monday, Tuesday, Wednesday and, Thursday, these days are coded as described below in Table 6: In this work, the proposed chromosome is generated from four parts (department code and class, classrooms, lectures, days, and times), each part coded with 6-bit and the total chromosome length is 24-bit. Example: to represent the chromosome of the students in the artificial intelligence/ third class whose lec1 teach them in room 2 in Wednesday at 8:30 am will be represented as follows: (AI-3rd class, Room 2, Lec1, Wednesday at 8:30) (011011,000001,000000,100001) The generated chromosome =0110110000010000000100001 (24-bit length).
2. Fitness function:-the function tests the fitness value of each chromosome and chooses chromosomes with the highest fitness value for transit. The suggested fitness function is described in equation (1): Fitness=1/1-(soft cons. + hard cons.) ……… (1) 3.Selection:-for selection method, Roulette method is used to select the chromosomes with the highest probability since if the chromosomes have greater fitness values will have more opportunities to pick from the mating pool and participate in the crossover function.
4. Crossover:-the goal is to crossover genes of two actively chromosomes. There are different crossover methods but we have selected the singlecrossover in different positions. In the single crossover, we choose a specific point of the two chromosomes and exchange them to obtain the new generation for the next process. The proposed crossover exchanged the first gene of the branch class code, the second gene of the classroom code, the third gene of the lecture name code, and the fourth gene of the day\time code.

5.Mutation
:-In the mutation, the best two chromosomes combine to build a random population once more and then we verify it's optimization through evaluation function. Figure 3 shows the steps of the proposed genetic algorithm for the timetable schedule.

Results:
To enter the schedule of the materials for each stage, we can press the "create table for class 1" or "create table for class 2" and so on for the other of classes. We can also edit or update the schedule we already entered. Figure 4 shows the main interface of the timetable system and Figures 5 and 6 show the generated timetable schedule for courses of artificial intelligent branch for the first stage, second stage, third stage and fourth stage respectively. Scheduling timetables for courses for the big departments in the universities is a very hard problem and is often be solved by many previous works although results are partially optimal because some works were taken in their consideration that the input data are constants as shown in 16 ,17, 21 . Other works depended on fitness value to organize the timetable as indicated in (18) and the proposed partially exam timetable presented in 20 , 22 . Also, 15 dealt with the scheduling problem on a narrow and specific scale. While our work implements the principle of an evolutionary algorithm by using genetic theories to solve the timetabling problem as trying to get a random and optimal timetable with the ability to generate a multi optimal timetable for each stage in the collage. The ability of generated multi-solution gives our work more flexibility since there is no conflict in any condition or event with our results.
The execution of our algorithm is very promising and comes to steady-state after a few cycles, so the algorithm will stop in a case when no change on the timetable. Table 7 illustrates the parameter used in our algorithm. Some advantages and characteristics can be discussed from our proposed work; these can be summarized as follows: The Proposed System Advantages  Flexibility of the system since GA generated many solutions and the user can ask for change every time needed.  Power with minimal processing.  Decreases the time demanded to create optimal timetables.  It produces an easy transmit for data entry and revision.  High productivity.  Eliminates the need for paperwork. User Characteristics  Input and Storage: the system will take all the input from the user and will save it in its database for all the future computation.  Creating Random Solutions: using the above input by using the appropriate algorithm will generate some random solutions.  Calculating Fitness Function: by using the already decided penalty, the system will calculate the fitness functions of the solutions and will sort them in increasing.  Applying Genetic Algorithm through Mutation: By using, a fitness score system will apply genetic algorithm or its improved version to create the best possible solution in minimum possible time.  Efficiency: the system will try to take minimum time and resources.  User-Friendly Interface: no knowledge about the software will be required to use it, very straight design

Conclusions:
The Genetic algorithm in the timetabling structure has proven to be effective in many virtual problems. The genetic algorithm has proven that it plays a good role in discovering the interest space even in a hard and realistic world outlook. This work clarifies how the set of active constraints is used to inspire intelligent knowledge and how the GA can be implemented to determine the priority in the constraints in the dynamical scope of the developing environments. This work confirms that GA can locate the local optimum then stop. This is constantly a risk with GA, but it relies on the search area.
GA applies the proposed course timetable since there are several reasonable solutions and the GA will return one of them. In some situations, the GA may fail when there is a single reasonable solution, but once more it can be reactivated the search by the active constraints with numerous solutions to locate the best one of them. Nothing can bar this structure from being a part of an expensive and strong event/action algorithm. In such a case, it can be applied to select the constraint to be worked when there are not anther criteria for selecting the constraint. In another case, instead of having several constraints, which will make the active constraints allocations complicate and increased the design, consequently by increasing the periods for test and maintenance. This approach has many advantages that are the easy design with the decreasing of the time needed for the development and the maintenance of the system constraints in the scene of dynamically evolving environments.