# Optimizing the Scheduling of Teaching Activities in a Faculty
## 3 Model of the Automatic Timetable Generation System
### Constraints  
Developing an efficient schedule for a faculty requires careful consideration of several constraints [49], as they are essential in ensuring that the timetable satisfies the requirements and preferences of students, teachers, and the institution as a whole. Hard constraints are rigid regulations that must be followed precisely. These constraints are important for preserving the essential structure and feasibility of the timetable. Breaking hard constraints would result in infeasible timetables. 1. Courses must be organized according to the specified time slots provided by the faculty, ensuring the timing is suitable. Let _allowed_ (\(l\),\(t\)) be a binary indicator function that specifies whether timeslot \(t\) is allowed for lesson \(l\): \[x_{l,r,t}\cdot(1-allowed(l,t))=0\ \forall l\ \in\ L,\ r\ \in\ R,\ t\ \in\ T\] (3)
2. The room capacity should be sufficient to accommodate the number of students enrolled in each lesson: \[x_{l,r,t}\cdot students(l)\ \leq\ cap(r)\ \forall l\ \in\ L,\ r\ \in\ R,\ t\ \in\ T\] (4)
3. A teacher is unable to simultaneously teach two distinct lessons in separate classrooms. For any two lessons \(l_{1}\) and \(l_{2}\) that share the same teacher (\(l_{1}\)) = _teacher_ (\(l_{2}\)), they cannot be scheduled in the same timeslot: \[x_{l1,r,t}+x_{l2,r,t}\leq 1\ \forall\ l_{1},l_{2}\in L\ with\ teacher(l_{1})= teacher(l_{2}),\ r_{1},r_{2}\in R,\ t\ e\ T\] (5)
4. It is not possible for a room to accommodate two distinct lessons simultaneously. For any two lessons \(l_{1}\) and \(l_{2}\), they cannot both be scheduled in the same room \(r\) at the same timeslot \(t\): \[x_{l1,r,t}+x_{l2,r,t}\leq 1\ \forall\ l_{1},l_{2}\in L,\ l_{1}\
eq l_{2},r\in R,t\in T\] (6)* The scheduling of lessons should not have any overlapping: \[\sum_{r\in R}\sum_{t\in T}x_{l,r,t}=1\forall l\in L\] (7)
* A lesson with a duration of \(x\) cannot be scheduled for a time slot with a different duration than \(x\): \[x_{l,r,t}\cdot\left(duration(l)-duration(t)\right)=0\ \forall l\ \in\ L,\ r\ \in\ R,\ t\ \in\ T\] (8)
* A student group cannot attend two different lessons at the same time. For any two lessons \(l_{1}\) and \(l_{2}\) attended by the same student group _group (\(l_{1}\))_ = _group (\(l_{2}\))_, they cannot be scheduled in the same timeslot: \[x_{l_{1},r,1,t}+x_{l_{2},r,2,t}\leq 1\ \forall\ l_{1},l_{2}\in L\ with\ group(l_{1})= group(l_{2}),\ r_{1},r_{2}\in R,\ t\ \in T\] (9)  
Medium constraints are positioned between hard and soft constraints in terms of their level of flexibility and relevance. While medium constraints offer greater flexibility compared to hard constraints, it is essential to adhere to them to generate a timetable that can be both useful and efficient. * Courses and seminars should be organized together in the same time slot and room, either for a whole series of students (in the case of courses) or for a specific group of students (in the case of seminars): \[x_{c,r,t}=x_{s,r,t}\ \forall\ c\in L_{course},\ s\in\ L_{seminar},\ r\in R,\ t\in T\] (10)
* The maximum number of hours of courses per day for a student group should not exceed 10 h. Let \(h_{d}\) (\(s\)) be the total number of hours of courses scheduled for student group \(s\) on day \(d\): \[h_{d}(s)\leq 10\ \forall s\ \in\ S,\ d\ \in\ D\] (11)
* A teacher's workload should not exceed 12 h of courses each day. Let \(h_{d}\) (_teacher_) be the total teaching hours assigned to teacher _teacher (\(l\))_ on day \(d\): \[h_{d}(teacher)\leq 12\ \forall teacher(l),\ d\ \in\ D\] (12)
* Courses should be arranged based on the availability of teachers during specific time slots for teaching. Let _avail (\(t\), teacher (\(l\)))_ be the availability function of teacher _teacher (\(l\))_, where 1 indicates the teacher is available during timeslot \(t\) and 0 otherwise. A lesson can only be scheduled if the teacher is available at that timeslot.