Computing random $r$-orthogonal Latin squares
Sergey Bereg
TL;DR
The paper develops randomized, polynomial-time algorithms to construct pairs of $r$-orthogonal Latin squares ($r$-OLS) and $r$-self-orthogonal Latin squares ($r$-SOLS) of order $n$, enabling computation for larger $n$ than brute-force methods. It introduces constructive methods (A1–A4) that start from random initial rows and complete via SDR-based matchings and cycle-switching, with assignment-based refinements to maximize or minimize the resulting orthogonality $r$. Empirical results show broad coverage of the $r$-spectrum for $n$ from 5 to 20, although values near $r=n^2$ remain hard to reach and some spectra are still unresolved. The work also investigates the expected orthogonality between random squares, reporting empirical estimates around $0.63$ of $n^2$ for $r(A,B)$ and around $0.38$–$0.395$ of $n^2$ for $r(A,A^T)$, and identifies open questions about spectra and asymptotic behavior.
Abstract
Two Latin squares of order $n$ are $r$-orthogonal if, when superimposed, there are exactly $r$ distinct ordered pairs. The spectrum of all values of $r$ for Latin squares of order $n$ is known. A Latin square $A$ of order $n$ is $r$-self-orthogonal if $A$ and its transpose are $r$-orthogonal. The spectrum of all values of $r$ is known for all orders $n\ne 14$. We develop randomized algorithms for computing pairs of $r$-orthogonal Latin squares of order $n$ and algorithms for computing $r$-self-orthogonal Latin squares of order $n$.
