## 2 Problem Definition
### Mathematical Model  
The necessary data sets needed for the problem's model definition are the following:  
* \(T=\{1,...,TeachersNo\}\); the set of teachers
* \(\mathcal{C}=\{1,...,ClassesNo\}\); the set of classes
* \(D=\{1,...,DaysNo\}\); the set of teaching days in a week
* \(L=\{1,...,LessonsNo\}\); the set of lessons
* \(H=\{1,...,HoursNo\}\); the set of teaching hours in a day
* \(H_{t}^{not\ available}\); the set of time periods teacher \(t\) is not available at school
* \(H_{last}\); the set of the last hours of all days
* \(U\); a set of tuples \((m,n)\) for \(m,n\in P\colon n\geq m+1\)
* \(E\); a set of meetings (events) such that to each meeting \(e\in E\) a class-teacher pair and a given number of lessons that must be scheduled is preassigned [23]
* \(E_{t}\); a set of meetings assigned to teacher \(t\)  
The necessary variables and functions needed for the problem's model definition are the following:  
* \(x_{tcdn}=\begin{cases}1,&\text{if teacher $t$ teaches class $c$ at day $d$ at hour $h$}\\ 0,&\text{if teacher $t$ does not teach class $c$ at day $d$ at hour $h$}\\ \bullet&y_{tcdn}= \begin{cases}1,&\text{if lesson $l$ is taught at class $c$ at day $d$ at hour $h$}\\ 0,&\text{if lesson $l$ is not taught at class $c$ at day $d$ at hour $h$}\\ \bullet&\chi(\alpha)=\begin{cases}1,&\text{if $\alpha$ is true}\\ 0,&\text{if $\alpha$ is false}\end{cases}\end{cases} \)* \(UpperBound_{td}\) is the maximum number of teaching hours that can be assigned to teacher \(t\) at day \(d\) so as his/her teaching hours are uniformly distributed
* \(LowerBound_{td}\) is the minimum number of teaching hours that can be assigned to teacher \(t\) at day \(d\) so as his/her teaching hours are uniformly distributed
* \(Subjects_{tc}\) is the number of different subjects that teacher \(t\) teaches to class \(c\)
* \(Teacher\_Total\_Hours_{t}\) is the total number of teaching hours that teacher \(t\) can teach in a week
* \(Class\_Total\_Hours_{c}\) is the total number of teaching hours that class \(c\) can be taught in a week
* \(z_{tdnm}\) is the idle times of teacher \(t\) between time slots \(m\) and \(n\) on day \(d\)[23]
* \(v_{edp}= \begin{cases}1,\text{if the event }e\text{ is scheduled to timeslot }(d,p)\\ 0,\text{otherwise}\end{cases} \)  
Except for that, the following soft constraint costs are defined:  
* \(teachers\text{'teaching hours' distribution cost}=scw_{1}\times\sum_{t=1}^{T}\sum_{d=1}^{D}D_{td}\), where \(D_{td}=\begin{cases}1,\text{if }\left(\sum_{c=1}^{c}x_{tcdn}\geq UpperBound_{td}+1 \right)\vee\left(\sum_{c=1}^{c}x_{tcdn}\leq Loweround_{td}-1\right),\forall t \in T\,,d\in D\), \(h\in H\) and \(scw_{1}\) is the respective soft constraint weight as described in [20]. * \(lessons\text{'hours' distribution cost}=scw_{2}\times\sum_{t=1}^{T}G_{ tcd}\), where \(G_{tcd}= \begin{cases}1,\text{if }\sum_{h=1}^{H}x_{tcdn}\geq Subjects_{tc},\forall t \in T\,,c\in C,d\in D\\ 0,\text{ otherwise}\end{cases} \) and \(scw_{2}\) is the respective soft constraint weight as described in [20]. If \(\sum_{h=1}^{H}x_{tcdn}\geq Subjects_{tc}\), this means that teacher t teaches, at least one subject, at class c at day d more than one hour (twice or more). * \(teachers\text{'}gaps\text{ }cost=scw_{3}\times\sum_{d=1}^{D}\sum_{(m,n)\in U}z_{tdmn}\), where \(z_{tdmn}\geq 0,\forall t\in T,d\in D,(m,n)\in U\) and \(z_{tdmn}\geq(n-m-1)\times\left(-1+\sum_{e\in E_{t}}(v_{edm}+v_{edn}-\sum_{m <p<n}v_{edp})\right)\), \(\forall\ t\in T,d\in D,(m,n)\in U\). The latter inequality defines that, if variables are activated and there are no teaching periods between them, the value of \(z_{tdmn}\) equals \((n-m-1)\) which is the number of idle times between \(m\) and \(n\). This formulation of teachers' gaps cost was firstly presented in [23]. Accordingly, \(scw_{3}\) is the respective soft constraint weight as described in [20].