COTTAPP: An Online University Timetable Application based on a Goal Programming Model

Preparing university course timetables is a challenging task as many constraints and requirements from the university and lecturers must be satisfied without overlapping courses for different student groups. Although many mathematical optimization models have been proposed to automate this task, a wider use of these models have been limited as deep technical understanding of mathematical and computer programming are required in order to use and implement them. This paper proposes a simple and flexible course timetabling application that is based on a weighted binary goal programming model with a powerful solver. Our application enables the users to modify and run this model by using a simple web and spreadsheet interface. Consequently, the model does not require deep technical understanding of the underlying models from its users even though it is based on a complex mathematical model. The web application and the underlying optimization model is illustrated by using a case study of an undergraduate program of industrial engineering.


Introduction
A course timetable must be set up at the beginning of every semester in all universities. This challenging task involves assigning courses to limited amount of resources, satisfying the preferences and constraints of lecturers, and preventing overlapping of courses. Therefore, a large amount of time and resources are required when course timetables are manually prepared. Many mathematical models have been proposed to automate and optimize timetables (see Section 2 for a thorough review). Although, these models can solve this complex problem much faster than humans can, many of them cannot be used by any other people than their developers. This is mainly due to the way these models are presented and published. Previous studies about course timetables published the mathematical details of their model and solution. Although this is sufficient to reproduce the model and implement it to another university, this task requires deep technical expertise about mathematical models and computer programming. Therefore, it limits a wider use and availability of these models. Some studies also published a computer code for their model. However, reading and understanding a computer code, and implementing it to another case study also requires deep technical expertise from a user. As a result, many previous studies have remained as a research project, and their use by other people and institutions have been limited. In this paper, we present a simple and flexible web application for computing university timetables. Our web application is called the Course Timetabling Application (COTTAPP). COTTAPP solves a complex weighted binary goal programming model by using the IBM CPLEX optimizer [5]. However, it does not require expertise about mathematical modelling or computer programming from the user. Any user who knows how to use spreadsheets and web browsers is able to compute the optimal course timetable by using COTTAPP. The other benefits of COTTAPP include the following: 1. The underlying mathematical model of COTTAPP is flexible: it can incorporate various constraints including preferences and constraints about the course hours and days, and preventing the overlapping of courses. 2. COTTAPP is a free web application that can be run by a simple web-browser. All inputs of COTTAPP can be entered by using an MS Excel spreadsheet, and its outputs can also be exported to spreadsheets. 3. COTTAPP [7] is freely available at "http://ieportal.hacettepe.edu.tr/apps/COTTApp/". In the remainder of this paper, Section 2 reviews previous mathematical models for university timetabling. Section 3 presents the weighted binary goal programming model that the COTTAPP is based on, and the other features of COTTAPP. Section 4 shows the use of the web application based on a case study, and Section 5 presents our conclusions.

Literature Review
One of the earliest models for university course timetabling is based on an integer programming algorithm developed by Akkoyunlu [1]. This model was based on data from a university department, and it was built by the FORTRAN computer programming language. Schniederjans and Kim [2] used binary goal programming model for assignment of instructors to courses according to the departmental requirements and the special requests of instructors. The model could satisfy the departmental requirements, and the requests of instructors were modelled as goals. Dinkel et al. [3] proposed a model with a genetic algorithm based cellular network optimization approach. Main factors like faculty, course, time and physical places were included to the cellular network approach with a penalty function. Classroom, subject and instructor overlaps were not allowed. _______________________________________________________________________________________________________________________________________________________________ [2] University of Nebraska Binary goal programming 1989 Dinkel et al. [3] Texas A&M University Genetic algorithm 1990 Dowsland [4] University Collage Swansea Graph coloring, Set partitioning, Simulated annealing 1994 Costa [6] École Polytechnique Fédérale de Lausanne Tabu search algorithm 1998 Badri et al. [8].
United Arab Emirates University Binary goal programming 1998 Colorni et al. [9] Italian high school Simulated annealing, Tabu search, Genetic algorithm 1999 Abramson et al. [10] Griffith University Simulated Annealing 2000 Deris et al. [11] Malaysia University Constraint based reasoning technique 2002 Burke &Petrovic [12] University of Nottingham Hyper heuristic methods, multi-criteria, case based approaches 2003 Smith [13] Monash University Hopfield neural network 2004 Benli&Botsali [14] Bilkent University Binary integer programming 2004 Carrasco&Pato [15] University of Algarve & University of Lisbon Potts mean-field annealing simulation, Discrete neural network 2004 Daskalaki&Birbas [16] Greek universities Binary integer programming 2005 Daskalaki&Birbas [17] University of Patras Two-stage relaxation approach, Binary integer programming 2006 Al-Yakoob&Sherali [18] Kuwait University Mixed integer programming 2006 MirHassani [19] Shahrood Technical University Binary integer programming 2008 Bakır&Aksop [20] Gazi University Binary integer programming 2011 Hao&Benlic [21] Universitéd'Angers Binary integer programming, Tabu [2]. Deris et al. [11] used the constraint based reasoning approach for solving the university course timetabling problem. Their model takes the requirements of the part-time instructors and the special circumstances such as public holidays into account. Burke and Petrovic [12] focused on hyper-heuristic, multi-criteria and cased-based approaches to prepare a schedule for courses and exams in the University of Nottingham. Smith et al. [13] examined the use of neural networks, greedy simulated annealing and tabu search for the timetabling problem. Carrasco and Pato [15] also use neural networks to prepare timetables for both lecturers and classes. Daskalaki et al. [16] proposed a model based on binary integer programming to prepare university timetables at Greek Universities. Their model ensures that the courses in the same day are done consequently as blocks. They consider the physical limitations, instructors, courses, days, time intervals and student groups when computing the optimal timetable. Although this increases the complexity of the model it also provides flexibility in implementing the requirements of the institution. Daskalaki and Birbas [17] offered a two-stage relaxation approach to solve such complex models. Their approach is run for every day of a week and aims to find local optimal solutions. Al-Yakoob and Sherali [18] and MirHassani [19] also proposed mixed integer models to prepare timetable for universities in Kuwait and Iran respectively. Hao and Benlic [21] suggested a linear integer model that uses tabu-search techniques and similar to approaches that dividing main problem to sub-problems.
There have been several studies that developed a timetable model for the universities in Turkey. Benli and Botsali [14] used binary integer programming for preparing a timetable for Bilkent University. Their approach is composed of three stages: assigning class meetings, preparing daily course timetables, and assigning classrooms to timetables. Bakır and Aksop [20] proposed a binary integer programming model for Gazi University. Their model incorporates some complex requirements specific to Gazi University. For example, there were different procedures for faculty and non-faculty instructors, and the model aims to satisfy these requirements when computing the optimal timetable. Table 1 shows the locations and methods used in previous studies and in our study. The majority of these studies, including our study, used a binary integer or goal programming method to compute university timetables. However, the use of many reviewed models have been limited as deep technical knowledge is required to modify and apply these models to some other institution. COTTAPP provides unique benefits in this regard as it can be used by someone who practically has no knowledge about optimization and computer programming. In the following sections, we describe the mathematical model underlying COTTAPP and the web application based on this model.

Mathematical Model
This section describes the underlying weighted binary goal programming model that computes timetables in COTTAPP. In the remainder of this section, the requirements of the COTTAPP's model (Section 3.1) and its mathematical formulation (Section 3.2) are discussed.

Requirements
Our first step was to elicit a list of the requirements expected from a university course timetabling optimization model. For this purpose, we made interviews with two research assistants (RAs) who are responsible for creating course timetables at the Department of Industrial Engineering in Hacettepe University (HUIE). Our interviews primarily focused on the timetables for the undergraduate degree program at HUIE as this program has the highest number of courses and students. The basic logical requirements of our model is defined as follows: • Courses given by the same instructor must not overlap, • The 'must' courses for a year of study must not overlap, • All course sessions must be assigned to a time slot, • If a course has more than 1 lecture hours in a day, those hours must be consecutive.

•
There are basic 'service' courses, such as basic mathematics and physics, taught by other departments.
Since HUIE students attend these course with students from different departments, these courses' days and hours are fixed and cannot be modified. The model should assign these courses to predefined days and hours. The RAs indicated that the courses must be grouped for each year of study. For example, each of freshman, sophomore and junior course groups have mandatory courses that must not overlap with other must courses that belong to the group. Similarly, there are 'technical elective' courses for third and fourth year students. These courses should also be defined as a course group as they preferably should not overlap with each other and with 'must' courses of third and fourth year students. Therefore, we defined multiple 'course groups' in our model each representing either courses for a year of study or elective courses. Satisfying the goals and constraints of the lecturers is a major challenge for preparing a course timetable. Many lecturers have specific preferences about the days and hours they would like to teach. Moreover, some lecturers are not available in some days and hours due to other liabilities and duties. These goals and constraints should be included as soft and hard-constraints as shown below: • Some courses must be given in a certain day or hour, and this should be included as a hard-constraint. • Some courses cannot be given in a certain day or hour, and this should be included as a hard-constraint. • Some courses are preferred to be taught in a certain day or hour, and this should be included as a soft-constraint (i.e. a goal). • Some courses are not preferred to be taught in a certain day or hour, and this should be included as a softconstraint.

Model
We used a weighted binary goal programming approach to build a mathematical model satisfying the requirements and goals discussed in the previous section. The main parameters of the model are shown below: = � 1 if course is assigned to day and period 0 otherwise where∀ ∈ , ∀ ∈ and ∀ ∈ , d 1 + : The positive deviation from non-overlapping technical elective courses,∀ 1 ∈ 1 , d 2 + : The positive deviation from the preferred number of courses assigned in a day or hour, ∀ 2 ∈ 2 , d 3 + : The positive deviation from the course groups that are not preferred to be overlapped, ∀ 3 ∈ 3 , d 4 − : The negative deviation from courses that are preferred to be taught on certain days,∀ 4 ∈ 4 , d 5 + : The positive deviation from courses that are not preferred to be taught on certain days, ∀ 5 ∈ 5 , d 6 − : The negative deviation from courses that are preferred to be taught on certain days and hours, ∀ 6 ∈ 6 , d 7 + : The positive deviation from courses that are not preferred to be taught on certain days and hours, ∀ 7 ∈ 7 .
The objective function of our model is: Finally, the constraints are as follows: Constraint 1: Instructor k cannot give more than one course at the same time.

Constraint 4: Technical elective courses should not overlap.
Note that the fourth course group is assigned to technical elective courses in our model.

Constraint 5:
In order to discourage the model from assigning the majority of courses on a few days and hours, we penalize if more than four courses are assigned to a day or hour. This is a soft constraint as it is inevitable to assign more than four courses if many courses are being taught.
Constraint 6: Pairs of courses in the set CO must not overlap

Constraint 7:
Courses in some course groups are preferred to not to overlap. In our case study, technical elective courses and the mandatory courses of the third years should not overlap as third year students have to take some technical elective courses.

Constraint 8:
If a course m has more than 1 hours of lectures in a day, those hours must be consecutive. We assume that a teaching day is 9 hours. The remainder of the constraints represent the lecturer preferences (goals) and constraints about teaching a course at particular days and hours. Constraint 9: Some courses cannot be taught on certain days. Constraint 13: Some courses must be given at predetermined days and hours. The model cannot change the time of these courses.
x ijm = 1, ∀ ( , , ) ∈ Constraint 14: Some courses cannot be assigned to certain days and hours.
x ijm = 0, ∀ ( , , ) ∈ Constraint 15: Some courses are preferred to be taught at predetermined days and hours.

Web Application
The model described in the previous section requires numerous inputs in order to be adapted to a particular institution. Our web application COTTAPP [7] provides a graphical and spreadsheet interface to enter the inputs and to run this model. COTTAPP was developed by using R statistical software [22] and Shiny [23]. Shiny is a web interface that creates web applications based on R code. The underlying R code prepares the weighted binary goal programming model as described in Section 3.2, and solves this model by using the IBM CPLEX optimizer. We used an R interface to CPLEX called Rcplex for this task. Figure 1 shows the main interface of COTTAPP. In order to run COTTAPP, a user first needs to download the settings file and enter the required inputs to this spreadsheet. The settings file is a spreadsheet for entering the inputs, and Figure 2 shows a screen shot of the spreadsheet. After the inputs are entered, a user uploads the setting file to COTTAPP, and then the underlying model is automatically run and the results are shown on the web application and downloaded as a MS EXCEL  Hours  KIM127  3  MAT245-1  2  EMU331  3  EMU434  3  -0  -0  Monday  9  ING111-112  3  MAT245-2  2  EMU363  3  EMU346  3  Tuesday  10  FIZ137-1  2  MMU251-1  2  EMU321  3  EMU432  3  Wednesday  11  FIZ137-2  2  MMU251-2  1  EMU341  3  EMU461  3  Thursday  12  EMU111  3  MMU261-1  2  EMU436  3  Friday  13  EMU101  3  MMU261-2  1  EMU451  3  14  MAT123-1  2  ECO135  3  15  MAT123-2  2  AIT203  2  16  EMU231  3  17 spreadsheet. In the following section, we illustrate the use of COTTAPP and the settings file based on a real case study in HUIE.

Case Study
In this section, we illustrate the use of COTTAPP by preparing a timetable for the undergraduate degree program of HUIE in the Fall 2015/2016 semester. HUIE has a 4-year undergraduate program in which freshman, sophomore and junior students have to take several mandatory courses. Junior and senior students must also complete a number of 'technical elective' courses which they can select from a list of available technical elective courses. Each lecture takes 50 minutes followed by a 10-minute break. All lecture hours of the courses that take 2 or 3 hours per week are assigned to the same day. Course hours of longer courses are divided to different days according to the preference of the lecturer. We will use the spreadsheet interface of COTTAPP to enter the inputs of HUIE. An empty spreadsheet interface or an example can be downloaded from the COTTAPP website. The first sheet in the COTTAPP input spreadsheet is called 'Courses-Periods' (see Table 2). We define the course groups and available lecture days and hours in this sheet. COTTAPP is able to prepare a timetable for up to 6 course groups. In this case study, we only need 4 course groups for freshman, sophomore and junior must courses, and technical elective courses. Therefore, course groups 5 and 6 (CG 5 and CG 6) are left empty in the spreadsheet. The last two columns define the names of the weekdays and available lecture hours each day for the model. The second sheet, called 'CoursesDayPeriodMust', defines the courses that must be assigned to a predetermined day and period in the timetable (see Table 3). Usually, the times of service courses, such as basic physics and calculus, are defined in this sheet. The course code, the day and starting hours of the first and last period of the course is written to the columns 1 -4 respectively. For example, the first row of this sheet defines that the KIM127 course must be assigned to the three-hour slot on Mondays between 9:00 -12:00. The cell below 'ConstraintActive' defines whether this constraint will be active in the mathematical model. If the user enters zero value to that cell, the model will not take the inputs in this sheet into account.  The courses that are given by the same lecturer are defined in the third sheet (see Table 4). Each row of this sheet represents a lecturer who teaches more than one course in the semester. For example, the first lecturer teaches both EMU111 and EMU363 this semester. The fourth sheet offers another interface for the courses that must not overlap. In this sheet, pairs of courses that must not overlap are defined at each row. A different instructor teaches EMU101 in HUIE, therefore it must not overlap with all other courses taught by those instructors. Table 5 shows how the necessary inputs for this constraint are entered to the fourth sheet of the spreadsheet. Other pairs of courses that must not clash can also be added to this sheet. Tables 2 -5 defines the basic inputs required for building a timetable for the HUIE's undergraduate course. However, the main challenge of preparing a timetable is to incorporate the goals, preferences and requests of the lecturers to the model. For example, some lecturers may not prefer to teach on a particular day, others may have duties that prevents them to teach at certain hours. These preferences and constraints are entered to sheets 5 -10 in the spreadsheet.
If a lecturer prefers to teach a course in a particular day and hours, this input is entered to the fifth sheet in the spreadsheet. Table 6 shows the requests from HUIE. For example, the first row of this sheet represents that EMU434 is preferred to be taught on Fridays between 10:00 -13:00. The inputs from the fifth sheet is entered as a soft constraint (goal) to the model. The inputs for the courses that cannot or preferred not to be taught on certain days are hours are entered to sheets 6 and 7 respectively in the same way as shown in Table 6. If a lecturer prefers to teach a course in a particular day but the time in that day does not matter, this input is entered to the eight sheet in the spreadsheet. The first row of Table 7 represents that EMU451 must be given on Mondays. Similarly, the inputs for the courses that are preferred to be taught on certain days are entered to sheet 9, and the inputs of the courses that cannot be or preferred not to be taught on certain days are entered to sheets 10 and 11 in the same way. After all the inputs are entered to the spreadsheet, the spreadsheet is uploaded to the COTTAPP website. COTTAPP reads these inputs and runs the model described in Section 3 using these inputs and the CPLEX solver. The results are calculated under 5 seconds, and they are shown in Table 8. The results can also be downloaded in an Excel spreadsheet from COTTAPP.

Conclusion
This paper presented an online application, called COTTAPP, to compute optimal university course timetables by using an underlying mixed binary integer optimization. COTTAPP offers simple graphical and spreadsheet interfaces to enter the requirements of the timetable, and then it computes the optimal timetable by solving the optimization model using the IBM CPLEX solver. Although many course timetable optimizers have been developed in previous studies (see Section 2), a wide use of these models have not been possible. This was mainly due to their availability and ease of use. Many of the reviewed studies only presented the mathematical formulation of the model, and the algorithms for solving the model. Therefore, deep technical knowledge is required from potential users in order them to apply it to their domain. The other models were only published as computer code, and thus they still require math and computer skills from the user to understand, modify and implement to code to their case. COTTAPP offers unique benefits in this regard. Although COTTAPP uses a complex model and a powerful solver, it does not require any technical knowledge from the user apart from knowledge to use web browsers and spreadsheet. As further research, interfaces to implement COTTAPP to the course databases, such as Moodle, could be developed. This would make it possible to automatically input the course names and groups, and therefore reduce the effort required from the user. We also aim to extend the scope of the COTTAPP's spreadsheet interface to cover any number of student groups and therefore prepare larger tables. The spreadsheet interface could also be incorporated to the web applications graphical interface to provide a more compact input interface for the users.