I am trying to solve an optimization problem in which there is a set of tasks, $S$, where $s_i$ and $e_i$ are the starting and ending time of task $i \in S$. Each task $i $ must be done within its time own window $[a_i, b_i]$: \begin{equation} a_i \le s_i, \forall i \in S \end{equation} \begin{equation} e_i \le b_i, \forall i \in S \end{equation}
Due to the presence of time windows, tasks could overlap. I have defined continuous variable $t_{ij}$ to quantify the overlapping time of tasks $i$ and $j$.
The objective is to minimize the overlapping time: \begin{equation} min \sum_{i,j \in S} t_{ij} \end{equation}
How can I define constraints to compute $t_{ij}$?