Introducción
The University Course Timetabling Problem (CTTP) is NPcomplete in almost all of its variants. Thus, an exact solution is achievable only for small cases (e.g., less than 100 courses according to the dataset of Socha et al. (2002) in ^{(Babaei et al. 2015)}, whereas real world situations usually involve a few hundred courses. Therefore, the following case study uses metaheuristics because it is wellknown that these approaches have been extensively applied in order to calculate a reasonable solution within a reasonable time period ^{(Lewis et al. 2008)}, even though frequently an optimal solution is not found.
The CTTP consists in scheduling a sequence of lectures or each course within a given number of rooms and time periods satisfying a set of hard constraints, with the quality of feasible solutions evaluated based on violations of soft constraints ^{(Schaerf, 1999)}. This type of problem is a large resource allocation problem in which both time periods and rooms are determined for each course ^{(Phillips et al. 2015}.
Essentially, the problem addressed here is based on the standard formulation called the CurriculumBased Timetabling Problem (CBCTT). The courses in conflict are those that belong to the same predefined group of courses or curricula. A course consists of multiple lectures. However, these are only some characteristics. They may include many other distinctive features and cost components; for more details see ^{(Schaerf, 2015}; ^{Bellio et al. 2016)}.
Traditionally, this problem has been considered in the Operations Research field and solved based on techniques including Graph Coloring (GC) ^{(Burke et al. 2010}; ^{LaraVelázquez et al. 2011)}, Integer/Linear Programming (IP/LP) Method ^{(Schimmelpfeng, 2007}; ^{Rudová et al. 2011}; ^{SánchezPartida et al. 2014}; ^{Kassa, 2015)}, Constraint Satisfaction(s) Programming (CSPs) ^{(Marte, 2007)} and Benders’ Partitioning ^{(Sarin et al. 2010)}.
On the other hand, metaheuristic approaches have also been extensively used. Some metaheuristics are the CaseBased Reasoning Method (CBR), Genetic Algorithms (GAs), Ant Colony Optimization (ACO), Memetic Algorithm (MA), Harmonic Search Algorithm (HAS), Partial Swarm Optimization (PSO), Artificial Bee Colony Optimization (ABC) and single solution algorithms including the Tabu Search Algorithm (TS), Variable Neighborhood Search (VNS), Randomized Iterative Improvement with Composite Neighboring Algorithm (RIICN), Simulated Annealing (SA) and Great Deluge Algorithm (GD). Recently, there have been multicriteria and multiobjective techniques: novel intelligent algorithms such as hybrid approaches, artificial intelligence, fuzzy theory, clustering algorithm and distributed multiagent systems approach ^{(Babaei et al. 2015)}.
Until now, there are many models and methods explored and applied for the same problem because each institution has its own operational rules, and hence the characteristics and the structure are significantly different. In this paper, the CurriculumBased Timetabling Problem (CBCTT) is studied, which was solved using a Simulated Annealing (SA) metaheuristic.
Literature review
Simulated Annealing (SA) is one of the most popular metaheuristics for solving Combinatorial Optimization Problems (COP). SA is a general probabilistic local search algorithm proposed approximately 30 years ago by Cerny and Kirkpatrick in order to solve large instances of practical difficulty ^{(BenAmeur, 2004)}.
This representation comes from a physical process called annealing, the process for growing crystals, which can be simulated by the Metropolis Monte Carlo method ^{(Locatelli, 2000)}. SA is a black box stochastic algorithm that generates a sequence of random solutions covering a global optimum. It employs a slow annealing process that accepts worse solutions more easily in the beginning stages of the search as compared to later stages. Using this feature, SA escapes from local optimum and overcomes the difficulties encountered by derivativebased numerical methods ^{(Pedamallu, et al. 2008)}.
This metaheuristic has been widely applied in the different educational timetabling problems. For example, ^{Thompson et al. (1998)} implemented an examination scheduling system based on this method. Moreover, ^{Burke et al. (2012)} proposed a SA with reheating as a hyperheuristic move acceptance method for examination timetabling. ^{Ceschia et al. (2012)} made an experimental analysis of a SA approach for the PostEnrollment Course Timetabling Problem (PECTT). ^{Bellio et al. (2016)} focus their attention on the formulation known as the CBCTT, contributing a featurebased tuning of SA.
On the other hand, there have been contributions such as those from ^{Bouffard et al. (2007)} that improved the solution of a fictitious instance, assigning 100 courses to 100 periods. Alternatively, ^{FraustoSolís (2008)} give a solution with SA to the instances used for the PATAT competition. Also, in ^{(Tarawneh et al. 2013a}, ^{Tarawneh et al. 2013b)} the technique is used and proposed adaptive neighborhood structure selection mechanisms that memorized the best improvement. Other ways to use metaheuristics are by mixing them. For instance, in ^{Yunfeng et al. (2013)}, the Genetic Algorithm is combined with the Chaos and Simulated Annealing Algorithm in order to provide the solution in 8 seconds. For further information on metaheuristics used to solve such problems, refer to ^{(Lewis et al. 2008}; ^{Mühlenthaler et al. 2015)}.
The last decade has seen a number of successful simulated annealing based solutions to a variety of real world problems. However, the quality of the solution depends on the choice of parameters and the way in which the problem is modelled ^{(Thompson et al. 1998)}.
With regard to CBCTT authors that explore this type of problema with similar structure even thoug did not use the SA as method of solution are ^{Sarin et al. (2010)} that solved the problema en Virginia Tech considering 36 coordinations and 1680 courses. Other authors that solved a big problema were ^{Rudová et al. (2011)}, they give a solution to all the Purdue University using a weighted constraint satisfaction model, solving two central and six departmental problems, individually, and as a combined problem with almost 2,500 courses. Also is posible see more publications like ^{(Mirrazavi et al. 2003}; ^{AlYakoob et al. 2010}; and ^{Phillips et al. 2015)} ranging from 3 to 10 coordinations.
Structure of the paper
This paper explores the use of Simulated Annealing in the CurriculumBased Timetabling Problem (CBCTT). In particular, this proposal provides a feasible solution for a Mexican university. The remainder of the paper is organized as follows. Section 3 presents the problem description. Section 4 explains Pseudocodes and Optimization of Parameters. Section 5 will examine a numerical experience and the obtained results for the instances at question. Finally, Sections 6 and 7 develop the practical implications and conclusions.
Problem description
The institution located in Mexico offers approximately 2650 courses to almost 12,000 students. The institution has six departments, which manage 71 faculties, 14 modalities, 57 academic coordinators and 2178 professors. Most of the faculties share the same physical space and in some cases, they share the same professors. Currently, the assignment process is carried out manually with the help of a spreadsheet program. The scheduling is performed in two separate stages classifying the subproblems as a partial CurriculumBased Timetabling Problem (CBCTT) and a Classroom Assignment Problem.
The CBCTT is a type of problema where a serie of courses is assigned to a period of time and at the same time to a room. In this institution, the first stage posed is a partial CBCTT because only the coordinators chose the period of time neened for the courses of thier faculties as well as the order and sequence through the day and the week, but not chose the room. The second stage, is clasified as Classroom Assignment Problem, where the administrative staff conformed for 6 people spent almost a quartly assigning the courses to the correct room.
The issues with this process are the time spent by administrative staff to verify the feasibility of the schedule made by the coordinators and the work done by the coordinators to reschedule courses. Frequently, this occurs when two or more coordinators request their respective courses in the same time period or in the same physical space. To avoid this loss of time, workload and overlapping a comprehensive solution is proposed.
First, hard and soft constraints are considered for this research. The basic components in this study are consecutive and single hours, solve conflicts among professors, students, and courses, such as course precedence in accordance to the transcript, adequate room to teach the course, schedule available by the professor, avoid overlapping courses teaching by the same professor. Briefly, we will describe the constraints considered for this study.
Hard Constraints
H1. A professor cannot attend two courses during the same time period.
H2. A course must be taught only in one room for each time period.
H3. A group of students cannot attend two courses during the same time period.
H4. The students cannot take advanced courses without having first taken the preceding courses.
Soft Constraints
S1. The capacity of the rooms should be less than or equal to the number of students preenrolled in the course.
S2. The courses should be reserved in the same room if possible.
S3. Some professors can choose certain time periods for their courses.
S4. Some professors may request a special room for a given course due to medical conditions.
Classes may begin at 7 a.m. and may end as late as 10:00 p.m. (timeslots) Monday through Friday (days), considering 75 time periods. Usually, the maximum teaching hours for professors in a classroom are between 6 and 7 hours and the maximum lecture hours for students are 7 hours. In the institution, there are 316 rooms, where 199 are rooms with only chairs and tables and the rest are laboratories of different types.
Eliminating a hard constraint
In order to eliminate one hard constraint related to the curricula, a Mediation Software (MS) program was made considering the raw data stored in the information system. This program not only allows us to know the characteristics and size of the problem, but also allows us to organize the information.
Reviewing the curricula records is possible to join the courses in groups avoiding that the students take advanced courses without having taken the preceding courses, making possible to eliminate the H4 constraint. Therefore, knowing information such as open courses in the quarterly, the amount of lectures for each course, courses required in consecutive or isolated lecture, lists of curricula courses, lists of courses by professor, special requests for some professors or some courses, availability and types of rooms, it is possible to create the instances.
The outputs are instances and are formed by all the courses offered by the different faculties that share the same physical space and professors. Then, these instances are introduced as an input in the SA program.
Method: SA pseudocode and optimization of parameters
In order to determine, or at least approximate, the value f* in Simulated Annealing is defined as follows:
where f is the objective function and
Therefore, the cost function Cost(f) in this case is a weighted sum of the number of conflicts or violations of the hard W _{ hard } and soft W _{ soft } constraints conflicts.
SA differs from standard iterative improvement methods by allowing “uphill” moves that spoil, rather than improve, the temporary solution. After picking some initial configuration, most iterative methods continue by choosing a new configuration at each step, evaluating it and possibly replacing the previous one with it. This action is repeated until some termination condition is satisfied (e.g., no move reduces the objective function). The procedure ends in a minimum configuration, but generally, it is a local minimum, rather than the desired global minimum. The SA method tries to escape from these local minima by using rules that are derived from an analogy to the process in which liquids are cooled to a crystalline form, a process called annealing.
It is well known that when a liquid is cooled slowly, it reaches a totally ordered form, called crystal, which represents the minimum energy state of the system. In contrast, rapid cooling results in amorphous structures, that have higher energy, representing local minima. The difference lies in the fact that when a liquid is cooled slowly, the atoms have time to reach a thermal equilibrium in each temperature. In this state, the system obeys the Boltzmann distribution:
Here, p(E) specifies the probability distribution of the energy values of the states E, as a function of the temperature T and the Boltzmann constant k. On the one hand, for every temperature, each energy E has nonzero probability, and thus the system can change its state to one with higher energy. On the other hand, at low temperatures, the system tends to be in states with very low energy, with the global minimum achieved at temperature zero ^{(Davidson et al. 1996)}.
For defining a particular SA, it is necessary to specify the stopping criterion as maximum explored and the three functions A, D, and U given a distribution
Where
In addition, it is important to determine various parameters like the penalty method that improves the performance searching. The optimal cooling schedule ensures linearity in the expected number of sample points needed to become arbitrarily close to a global optimum. For more information, see ^{(Locatelli, 2000)}.
It is important to know the starting temperature, cooling factor, Markov chain length, process termination condition, and the number of iterations needed in order to allow the SA to escape from local optimum. There are many researches about the tuning parameters, such as ^{(Wang et al. 1999}; ^{Abramson et al. 1999}; ^{BenAmeur, W. 2004}; ^{Shen et al. 2007}; ^{Lee et al. 2014}; ^{Bellio et al. 2016)}. Below the Simulated Annealing Algorithm is shown.
Using SA to solve the timetabling problem:
In order to use SA in our problem, we use a bilevel approach. SA defines the order of courses to schedule, and a little assignation algorithm assigns each course in the first free slot available. Therefore, the SA works with an integer multidimensionalarray, in which each component represent the assignation of a Lecture to a specific day, hour and room. The possible values for each component are integer number mapped to the elements in the lecture sets. Initial solution is made without any number repeated, and the neighbor generation consist in a permutation procedure, in which the current assignation is shaked.
The optimization procedure consist in make permutations to this array, call the assignation algorithm, and evaluate the size of the assignation. This approach causes that in many cases the assignation algorithm break some constraint, so in this case the evaluation of the solution is penalized multiplying it by (1+m). In our experiments,” m” was equal to 0.25.
Computational experience and results
For the instances are considered nine buildings, that contain 316 rooms with their own characteristics. Quarterly, is offered about 2507 courses to undergraduate student. Each course can be taught in consecutive or isolated lecture; all the lectures considered here are 9620. The total groups formed of all the faculties were 1668, and the professors hired in this period were 2178. The instances made was five, each one divide by the shared physical spaces; the features of each one is shown in Table 1.
Instances/Features  Courses  Lectures  Rooms  Professors  Groups 

Ins1  1846  6960  199  1626  1228 
Ins2  223  840  44  207  107 
Ins3  92  330  15  80  43 
Ins4  293  1293  23  222  252 
Ins5  53  197  35  43  38 
Total  2507  9620  316  2178  1668 
A set of four random starts runs was developed for obtaining a solution of each instance. In the Table 2, can be seen the average of constraints violated and the elapsed time necessary for obtaining a good result.
Violated Constraints (%) 
Run Time (sec) 


Ins1  11  259200.03 
Ins2  7  86408.84 
Ins3  3  86587.4 
Ins4  9  109612.42 
Ins5  5  86400.01 
Therefore, we reached a good solution for all the entire university in a short time. In the Table 3, is shown a timetable of the room 3 with capacity of 30 students. Is possible observe that the program tries to occupy the most of every room, leaving empty spaces. Here they are assigned 23 courses and in Table 4, can be seen the specifications of each course.
Timeslots/Days  [1,]  [2,]  [3,]  [4,]  [5,] 

[,1]  39  49  16  57  83 
[,2]  39  49  16  57  83 
[,3]  39  49  16  57  83 
[,4]  39  50  16  57  10 
[,5]  28  50  54  9  10 
[,6]  28  50  54  9  10 
[,7]  28  24  54  9  10 
[,8]  46  24  64  3  4 
[,9]  46  24  64  3  4 
[,10]  46  24  64  3  4 
[,11]  55  24  64  3  4 
[,12]  55  32  32  60  60 
[,13]  55  32  32  60  90 
[,14]  86  86  51  51  90 
[,15]  86  86  51  51  90 
Courses  Student pre enrolled 
Amount of lectures 
Isolated or consecutive lectures 
Group  Professor  Forbidden periods 

3  2  4  4  1  2  4,5,6 
4  2  4  4  1  2  4,5,6 
9  4  3  3  4  7  
10  5  4  4  4  8  
16  6  4  4  8  13  
24  9  3  3  13  20  
28  11  3  3  15  24  
32  11  4  2  17  27  
39  12  4  4  19  32  
46  15  3  3  24  39  
49  16  3  3  24  41  
50  16  3  3  24  42  
51  16  4  2  26  43  
54  16  3  3  28  46  
55  16  3  3  29  47  
57  16  4  4  30  49  
60  17  3  1  31  52  
64  17  4  4  32  56  
83  19  3  3  38  75  
86  20  4  2  41  77  
90  29  3  3  43  79 
One of the specifications that helped to assign such courses to salon 3 is the preenrolled students against the capacity of the room. In addition, may notice that the amount of lectures and the number of consecutive lectures were satisfactorily assigned; for example the course 3 must be taught in 4 lectures weekly in 4 consecutive lectures.
Moreover, checking the remaining constraints of the same course 3, we can demonstrate that the professor 2, which also teaches the course 4, and the prohibited periods to teach the courses are 4, 5, and 6. Analyzing the constraint of the group, we can see that both courses belong to the group 1. If we again see Table 3, the course 3, and 4 are assigned to periods 8,9,10, and 11 in the days 4 and 5 corresponding to Thursday and Friday in accordance with the constraints mentioned.
Conclusions and future works
Concluding this work, the timetabling is one of the most important activities in Planning in Higher Education Institutions, since it is not only is an organization of resources but also is the assignment of the infrastructure and equipment necessary in order to guaranteed quality education to students ^{(Learning and Teaching Scotland, 2006)}.
In this institution is confront a large real CBCTT problem with 2507 courses conform by 9620 lectures; being able to assign into 316 rooms with different capacities, and also satisfying satisfactorily the requested of 2178 professors and 1668 groups. The contribution of this paper is twofold. First, is propose an effective MS that helps to organize the raw data, being capable of eliminating the curricula constraint. Second, a real problem was solved in one procedure eliminating the two stage previously mention; the solution was developed applying a Generalized SA method obtained a good average time the problem.
In this research were developed various instances, where 3 of 5 are considered by the research community like large instances, and solved with SA Algorithm, regarding all feasible solutions. Thereby the metaheuristic methods are relatively good depending on the instance situation, for this institution were satisfactory implemented. In this paper, the transitions are accepted in accordance with the Metropolis criterion. On the other hand definitely is necessary to adjust the parameters for each instance in order to get better approaches. The performance of SA has been enhanced by introducing smaller iterations and frequenting drops of temperature, but is advisable determine the parameters and the stopping criterion with Design of Experiment (DOE) in order to guaranty a better solution.
Lastly, there are studies into the utilization of teaching space at real universities suggest that rooms are occupied up to 60  80 % of the time on average, which is typical for the CTTP problems. In this study, we achieve to have utilization up to 70  100%; this is normal due to the type of operational rules that regulate the institution.