\begin{algorithm}[t]
\centering
\caption{The binarised DISCOTEC}
\label{alg:binary_discotec_algorithm}
\begin{algorithmic}
\Require A set of partitions $\pi^t \in \{1, \ldots, K^t\}^n; t\in \{1, \ldots,T\}$.
\Require Must-link constraints $\mathcal{C}_\text{ML} = \{(a_i, b_i)\}_{i=1}^{n_\text{ML}}$
\Require Cannot-link constraints $\mathcal{C}_\text{CL} = \{(a_i, b_i)\}_{i=1}^{n_\text{CL}}$
\For{$t\in \{1, \ldots, T\}$}
\State $\pmb{A}^t \gets \left[\mathbbm{1}[\pi^t_i=\pi^t_j]\right]$ \Comment{Connectivity matrices}
\EndFor
\State $\pmb{C} \gets T^{-1} \sum_{t=1}^T \pmb{A}^t$ \Comment{Consensus matrix}
\State $\mu \gets n^{-2}\sum_{i,j}^{n} \pmb{C}_{ij}$
\State $\pmb{Q} \gets \left[\mathbbm{1}[\pmb{C}_{ij} \geq \mu]\right]$ \Comment{Binarise the consensus}
\For{$t\in \{1, \ldots, T\}$}
\State $\mathcal{S}^t \gets n^{-2}\sum_{i,j}^{n}\left|\pmb{Q}_{ij}-\pmb{A}_{ij}^t\right|$ \Comment{Score of model $t$}
\State $\mathcal{R}^t \gets 0$ \Comment{Regularisation by constraints}
\For{$(i,j) \in \mathcal{C}_\text{ML}$}
\State $\mathcal{R}^t \gets \mathcal{R}^t + (1-\pmb{A}_{ij}^t)$
\EndFor
\For{$(i,j) \in \mathcal{C}_\text{CL}$}
\State $\mathcal{R}^t \gets \mathcal{R}^t + \pmb{A}_{ij}^t$
\EndFor
\State $\mathcal{S}^t \gets \mathcal{S}^t + \frac{\mathcal{R}^t}{n_\text{ML}+n_\text{CL}}$ \Comment{Regularised DISCOTEC}
\EndFor
\end{algorithmic}
\end{algorithm}