Simple algorithms for optimization on Riemannian manifolds with constraints

Abstract: We consider optimization problems on manifolds with equality and inequality constraints. A large body of work treats constrained optimization in Euclidean spaces. In this work, we consider extensions of existing algorithms from the Euclidean case to the Riemannian case. Thus, the variable lives on a known smooth manifold and is further constrained. In doing so, we exploit the growing literature on unconstrained Riemannian optimization. For the special case where the manifold is itself described by equality constraints, one could in principle treat the whole problem as a constrained problem in a Euclidean space. The main hypothesis we test here is whether it is sometimes better to exploit the geometry of the constraints, even if only for a subset of them. Specifically, this paper extends an augmented Lagrangian method and smoothed versions of an exact penalty method to the Riemannian case, together with some fundamental convergence results. Numerical experiments indicate some gains in computational efficiency and accuracy in some regimes for minimum balanced cut, non-negative PCA and $k$-means, especially in high dimensions.

\section{Introduction}
We consider the following problem:
    \begin{equation}\label{problem:mcp}
    \begin{aligned}
    & \underset{x}{\text{min}}
    & & f(x)\\
    & \text{subject to}
    & & x \in {\cal{M}} \\
    & & & g_i(x)\leq 0 \text{ for } i \in {\cal{I}} = \{1, \dots, n\}, \\
   & & & h_j(x) = 0 \text{ for } j \in {\cal{E}}  = \{n+1, \dots, n+m\},
    \end{aligned}
    \end{equation}
where ${\cal{M}}$ is a Riemannian manifold and $f, \{g_i\}, \{h_j\}$ are twice continuously differentiable functions from ${\cal{M}}$ to $\mathbb{R}$. The problems of this class have extra constraints in addition to the manifold constraint. Following the convention, we call problem~\eqref{problem:mcp} an Equality Constrained Problem (ECP) when only equality constraints exist, and an Inequality Constrained Problem (ICP) when only inequality constraints exist. If both equality and inequality constraints are present, we call it a Mixed Constrained Problem (MCP). Such problems feature naturally in applications. For instance, non-negative principal component analysis (PCA) is formulated as an optimization problem on a sphere in $\mathbb{R}^n$ with non-negativity constraints on each entry~\cite{zass2007nonnegative}. As another example, $k$-means can be formulated as a constrained optimization problem on the Stiefel manifold~\cite{carson2017manifold}. We discuss these more in Section~\ref{sec:XP}.

Necessary and sufficient optimality conditions for the general problem class (\ref{problem:mcp}) were derived in~\cite{yang2014optimality} and also recently in~\cite{bergmann2018intrinsic}---we summarize them in the next section. Some algorithmic approaches have been put forward in \cite{dreisigmeyer2006equality, kovnatsky2016madmm, birgin2016augmented,khuzani2017stochastic, zhang2017primal}. Nevertheless, and somewhat surprisingly, we find that there has been no systematic effort to survey and compare some of the most direct approaches to solve~\eqref{problem:mcp} based on prior work on the same problem class without the manifold constraint~\cite{bertsekas2014constrained} and with only the manifold constraint~\cite{absil2009optimization}.

Part of the reason may be that, in many applications, the manifold ${\cal{M}}$ is a submanifold of a Euclidean space, itself defined by equality constraints. In such cases, the manifold constraint can be treated as an additional set of equality constraints, and the problem can be solved using the rich expertise gained over the years for constrained optimization in $\mathbb{R}^n$. There are also existing software packages for it, such as Lancelot, KNITRO and Algencan \cite{birgin2014practical, conn2013lancelot, byrd2006knitro}.

Yet, based on the literature for unconstrained optimization on manifolds, we see that if the manifold ${\cal{M}}$ is nice enough, it pays to exploit its structure fully. In particular, much is now understood about optimizing over spheres, orthogonal groups, the Stiefel manifold of orthonormal matrices, the set of fixed-rank matrices, and many more. Furthermore, embracing the paradigm of optimization on manifolds also allows us to treat problems of class (\ref{problem:mcp}) where ${\cal{M}}$ is an abstract manifold, such as the Grassmannian manifold of linear subspaces. Admittedly, owing to Whitney's embedding theorem, abstract manifolds can also be embedded in a Euclidean space, and hence even those problems could in principle be treated using algorithms from the classical literature, but the mere existence of an embedding is often of little practical use.

In this paper, we survey some of the more classical methods for constrained optimization in $\mathbb{R}^n$ and straightforwardly extend them to the more general class (\ref{problem:mcp}), while preserving and exploiting the smooth geometry of $\cal{M}$. For each method, we check if some of the essential convergence results known in $\mathbb{R}^n$ extend as well. Then, we set up a number of numerical experiments for a few applications and report performance profiles. Our purpose in doing so is to gain some perspective as to which methods are more likely to yield reliable generic software for this problem class.

\subsection{Contributions}

As a first contribution, we study the augmented Lagrangian method (ALM) and the exact penalty method on general Riemannian manifolds. For ALM, we study local and global convergence properties. For the exact penalty method, each iteration involves the minimization of a sum of maximum functions, which we call a mini-sum-max problem. For this nonsmooth optimization subproblem, we study and tailor two types of existing algorithms---subgradient descent and smoothing methods. In particular, we propose a robust subgradient method without gradient sampling for mini-sum-max problems, which may be of interest in itself. For smoothing methods, we study the effect of two classical smoothing functions: Log-sum-exp and `Linear-Quadratic + Huber loss'.

As a second contribution, we perform numerical experiments on non-negative PCA, $k$-means and the minimum balanced cut problems to showcase the strengths and weaknesses of each algorithm. As a baseline, we compare our approach to the traditional approach, which would simply consider the manifold as an extra set of equality constraints. For this, we use \texttt{fmincon}: a general-purpose nonlinear programming solver in Matlab. For these problems, we find that some of our methods perform better than \texttt{fmincon} in high dimensional scenarios. Our solvers are generally slower in the low-dimensional case.

We present the algorithms and convergence analyses for ALM and the exact penalty method on Riemannian manifolds in Sections~\ref{sec:ALM} and~\ref{sec:EPM} respectively. Proofs are deferred to the appendix. Numerical experiments on various applications are reported in Section~\ref{sec:XP}.

\subsection{Related literature}
 Dreisigmeyer~\cite{dreisigmeyer2006equality} tackles ICPs on Euclidean submanifolds by pulling back the inequality constraints onto the tangent spaces of $\mathcal{M}$, and running direct search methods there. Yang et al.~\cite{yang2014optimality} provide necessary optimality conditions for our problem class~\eqref{problem:mcp}. Bergmann and Herzog~\cite{bergmann2018intrinsic} extend a range of constraint qualifications from the Euclidean setting to the smooth manifold setting. Kovnatsky et al.~\cite{kovnatsky2016madmm} generalize the alternating direction method of multipliers (ADMM) to the Riemannian case---the method handles nonsmooth optimization on manifolds via variable splitting, which produces an ECP. In~\cite{birgin2016augmented}, Birgin et al.\ deal with MCP in the Euclidean case by splitting constraints into upper-level and lower-level, and perform ALM on upper-level constrained optimization problems in a search space confined by lower-level constraints. When ${\cal{M}}$ is a submanifold of a Euclidean space chosen to describe the lower-level constraints, our Riemannian ALM reduces to their method. Khuzani and Li~\cite{khuzani2017stochastic} propose a primal-dual method to address ICP on Riemannian manifolds with bounded sectional curvature in a stochastic setting. Zhang et al.~\cite{zhang2017primal} propose an ADMM-like primal-dual method for nonconvex, nonsmooth optimization problems on submanifolds of Euclidean space coupled with linear constraints. Weber and Sra~\cite{weber2017frank} recently study a Franke--Wolfe method on manifolds to design projection-free methods for constrained, geodesically convex optimization on manifolds.

\section{Preliminaries and notations} \label{sec:prelims}

We briefly review some relevant concepts from Riemannian geometry, following the notations of~\cite{absil2009optimization}. Let the Riemannian manifold ${\cal{M}}$ be endowed with a Riemannian metric $\langle\cdot ,\cdot \rangle_x$ on each tangent space $\mathrm{T}_x{\cal{M}}$, where $x$ is in ${\cal{M}}$. Let $\|\cdot\|_x$ be the associated norm. We often omit the subscript $x$ when it is clear from context. Throughout the paper, we assume that ${\cal{M}}$ is a complete, smooth, finite-dimensional Riemannian manifold.

\subsection{Gradients and Hessians on manifolds}

The gradient at $x$ of a smooth function $f \colon {\cal{M}} \to \mathbb{R}$, $\operatorname{grad} f(x)$, is defined as the unique tangent vector at $x$ such that
\[
    \langle\operatorname{grad} f(x), v \rangle_x = \operatorname{D}\!f(x)[v],\quad \forall v\in \mathrm{T}_x{\cal{M}},
\]
where the right-hand side is the directional derivative of $f$ at $x$ along $v$.
Let $\mathrm{dist}(x,y)$ denote the Riemannian distance between $x,y\in{\cal{M}}$. For each $x\in{\cal{M}}$, let $\mathrm{Exp}_x \colon \mathrm{T}_x{\cal{M}}\rightarrow {\cal{M}}$ denote the exponential map at $x$ (that is, the map such that $t\mapsto\mathrm{Exp}_x(tv)$ is a geodesic passing through $x$ at $t = 0$ with velocity $v \in \mathrm{T}_x\mathcal{M}$). The injectivity radius is defined as:
\begin{equation}\label{eq:injectivity}
    {\mathit{i}}({\cal{M}}) = \inf_{x\in{\cal{M}}} \sup \{\epsilon>0: \mathrm{Exp}_x|_{\{\eta\in \mathrm{T}_x{\cal{M}}: \|\eta\|< \epsilon\}}\textrm{ is a diffeomorphism}\}.
\end{equation}
For any $x,y\in{\cal{M}}$ with $\mathrm{dist}(x,y) < {\mathit{i}}({\cal{M}})$, there is a unique minimizing geodesic connecting them, which gives rise to a parallel transport operator ${\cal{P}}_{x\rightarrow y}:\mathrm{T}_x{\cal{M}}\rightarrow \mathrm{T}_y{\cal{M}}$ as an isometry between two tangent spaces.

\begin{definition}[Hessian, \cite{absil2009optimization}, Definition 5.5.1]
    Given a smooth function $f \colon \mathcal{M} \to \mathbb{R}$, the $\mathrm{Riemannian\ Hessian}$ of $f$ at a point $x$ in ${\cal{M}}$ is the linear mapping $\mathrm{Hess} f(x)$ of $\mathrm{T}_x{\cal{M}}$ into itself defined by
    \[
        \mathrm{Hess} f(x)[\xi_x] = \nabla_{\xi_x}\operatorname{grad} f
    \]
    for all $\xi_x$ in $\mathrm{T}_x{\cal{M}}$, where $\nabla$ is the Riemannian connection on ${\cal{M}}$.
\end{definition}

Using the exponential map, one can also understand the Riemannian gradient and Hessian through the following identities~\cite[Eq.~(4.4) and Prop.~5.5.4]{absil2009optimization}:
\begin{align}
	\operatorname{grad} f(x) & = \operatorname{grad}(f \circ \operatorname{Exp}_x)(0_x), & \operatorname{Hess} f(x) & = \operatorname{Hess}(f \circ \operatorname{Exp}_x)(0_x),
	\label{eq:gradHesspullbackExp}
\end{align}
where $0_x$ is the zero vector in $\mathrm{T}_x\mathcal{M}$ and $f \circ \operatorname{Exp}_x \colon \mathrm{T}_x\mathcal{M} \to \mathbb{R}$ is defined on a Euclidean space with a metric, so that its gradient and Hessian are defined in the usual sense. The composition $f \circ \operatorname{Exp}_x$ is also called the pullback of $f$ to the tangent space at $x$.

\subsection{Optimality conditions}\label{sec:optcon}
Let $\Omega$ denote the set of feasible points on ${\cal{M}}$ satisfying the constraints in~\eqref{problem:mcp}. At $x\in{\cal{M}}$, let ${\cal{I}}$ denote the set of $n$ inequality constraints, and ${\cal{E}}$ the set of $m$ equality constraints. Let ${\cal{A}}(x)$ denote the active set of constraints, that is,
\begin{align}
	{\cal{A}}(x) & = {\cal{E}}\cup \{i\in {\cal{I}}| g_i(x)=0\}.
\end{align}
The Langrangian of $(\ref{problem:mcp}$) is defined similarly to the Euclidean case as
\begin{equation}\label{lagrangian}
    {\cal{L}}(x,\lambda,\gamma) = f(x) + \sum_{i\in {\cal{I}}} \lambda_i g_i(x) + \sum_{j\in {\cal{E}}} \gamma_j h_j(x),
\end{equation}
where $\lambda_i$, $\gamma_j$ are vector entries of $\lambda \in \mathbb{R}^n$ and $\gamma \in \mathbb{R}^m$. Following \cite{yang2014optimality}, constraint qualifications and optimality conditions are generalized as follows:
\begin{definition}[LICQ, \cite{yang2014optimality}, eq.~(4.3)]
Linear independence constraint qualifications (LICQ) are said to hold at $x\in {\cal{M}}$ if
\begin{equation}\label{def:licq}
    \{\operatorname{grad} g_i(x), \operatorname{grad} h_j(x), i \in {\cal{A}}(x)\cap {\cal{I}}, j\in{\cal{E}} \} \text{ are linearly independent in $\mathrm{T}_x{\cal{M}}$}.
\end{equation}
\end{definition}

\begin{definition}[First-Order Necessary Conditions (KKT conditions), \cite{yang2014optimality}, eq.~(4.8)]\label{prop:fonc} Given an MCP as in (\ref{problem:mcp}), $x^*\in\Omega$ is said to satisfy KKT conditions if there exist Lagrange multipliers $\lambda^*$ and $\gamma^*$ such that the following hold:
    \begin{align}\nonumber
        &\operatorname{grad} f(x^*) + \sum_{i\in {\cal{I}}} \lambda_i^* \operatorname{grad} g_i(x) + \sum_{j\in {\cal{E}}} \gamma_i^* \operatorname{grad} h_j(x) = 0,\\ \label{cond:first}
        &h_j(x^*) = 0, \text{ for all $j\in {\cal{E}}$, and}\\\nonumber
        &g_i(x^*) \leq 0,\ \lambda_i^*\geq 0,\ \lambda_i^*g_i^{}(x^*) = 0  \text{ for all $i\in {\cal{I}}$.}
    \end{align}
\end{definition}

For the purpose of identifying second-order optimality conditions at $x^*$ with associated $\lambda^*$ and $\gamma^*$, consider the critical cone $F(x^*, \lambda^*, \gamma^*)$ inside the tangent space at $x^*$ defined as follows; see \cite[\S4.2]{yang2014optimality}\cite[\S12.4]{Nocedal2006NO}:

\begin{equation}\label{set:f2}
  v \in F(x^*,\lambda^*, \gamma^*) \Leftrightarrow \begin{cases}
            v\in \mathrm{T}_{x^*}{\cal{M}}, &\\
    \langle \operatorname{grad} h_j(x^*), v\rangle = 0& \textrm{ for all }j\in {\cal{E}} ,\\
    \langle \operatorname{grad} g_i(x^*), v\rangle = 0& \textrm{ for all }i\in {\cal{A}}(x^*)\cap{\cal{I}} \textrm{ with }\lambda_i^* >0\textrm{, and}\\
    \langle \operatorname{grad} g_i(x^*), v\rangle \leq 0& \textrm{ for all }i\in {\cal{A}}(x^*)\cap{\cal{I}} \textrm{ with }\lambda_i^* = 0. \\
  \end{cases}
\end{equation}

\begin{definition}[Second-Order Necessary Conditions (SONC), \cite{yang2014optimality}, Theorem 4.2]\label{def:sonc}
    Given an MCP as in (\ref{problem:mcp}), $x^*\in\Omega$ is said to satisfy SONCs if it satisfies KKT conditions with associated Lagrange multiplier $\lambda^*$ and $\gamma^*$, and if
    \[
        \langle v, \mathrm{Hess}_x {\cal{L}} (x^*,\lambda^*,\gamma^*) v\rangle \geq 0, \textrm{ for any } v\in F(x^*, \lambda^*, \gamma^*),
    \]
    where the Hessian is taken with respect to the first variable of $\mathcal{L}$, on $\mathcal{M}$.
\end{definition}

\begin{definition}[Second-Order Sufficient Conditions (SOSC), \cite{yang2014optimality}, Theorem 4.3] \label{def:sosc}
    Given an MCP as in (\ref{problem:mcp}), $x^*\in\Omega$ is said to satisfy SOSCs if it satisfies KKT conditions with associated Lagrange multiplier $\lambda^*$ and $\gamma^*$, and if
    \[
        \langle v, \mathrm{Hess}_x {\cal{L}} (x^*,\lambda^*,\gamma^*) v\rangle > 0, \textrm{ for any } v\in F(x^*, \lambda^*, \gamma^*),\ v\neq 0.
    \]
\end{definition}

\begin{proposition}[\cite{yang2014optimality}, Theorem 4.1, 4.2]\label{prop:sonc}
 If $x^*$ is a local minimum of a given MCP and LICQ holds at $x^*$, then $x^*$ satisfies KKT conditions and SONCs.
\end{proposition}
\begin{proposition}[\cite{yang2014optimality}, Theorem 4.3]\label{prop:sosc}
If $x^*$ satisfies SOSCs for a given MCP, then it is a strict local minimum.
\end{proposition}

\section{Riemannian augmented Lagrangian methods} \label{sec:ALM}

The augmented Lagrangian method (ALM) is a popular algorithm for constrained nonlinear programming of the form of (\ref{problem:mcp}) with ${\cal{M}} = \mathbb{R}^{d}$. At its core, ALM relies on the definition of the \emph{augmented} Lagrangian function~\cite[eq.~(4.3)]{birgin2014practical}:
\begin{equation}\label{eq:alm}
    {\cal{L}}_\rho(x, \lambda, \gamma) = f(x) + \frac{\rho}{2}\left(\sum_{j\in {\cal{E}}} \left(h_j(x)+\frac{\gamma_j}{\rho}\right)^2+ \sum_{i\in {\cal{I}}} \max\left\{0, \frac{\lambda_i}{\rho}+g_i(x)\right\}^2 \right),
\end{equation}
where $\rho > 0$ is a penalty parameter, and $\gamma \in \mathbb{R}^m, \lambda \in \mathbb{R}^n, \lambda \geq 0$. ALM alternates between updating $x$ and updating $(\lambda,\gamma)$. To update $x$, any algorithm for unconstrained optimization may be adopted to minimize~\eqref{eq:alm} with $(\lambda,\gamma)$ fixed. We shall call the chosen solver the \emph{subsolver}. To update $(\lambda,\gamma)$, a clipped gradient-type update rule is used.  A vast literature covers ALM in the Euclidean case. We direct the reader in particular to the recent monograph by Birgin and Mart\'inez~\cite{birgin2014practical}.

The Lagrangian function as defined in~\eqref{eq:alm} generalizes seamlessly to the Riemannian case simply by restricting $x$ to live on the manifold ${\cal{M}}$. Importantly, $\mathcal{L}_\rho$ is continuously differentiable in $x$ under our assumptions. The corresponding ALM algorithm is easily extended to the Riemannian case as well: subsolvers are now optimization algorithms for unconstrained optimization on manifolds. We refer to this approach as Riemannian ALM, or RALM; see Algorithm~\ref{algo:alm}, in which the clip operator is defined by
\begin{align*}
	\operatorname{clip}_{[a, b]}(x) = \max\{a, \min(b, x)\}.
\end{align*}

\begin{algorithm}[t]\label{algo:alm}
\SetAlgoLined
\SetKw{KwRequire}{Require: }
\SetKw{KwInput}{Input: }
\KwRequire{Riemannian manifold $\cal{M}$, twice continuously differentiable functions $f$, $\{g_i\}_{i\in{\cal{I}}}$, $\{h_j\}_{j\in{\cal{E}}} \colon \cal{M} \rightarrow \mathbb{R}$.}	 \\
\KwInput{Starting point $x_0\in{\cal{M}}$, starting Lagrangian vectors $\lambda^0 \in \mathbb{R}^n$, $\gamma^0 \in \mathbb{R}^m$, accuracy tolerance $\epsilon_{\min}$, starting accuracy $\epsilon_0 > 0$, starting penalty coefficient $\rho_0$, constants $\theta_\epsilon \in (0,1)$, $\theta_\rho > 1$, multiplier boundaries $\lambda^{\max}\in \mathbb{R}^n$, $\gamma^{\min}, \gamma^{\max}\in \mathbb{R}^m$ with $\gamma^{\min}_i \leq \gamma^{\max}_i$ for each $i\in{\cal{I}}$, ratio $\theta_{\sigma}\in (0,1)$, minimum step size $d_{\min}$.} \\
 \For{$k = 0,1,\dots$}{

    Compute $x_{k+1}$---an approximate solution to the following problem within a tolerance $\epsilon_{k}$:
    \begin{equation}\label{eq:almprob}
    \begin{aligned}
    & \underset{x\in {\cal{M}}}{\text{min}}
    & & {\cal{L}}_{\rho_k}(x, \lambda^k, \gamma^k).\\
    \end{aligned}
    \end{equation}

    \If{$\mathrm{dist}(x_k, x_{k+1}) < d_{\min}$ $\mathrm{and}$ $\epsilon_k \leq \epsilon_{\min}$}{
        Return $x_{k+1}$\;
    }
    $\gamma_j^{k+1} = \operatorname{clip}_{[\gamma_j^{\min}, \gamma_j^{\max}]}(\gamma_j^k + \rho_k h_j(x_{k+1}))$, for $j\in {\cal{E}}$\;
    $\lambda_i^{k+1}= \operatorname{clip}_{[\lambda_i^{\min},\lambda_i^{max}]}(\lambda_i^k + \rho_k g_i(x_{k+1}))$, for $i\in {\cal{I}}$\;
    $\sigma^{k+1}_i = \max\left\{g_i(x_{k+1}), - \frac{\lambda^{k}_i}{\rho_k}\right\}$, for $i\in {\cal{I}}$\;
    $\epsilon_{k+1} = \max\left\{\epsilon_{\min}, \theta_\epsilon \epsilon_k\right\}$\;
    \eIf{$k=0$ $\mathrm{or}$ $\max_{j\in {\cal{E}}, i\in {\cal{I}}}\left\{|h_j(x_{k+1})|, |\sigma^{k+1}_i|\right\} \leq \theta_{\sigma}\max_{j\in {\cal{E}}, i\in {\cal{I}}}\left\{|h_j(x_{k})|, |\sigma^{k}_i|\right\}$}{
        $\rho_{k+1} = \rho_k$\;
    }{
    	$\rho_{k+1} = \theta_\rho \rho_k$\;
	}
 }
\caption{Riemannian augmented Lagrangian method (RALM)}
\end{algorithm}
In practice, solving~\eqref{eq:almprob} (approximately) involves running any standard algorithm for smooth, unconstrained optimization on manifolds with warm-start at $x_k$. Various kinds of tolerances for this subproblem solve will be discussed, which lead to different convergence results. We note that this approach of separating out a subset of the constraints that have special, exploitable structure in ALM is in the same spirit as the general approach in~\cite{andreani2007augmented} and in~\cite[\S2.4]{bertsekas2014constrained}.

 Notice that, in Algorithm \ref{algo:alm}, there are safeguards designed for multipliers and a conditioned update on the penalty coefficient $\rho$---updates are executed only when constraint violations are shrinking fast enough, which helps alleviate the effect of ill-conditioning and improves robustness; see~\cite{birgin2014practical, kanzow2017example}. As each subproblem (\ref{eq:almprob}) is an unconstrained problem with sufficiently smooth objective function, various Riemannian optimization methods can be used. In particular, we mention the Riemannian gradient descent, non-linear conjugate gradients and trust-regions methods, all described in~\cite{absil2009optimization} and available in ready-to-use toolboxes~\cite{boumal2014manopt, pymanopt, roptlib}.

Global and local convergence properties of ALM in the Euclidean case have been studied extensively; see~\cite{andreani2007augmented, andreani2011sequential, bertsekas1999nonlinear, birgin2016augmented, birgin2010global}, among others. Some of the results available in the literature are phrased in sufficiently general terms that they readily apply to the Riemannian case, even though the Riemannian case was not necessarily explicitly acknowledged. This applies to Proposition~\ref{prop:almglobal} below. To extend certain other results, minor modifications to the Euclidean proofs are necessary. Propositions~\ref{prop:almfirst} and \ref{prop:almsecond} are among those. Here and in the next section, we state some of the more relevant results explicitly for the Riemannian case. For the sake of completeness, we include full proofs in the appendix, stressing again that they are either existing proofs or simple adaptations of existing proofs.

Whether or not Algorithm~\ref{algo:alm} converges depends on the tolerances for the subproblems, and the ability of the subsolver to return a point that satisfies them. In general, solving the unconstrained subproblem~\eqref{eq:alm} to global optimality---even within a tolerance on the objective function value---is hard. In practice, that step is implemented by running a local optimization solver which, often, can only guarantee convergence to an approximate first- or second-order stationary point. Nevertheless, practice suggests that for many applications these local solvers perform well. An important question then becomes: assuming the subproblems are indeed solved within appropriate tolerances, does Algorithm~\ref{algo:alm} converge? In the following three propositions, we partially characterize the limit points generated by the algorithm assuming either that the subproblems are solved almost to global optimality, which is difficult to guarantee, or assuming approximate stationary points are computed, which we can guarantee~\cite{boumal2016globalrates,bento2017iterationcomplexity,zhang2018cubicregmanifold,agarwal2018arcfirst}.

We first consider the case when we have a global subsolver up to some tolerance on the cost for each iteration. This affords the following result:
\begin{proposition}\label{prop:almglobal}
In Algorithm \ref{algo:alm} with $\epsilon_{\min} = 0$ (so that the algorithm produces an infinite sequence with $\epsilon_k \to 0$), if at each iteration $k$ the subsolver produces a point $x_{k+1}$ satisfying
\begin{equation}\label{eq:almstoppingcrt2}
    {\cal{L}}_{\rho_k}(x_{k+1},\lambda^k,\gamma^k) \leq {\cal{L}}_{\rho_k}(z,\lambda^k,\gamma^k) + \epsilon_k,
\end{equation}
where $z$ is a feasible global minimizer of the original MCP, and if $\{x_k\}_{k=0}^\infty$ has a limit point $\overline{x}$, then $\overline{x}$ is a global minimizer of the original MCP.
\end{proposition}
\begin{proof}
See Theorems 1 and 2 in \cite{birgin2010global}. The proofs in that reference apply verbatim to the Riemannian case.
\end{proof}

However, most Riemannian optimization methods only return approximately first- or second-order approximate stationary points. In the first-order case, we have the following:

\begin{proposition}\label{prop:almfirst}
In Algorithm \ref{algo:alm} with $\epsilon_{\min} = 0$, if at each iteration $k$ the subsolver produces a point $x_{k+1}$ satisfying
\begin{equation}\label{eq:almstoppingcrt1}
    \|\operatorname{grad}_x {\cal{L}}_{\rho_k}(x_{k+1}, \lambda^k, \gamma^k)\| \leq \epsilon_k,
\end{equation}
and if the sequence $\{x_k\}_{k=0}^\infty$ has a limit point $\overline{x}\in\Omega$ where LICQ is satisfied, then $\overline{x}$ satisfies KKT conditions of the original MCP.
\end{proposition}
\begin{proof}
The proof is an easy adaptation of that of Theorem 4.2 in~\cite{andreani2007augmented}: see Appendix~\ref{appendixalmfirst}.
\end{proof}

In the second-order case, we consider problems with equality constraints only, because when inequality constraints are present the augmented function (\ref{eq:alm}) may not be twice differentiable. (See \cite{bertsekas2014constrained} for possible solutions to this particular issue.) We consider the notion of Weak Second-Order Necessary Conditions on manifolds, which parallels the Euclidean case definition in~\cite{andreani2017second, guo2013second}.
\begin{definition}[Weak Second-Order Necessary Conditions (WSONC)] \label{def:wsonc}
    Given an MCP as in \eqref{problem:mcp}, a feasible point $x^*\in \Omega$ satisfies WSONC if it satisfies KKT conditions with multipliers $\lambda^*\in \mathbb{R}^n_+$ and $\gamma^*\in \mathbb{R}^m$ such that\footnote{Note that this condition involves $\cal{L}$ as defined in Section~\ref{sec:optcon}, not ${\cal{L}}_\rho$.}
    \[
        \langle v, \mathrm{Hess}_{x}{\cal{L}}(x^*,\lambda^*)v\rangle \geq 0,\textrm{ for any } v \in {\cal{C}}^W(x^*),
    \]
    where
    \[
        v \in {\cal{C}}^W(x^*) \Leftrightarrow \begin{cases}
            v\in \mathrm{T}_{x^*}{\cal{M}}, &\\
        \langle \operatorname{grad} h_j(x^*), v\rangle = 0& \textrm{ for all }j\in {\cal{E}},\textrm{ and}\\
        \langle \operatorname{grad} g_i(x^*), v\rangle = 0& \textrm{ for all }i\in {\cal{A}}(x^*)\cap{\cal{I}}.\\
        \end{cases}
    \]
\end{definition}
Note that the cone ${\cal{C}}^W$ in Definition~\ref{def:wsonc} is smaller than the cone $F$~\eqref{set:f2} used to define SONC. Even in Euclidean space, most algorithms do not converge to feasible SONC points in general, so we would not expect more in the Riemannian case; see~\cite{andreani2017second, gould1999note}. $C^W$ is called weak critical cone in~\cite[Def.~2.2]{andreani2017second}.

\begin{proposition}\label{prop:almsecond}
Consider an ECP (problem~\eqref{problem:mcp} without inequalities) with $|\cal{E}| < \mathrm{dim}({\cal{M}})$. In Algorithm~\ref{algo:alm} with $\epsilon_{\min} = 0$, suppose that at each iteration $k$ the subsolver produces a point $x_{k+1}$ satisfying
\begin{equation}\label{eq:almstoppingcrt11}
    \|\operatorname{grad}_x {\cal{L}}_{\rho_k}(x_{k+1}, \lambda^k, \gamma^k)\| <\epsilon_k
    \end{equation}
    and
    \begin{equation}\label{eq:almstoppingcrt12}
    \mathrm{Hess}_x {\cal{L}}_{\rho_k}(x_{k+1}, \lambda^k, \gamma^k) \succeq -\epsilon_k I
    \end{equation}
    (meaning all eigenvalues of the Hessian are at or above $-\epsilon_k$).
    If the sequence generated by the algorithm has a limit point $\overline{x}\in\Omega$ where LICQ is satisfied, then $\overline{x}$ satisfies the WSONC conditions of the original ECP.
\end{proposition}
\begin{proof}
	The proof is adapted from Section 3 in~\cite{andreani2017second}: see Appendix~\ref{appendixalmsecond}.
\end{proof}

\section{Exact penalty method} \label{sec:EPM}
Another standard approach to handle constraints is the so-called exact penalty method. As a replacement for the constraints, the method supplements the cost function with a weighted $L_1$ penalty for violating the constraints. This leads to a nonsmooth, unconstrained optimization problem.
In the Riemannian case, to solve problem (\ref{problem:mcp}), this approach suggests solving the following program, where $\rho > 0$ is a penalty weight:
    \begin{equation}\label{l1sumpenalty:eq}
    \begin{aligned}
    & \underset{x\in {\cal{M}}}{\text{min}}
    & & f(x) + \rho \left(\sum_{i\in{\cal{I}}}\text{max}\{0, g_i(x)\} + \sum_{j\in{\cal{E}}}|h_j(x)|\right).\\
    \end{aligned}
    \end{equation}
In the Euclidean case, it is known that only a finite penalty weight $\rho$ is needed for exact satisfaction of constraints, hence the name~\cite[Ch.~15, 17]{Nocedal2006NO}. We have the following analogous property in the Riemannian case.
\begin{proposition}\label{l1sum:prop}
    If $x^*$ is a local minimum for problem~\eqref{problem:mcp} and it satisfies SOSC with KKT multipliers $\lambda^*, \gamma^*$, then for any $\rho$ such that $\rho > \max_{i\in{\cal{I}}, j\in{\cal{E}}}\{|\lambda_i^*|, |\gamma_j^*|\}$, $x^*$ is also a local minimum for~\eqref{l1sumpenalty:eq}.
\end{proposition}
\begin{proof}
The proof resembles that of Theorem 6.9 in \cite{ruszczynski2006nonlinear}: see Appendix~\ref{appendl1sum:prop}.
\end{proof}
Notice that the resulting penalized cost function is nonsmooth: such problems may be challenging in general. Fortunately, the cost function in~\eqref{l1sumpenalty:eq} is a sum of maximum functions and absolute values functions: this special structure can be exploited algorithmically. We explore two general strategies: first, we explore smoothing techniques; then, we explore a particular nonsmooth Riemannian optimization algorithm.

\subsection{Smoothing technique}\label{sec:REPMS}

We discuss two smoothing methods for~\eqref{l1sumpenalty:eq}. A first approach is to note that the absolute value function can be written as a max function: $|x| = \max\{x, -x\}$. Thus, the nonsmooth part of the cost function in~\eqref{l1sumpenalty:eq} is a linear combination of max functions between two terms. A popular smoothing for a two-term maximum is the log-sum-exp function~\cite{chen1995smoothing}: $\max\{a, b\} \approx u\log(e^{a/u}+e^{b/u})$, with smoothing parameter $u > 0$. This yields the following smooth, unconstrained problem on a manifold, where $\rho, u$ are fixed constants:
    \begin{equation}\label{eq:qlse}
    \begin{aligned}
    & \underset{x\in {\cal{M}}}{\text{min}}
    & & Q^{\textrm{lse}}(x,\rho, u) = f(x) +\rho\sum_{i\in{\cal{I}}} u\log (1+e^{g_i(x)/u}) +\rho\sum_{j\in{\cal{E}}} u\log(e^{h_j(x)/u}+e^{-h_j(x)/u}).\\
    \end{aligned}
    \end{equation}
Another common approach is to smooth the absolute value and the max in~\eqref{l1sumpenalty:eq} separately, using respectively a pseudo-Huber loss~\cite{cambier2016robust} and a linear-quadratic loss~\cite{pinar1994smoothing}. Here, still with smoothing parameter $u > 0$, we use $|x| \approx \sqrt{x^2 + u^2}$ and $\max\{0, x\} \approx {\cal{P}}(x,u)$ where
\[
{\cal{P}}(x,u) =  \begin{cases}
            0 &\textrm{ if } x\leq 0\\
            \frac{x^2}{2u}&\textrm{ if } 0\leq x\leq u\\
            x-\frac{u}{2} &\textrm{ if } x\geq u.\\
        \end{cases}
\] Such approximation yields, for fixed constants $\rho, u$, the following problem:
    \begin{equation}\label{eq:qlqh}
    \begin{aligned}
    & \underset{x\in {\cal{M}}}{\text{min}}
    & &     Q^{\textrm{lqh}}(x,\rho, u) = f(x) + \rho\sum_{i\in{\cal{I}}} {\cal{P}}(g_i(x),u)+\rho\sum_{j\in{\cal{E}}} \sqrt{h_j(x)^2+u^2}.\\
    \end{aligned}
    \end{equation}

Note that $Q^{\textrm{lse}}$ and $Q^{\textrm{lqh}}$ are both continuously differentiable and thus we can optimize them with smooth solvers on manifolds. In view of Proposition \ref{l1sum:prop}, in the absence of smoothing, there exists a threshold such that, if $\rho$ is set above that threshold, then optima of the penalized problem coincide with optima of the target problem. However, we often do not know this threshold, and furthermore setting $\rho$ at a high value with a poor initial iterate can lead to poor conditioning and slow convergence. A common practice is to set a relatively low initial $\rho$, optimize, and iteratively increase $\rho$ and re-optimize with a warm start. This is formalized in Algorthm~\ref{algo:smoothing}, which we here call Riemannian Exact Penalty Method via Smoothing (REPMS). In the algorithm and in the discussion below, $\mathrm{update}_\rho$ is a (fixed) Boolean flag indicating whether $\rho$ is dynamically increased or not: this allows to discuss both versions of the algorithm.

\begin{algorithm}[h]
\SetAlgoLined
\SetKw{KwRequire}{Require: }
\SetKw{KwInput}{Input: }
\KwRequire{Riemannian manifold ${\cal{M}}$, twice continuously differentiable functions $f$, $\{g_i\}_{i\in{\cal{I}}}$, $\{h_j\}_{j\in{\cal{E}}} \colon {\cal{M}} \rightarrow \mathbb{R}$.} \\
\KwInput{Starting point $x_0 \in \cal{M}$, accuracy tolerance $\epsilon_{\min}$, starting accuracy $\epsilon_0$, starting penalty coefficient $\rho_0$, starting approx-accuracy $u_0$, minimum approx-accuracy $u_{\min}$, constants $\theta_\epsilon, \theta_u\in (0,1)$, $\theta_\rho > 1$, $\tau \geq 0$, $Q\in\{Q^{\mathrm{lse}}, Q^{\mathrm{lqh}}\}$, minimum step length $d_{\min}$, $\mathrm{update}_\rho\in \{\mathrm{True,False}\}$.}\\
 \For{k = 0,1,2\dots}{
    To obtain $x_{k+1}$, choose any subsolver to approximately solve
    \begin{equation}
    \begin{aligned}
    & \underset{x\in {\cal{M}}}{\text{min}}
    & & Q(x,\rho_k,u_k)\\
    \end{aligned}
    \end{equation}
    with warm-start at $x_k$ and stopping criterion
    \begin{align*}
	    \|\operatorname{grad} Q(x,\rho_k,u_k)\| \leq \epsilon_k.
    \end{align*}\\
    \If{$\mathrm{dist}(x_k, x_{k+1}) < d_{\min}$ and $\epsilon_k \leq \epsilon_{\min}$ and $u_k \leq u_{\min}$}{
        Return $x_{k+1}$\;
    }
    $\epsilon_{k+1} = \max\{\epsilon_{\min}, \theta_\epsilon \epsilon_k\};\ u_{k+1} = \max\{u_{\min}, \theta_u u_k\}$\;
    \eIf{$\mathrm{update}_\rho =\mathrm{True}$ \rm{and} ($k=0$ \text{or} $\max_{j\in {\cal{E}}, i\in {\cal{I}}}\left\{|h_j(x_{k+1})|, g_i(x_{k+1})\right\}\geq \tau$)}{
        $\rho_{k+1} = \theta_\rho\rho_k$
    }{
    $\rho_{k+1} = \rho_k$\;
    }
 }
\caption{Riemannian Exact Penalty Method via Smoothing (REPMS)}\label{algo:smoothing}
\end{algorithm}

The stopping criterion parameters $(d_{\min},u_{\min},\epsilon_{\min})$ are lower-bounds introduced in the algorithm for practical purposes. The algorithm terminates when the step size is too small while the approximation accuracy is high and the tolerance for the subsolver is low. On the other hand, if $u_k$ is too small, numerical difficulties may arise in these two approximation functions. Numerical concerns aside, in theory (exact arithmetic), if we set these parameters to 0, then the following convergence result holds, similar to its Euclidean counterpart of quadratic penalty method \cite[\S17.1]{Nocedal2006NO}.
\begin{proposition}\label{prop:smoothconv}
In Algorithm \ref{algo:smoothing}, suppose we set $d_{\min} = u_{\min}=\epsilon_{\min} = 0$ and $\mathrm{update}_\rho = \mathrm{False}$. If the sequence $\{x_k\}$ produced by the subsolver admits a feasible limit point $\overline{x}$ where LICQ conditions hold, then $\overline{x}$ satisfies KKT conditions for~\eqref{problem:mcp}.
\end{proposition}
\begin{proof}
See Appendix~\ref{appendlsmoothconv}.
\end{proof}
The conditions of this proposition are only likely to hold if $\rho_0$ (the initial penalty) is sufficiently large, as described in Proposition~\ref{l1sum:prop}. Instead of trying to set $\rho_0$ above the unknown threshold, we may increase $\rho$ in every iteration. When $\mathrm{update}_\rho = \mathrm{True}$, the update of $\rho$ is a heuristic featured in~\cite{pinar1994smoothing} in the Euclidean case: it gives a conditioned increase on the penalty parameter. Intuitively, when the obtained point is far from feasible, the penalty coefficient is likely too small so that the penalty parameter is increased.

\subsection{A subgradient method for sums of maximum functions}\label{sec:REPMSD}
Instead of smoothing, one may attempt to optimize the nonsmooth objective function directly. In this pursuit, the subgradient descent algorithm on Riemannian manifolds, and its variants, have received much attention in recent years; see \cite{absil2017collection, grohs2016varepsilon, hosseini2016line}. These algorithms work for general locally Lipschitz objective functions on manifolds, and would work here as well. However, notice that (\ref{l1sumpenalty:eq}) takes the exploitable form of minimizing a sum of maximum functions:
    \begin{equation}\label{eq:epmobjfunc}
    \begin{aligned}
    & \underset{x\in {\cal{M}}}{\text{min}}
    & & f(x) + \sum_{i\in{\cal{I}}}\text{max}\{0, \rho g_i(x)\} + \sum_{i\in{\cal{E}}}\text{max}\{\rho h_i(x), - \rho h_i(x)\}.
    \end{aligned}
    \end{equation}
We hence propose a robust version of subgradient descent for sums of maximum functions, which may be of interest in its own right. We refer to it as Riemannian Exact Penalty Method via Subgradient Descent (REPMSD).
However, due to the lengthy specification of this method and its poor performance in numerical experiments, we will only give an overview here and report its performance in Section~\ref{sec:XP}.

In the Euclidean case, subgradient descent with line search performs two steps---finding a good descent direction and performing line search to get the next point. To find a descent direction, one often wants access to the subdifferential at the current point, because it contains a descent direction. This generalizes to the Riemannian case. We refer readers to \cite{ hosseini2016line, grohs2016varepsilon, clarke1990optimization} for the definition of \textit{generalized subdifferential}, which we denote as $\partial f(x)$ for $f\colon{\cal{M}} \to \mathbb{R}$. Note that obtaining full information of the subdifferential is generally difficult, and thus many algorithms \textit{sample} the gradients around the current point to approximate it. However, for a sum of maximum functions, the subdifferential is directly accessible. This class of problems, which includes~\eqref{eq:epmobjfunc}, takes the form:
    \begin{equation}\label{problem:minisummax}
    \begin{aligned}
    & \underset{x\in {\cal{M}}}{\text{min}}
    & & f(x)=\sum_{i=1}^m \max \{f_{i,j}(x)| j = 1, \ldots, n_i\},\\
    \end{aligned}
    \end{equation}
where each function $f_{i,j} \colon \mathcal{M} \to \mathbb{R}$ is twice continuously differentiable. Notice that
\begin{equation}\label{eq:minimaxequi}
f(x) = \sum_{i=1}^m \max \{f_{i,j}(x)| j = 1,\ldots, n_i\} = \max_{1\leq j_i\leq n_i\text{ for } i=1\dots m}{\sum_{i=1}^mf_{i,j_i}(x)}.
\end{equation}
For a given $i$ in $1, \ldots, m$ and a given $x\in{\cal{M}}$, let ${\cal{I}}_i$ index the set of functions $f_{i,j}$ which attain the maximum for that $i$:
\begin{align*}
	{\cal{I}}_i & = \{1\leq j \leq n_i \ | \ f_{i,j} (x) = \max\{f_{i,j_i}(x)|j_i = 1\dots n_i\}\}.
\end{align*}
It is clear that for any choice of $j_i$'s (one for each $i$) such that $\sum_i f_{i,j_i}(x) = f(x)$, we have $j_i\in{\cal{I}}_i$ for all $i$. Thus, from the regularity of the maximum function as defined in~\cite{clarke1990optimization} and Proposition~2.3.12 in that same reference, exploiting the fact that pullbacks $f\circ \mathrm{Exp}_x$ are defined on the tangent space $\mathrm{T}_x\mathcal{M}$ which is a linear subspace, it can be shown using standard definitions of subdifferentials that
\[
    \partial (f\circ \mathrm{Exp}_x) (0_x) = \mathrm{Conv}\left\{\sum_{i=1}^m\operatorname{Grad} (f_{i,j_i}\circ \mathrm{Exp}_x) (0_x) \  \bigg\vert \textrm{ all possible choices of } j_i\in {\cal{I}}_i \right\},
\]
where we use the notation $\mathrm{Grad}$ to stress that this is a Euclidean gradient of the pullback on the tangent space, and the operator $\mathrm{Conv}$ returns the convex hull of given vectors. To be explicit, for each $i$, pick some $j_i$ in $\mathcal{I}_i$: this produces one vector by summation over $i$ as indicated; the convex hull is taken over all possible choices of the $j_i$'s. Then, with Proposition~2.5 of~\cite{hosseini2011generalized}, analogously to~\eqref{eq:gradHesspullbackExp}, we see that the generalized subdifferential of $f$ at $x$ is given by
\begin{align}
    \partial f (x) = \mathrm{Conv}\left\{\sum_{i=1}^m\operatorname{grad} f_{i,j_i}(x) \  \bigg\vert \textrm{ all possible choices of } j_i\in {\cal{I}}_i \right\}.
    \label{eq:subdifffminsummax}
\end{align}
This gives an explicit formula for the subdifferential of $f$ on $\mathcal{M}$. Whilst the traditional approach is often to get a descent direction directly from this subdifferential or to sample around the point, numerically, it makes sense to relax the condition and to replace ${\cal{I}}_i$ with an approximate subdifferential based on the (larger) set
\[
    {\cal{I}}_{i,\epsilon} = \{1\leq j \leq n_i \ | \  f_{i,j}(x) \geq \max \{f_{i,j}(x)| j = 1, \ldots, n_i\} - \epsilon\},
\]
where $\epsilon > 0$ is a tolerance. Then, one looks for a descent direction in
the subdifferential~\eqref{eq:subdifffminsummax} extended by substituting ${\cal{I}}_{i,\epsilon}$ for ${\cal{I}}_{i}$. For the latter, the classical approach with $\epsilon = 0$ is to look for a tangent vector of minimum norm in the convex hull: this involves solving a convex quadratic program. We here compute a minimum norm vector in the extended convex hull.
For the rest of the algorithm, we perform a classical Wolfe line search and use a limited-memory version of Riemannian BFGS (LRBFGS) updates based on the now well-known observation that BFGS works surprisingly well with nonsmoothness on Euclidean spaces~\cite{lewis2009nonsmooth} as well as on manifolds~\cite{hosseini2016line}---unfortunately we could not run full Riemannian BFGS as this is expensive on high dimensional manifolds. For details on Wolfe line search and BFGS, see Chapters~3, 8 and~9 of \cite{Nocedal2006NO}.

In closing, we note that there exist other methods for nonsmooth optimization, some of which apply on manifolds as well. In particular, we mention proximal point algorithms~\cite{parikh2014proximalalgorithms,bento2017iteration}, Douglas--Rachford-type methods~\cite{bergmann2016parallel} and iteratively reweighted least squares~\cite{chatterjee2013robustrotationaveraging}. We did not experiment with these methods here.

\section{Numerical experiments and discussion}\label{sec:XP}

\subsection{Problems and data}

We describe three applications which can be modeled within the framework of~\eqref{problem:mcp}. For each, we describe how we construct `baskets' of problem instances. These instances will be used to assess the performance of various algorithms. Code and datasets to reproduce the experiments are freely available.\footnote{\url{https://github.com/losangle/Optimization-on-manifolds-with-extra-constraints}.}

\subsubsection{Minimum balanced cut for graph bisection}
The minimum balanced cut problem is a graph problem: given an undirected graph, one seeks to partition the vertices into two clusters (i.e., bisecting the graph) such that the number of edges between clusters is as small as possible, while simultaneously ensuring that the two clusters have about the same size. A spectral method called ratio cut tackles this problem via optimization where the number of crossing edges and the imbalance are penalized in the objective function. However, in~\cite{lang2006fixing}, the author notes that for `power law graphs'---graphs whose degrees follow a power law distribution---this approach fails to enforce balance. Hence, the author proposes a method with stronger constraints to enforce balance: we sketch it below.

Let $L\in \mathbb{R}^{n\times n}$ denote the discrete Laplacian matrix of the given graph ($L = D - A$, where $D$ is the diagonal degree matrix and $A$ is the adjacency matrix). Furthermore, let $x \in \mathbb{R}^n$ be an indicator vector with entries in $\{-1, 1\}$ indicating which cluster each vertex belongs to. One can check that $\frac{1}{4}x^TLx$ evaluates to the number of edges crossing the two clusters. Let $e$ be the vector of 1's with length $n$. To enforce balance, $x^Te = 0$ is imposed, i.e., the number of vertices in the two clusters is the same (this only applies to graphs with an even number of vertices). However, directly solving this integer programming problem is difficult. The authors thus transform this discrete optimization problem into a continuous one. As a first step, the constraints $x_i = \pm 1$ for all $i$ are replaced by $\mathrm{diag}(xx^T) = e$, and the constraint $x^Te = 0$ is replaced by $(x^Te)^2 = e^T(xx^T)e = 0$. Then, $x \in \mathbb{R}^n$ is relaxed to a matrix $X \in \mathbb{R}^{n\times k}$ for some chosen $k$ in $1\ldots n$. Carrying over the constraints gives $\mathrm{diag}(XX^T) = e$, so that each row of $X$ is a unit vector, and $e^T(XX^T)e = 0$ is imposed. The problem then becomes:
\begin{equation} \label{eq:minbalcutXXt}
    \begin{aligned}
    & \underset{X\in \mathbb{R}^{n\times k}}{\text{min}}
    & & -\frac{1}{4}\mathrm{tr}(LXX^T)\\
    & \text{subject to}
   & &  \mathrm{diag}(XX^T) = e, \quad e^TXX^Te = 0,
    \end{aligned}
\end{equation}
 For $k = 1$, the problem is equivalent to the original problem. For $k = n$, the problem is equivalent to solving a (convex) semidefinite program (SDP) by considering $XX^T$ as a positive semidefinite matrix ($X$ can be recovered from Cholesky factorization). One may then use a standard clustering algorithm (for example $k$-means) on the rows of $X$ to obtain two clusters. By choosing $k > 1$, the problem becomes continuous (as opposed to discrete), which much extends the class of algorithms that we may apply to solve this problem. Furthermore, since for $k = n$ the problem is essentially convex (being equivalent to an SDP), we heuristically expect that for $k > 1$ the problem may be easier to solve than with $k = 1$.

To keep the dimensionality of the optimization problem low, it is of interest to consider $k > 1$ smaller than $n$, akin to a Burer--Monteiro approach~\cite{burer2003nonlinear}. We notice that $\mathrm{diag}(XX^T) = e$ defines an oblique manifold (a product of $n$ unit spheres in $\mathbb{R}^k$). Thus, we can view~\eqref{eq:minbalcutXXt} as a problem on the oblique manifold with a single constraint:
\begin{equation} \label{minbalancedcut}
    \begin{aligned}
    & \underset{X\in \mathrm{Oblique}(n, k)}{\text{min}}
    & & -\frac{1}{4}\mathrm{tr}(X^TLX)\\
    & \text{subject to}
   & & e^TXX^Te = 0.
    \end{aligned}
\end{equation}
This fits our problem class~\eqref{problem:mcp} with $\mathcal{M} = \mathrm{Oblique}(n, k)$ as an embedded Riemannian submanifold of $\mathbb{R}^{n \times k}$ and a single quadratic equality constraint.\\

\textbf{Input.}
We generate power law graphs with the Barab\'{a}si--Albert algorithm~\cite{barabasialbert2002graphs}. It starts off with a seed of a small connected graph, iteratively adds a vertex to the graph, and attaches $l$ edges to the existing vertices. For each edge, it is attached to a vertex with probability proportional to the current degree of the vertex. We generate the seed with Erd\H{o}s--R\'{e}nyi random graphs $G(n_{\mathrm{seed}},p)$, that is: $G(n_{\mathrm{seed}},p)$ is a random graph with $n_{\mathrm{seed}}$ nodes such that every two nodes are connected with probability $p$ independently of other edges. For each dimension $n\in\{50, 200, 500, 1000, 2000, 5000\}$, we collect a basket of problems by selecting a density $m\in\{0.005, 0.01, 0.02, 0.04, 0.08\}$, such that $l = mn$. For each set of parameters, we repeat the experiment four times with new graphs and new starting points. The seed is generated by $G(2\lceil mn\rceil, 0.5)$.

\subsubsection{Non-negative PCA}
We follow Montanari and Richard~\cite{montanari2016non} for this presentation of non-negative PCA. Let $v_0 \in \mathbb{R}^d$ be the spiked signal with $\|v_0\| = 1$. In the so-called spiked model, we are given the matrix $Z = \sqrt{SNR}\  v_0^{}v_0^T+N$, where $N$ is a random symmetric noise matrix and $SNR$ is the signal to noise ratio. For $N$, its off-diagonal entries follow a Gaussian distribution ${\cal{N}}(0, \frac{1}{n})$ and its diagonal entries follow a Gaussian distribution ${\cal{N}}(0, \frac{2}{n})$, i.i.d.\ up to symmetry. In classical PCA, we hope to recover the signal $v_0$ from finding the eigenvector that corresponds to the largest eigenvalue. That is, to solve the following problem:
\begin{equation} \label{classicalpca}
    \begin{aligned}
    & \underset{v\in \mathbb{R}^{d}}{\text{min}}
    & & -v^TZv\\
    & \text{subject to}
   & & \|v\| = 1.
    \end{aligned}
\end{equation}
However, it is well known that in the high dimensional regime, $n = O(d)$, this approach breaks down---the principal eigenvector of $Z$ is asymptotically less indicative of $v_0$; see \cite{johnstone2009consistency}.

One way of dealing with this problem is by introducing structures such as sparsity on the solution space. In~\cite{montanari2016non}, the authors impose nonnegativity of entries as prior knowledge, and propose to solve PCA restricted to the positive orthant:
\begin{equation} \label{nonnegpca}
    \begin{aligned}
    & \underset{v\in \mathbb{R}^{d}}{\text{min}}
    & & -v^TZv\\
    & \text{subject to}
   & & \|v\| = 1, v\geq 0.
    \end{aligned}
\end{equation}
Since $\|v\| = 1$ defines the unit sphere $\mathbf{S}^{d-1}$ in $\mathbb{R}^d$, one can write the above problem as
\begin{equation} \label{nonnegpcasdpbm}
    \begin{aligned}
    & \underset{v\in \mathbf{S}^{d-1}}{\text{min}}
    & &  -v^TZv\\
    & \text{subject to}
   & & v\geq 0.
    \end{aligned}
\end{equation}
This falls within the framework of~\eqref{problem:mcp}, with $\mathcal{M} = \mathbf{S}^{d-1}$ as an embedded Riemannian submanifold of $\mathbb{R}^d$ and $d$ inequality constraints.\\

\textbf{Input.}
Similar to \cite{khuzani2017stochastic}, we synthetically generate data following the symmetric spiked model as described above. We consider dimensions $d = \{10, 50, 200, 500, 1000, 2000\}$, and let $n = d$. For each dimension, we consider the basket of problems parametrized by $SNR\in \{0.05, 0.1, 0.25, 0.5, 1.0, 2.0\}$ which controls the noise level and $\delta \in \{0.1, 0.3, 0.7, 0.9\}$ which controls sparsity. Furthermore, we let the support $S \subseteq \{1, \ldots, n\}$ of the true principal direction $v_0$ be uniformly random, with cardinality $|S| = \lfloor \delta d\rfloor$, and
\[
v_{0,i} = \begin{cases}\frac{1}{\sqrt{|S|}} &\textrm{ if } i\in S, \\
            0 & \textrm{ otherwise.}
           \end{cases}
\]
Note that $S$ controls how sparse $v_0$ is. For each set of parameters, the experiment was repeated four times with different random noise $N$. As there are 6 choices for $d$, 4 for $\delta$, 6 for $SNR$, this gives 144 problems in each basket.

\subsubsection{$k$-means via low-rank SDP}
$k$-means is a traditional clustering algorithm in machine learning. Given a set of data points $\{x_i\}_{i=1}^{n}$, $x_i\in \mathbb{R}^l$ for some $l$, and a desired number of clusters $k$, this algorithm aims to partition the data into $k$ subsets $\{S_j\}_{j=1}^k$ such that the following is minimized:
\[
    {\cal{D}}(\{S_j\}_{j=1}^k) = \sum_{j=1}^k\sum_{x_i\in S_j}\|x_i-m_j\|^2,
\]
where $m_j = \frac{1}{|S_j|}\sum_{x_i\in S_j}x_i$ is the center of mass of the points selected by $S_j$. Following~\cite{carson2017manifold}, an equivalent formulation is as follows ($I$ is the identity matrix):
\begin{equation} \label{kmeans}
    \begin{aligned}
    & \underset{Y\in\mathbb{R}^{n\times k}}{\text{min}}
    & & -\mathrm{tr}(Y^TDY)\\
    & \text{subject to}
   & &  Y^TY = I,\quad Y\geq 0, \quad YY^Te = e,
    \end{aligned}
\end{equation}
where $D_{ij} = \|x_i-x_j\|^2$ is the squared Euclidean distance matrix. The constraint $Y^TY = I$ indicates $Y$ has orthonormal columns. The set of such matrices is called the Stiefel manifold. Thus, we can rewrite the problem as:
\begin{equation} \label{kmeansstiefel}
    \begin{aligned}
    & \underset{Y\in \mathrm{Stiefel}(n,k)}{\text{min}}
    & & -\mathrm{tr}(Y^TDY)\\
    & \text{subject to}
   & &  Y\geq 0, \quad YY^Te = e.
    \end{aligned}
\end{equation}
This falls within the framework of~\eqref{problem:mcp} with $\mathcal{M}$ the Stiefel manifold (as an embedded Riemannian submanifold of $\mathbb{R}^{n\times k}$), $n$ equality constraints and $nk$ inequality constraints.\\

\textbf{Input.} We take data sets from the UCI Machine Learning repository \cite{Lichman:2013}. For each dataset, we clean the data by removing categorical data and normalizing each feature. This gives $X = [x_1\dots x_N]$, and we get $D$ via $D_{ij} = \|x_i-x_j\|^2$. The specifications of the cleaned data are described in Table~\ref{table:kmeanspec}.

\begin{table}
	\centering
{\begin{tabular}{c c c c}
\hline
\hline
Dataset name & Number of data  & features & clusters \\
 [0.5ex]
\hline
Iris & 150 & 4 & 3  \\
ecoli & 336 & 5 & 8  \\
pima & 768 & 8 & 2  \\
sonar & 208 & 60 & 2 \\
vehicle &846 & 18 & 4 \\
wine & 178 & 13 & 3 \\
cloud & 2048 & 10 & 4 \\
 [1ex]

\hline
\end{tabular}}

\caption{Details of the datasets used in $k$-means}
\label{table:kmeanspec}
\end{table}

\subsection{Methodology} \label{sec:methodology}
We compare the methods discussed above against each other. In addition, as a control to test the hypothesis that exploiting the geometry of the manifold constraint is beneficial, we also compare against Matlab's built-in constrained optimization solver \texttt{fmincon}, which treats the manifold as supplementary equality constraints. We choose \texttt{fmincon} because it is a general purpose solver which combines various algorithms to enhance performance and it has been refined over years of developments, and thus acts as a good benchmark. To summarize, the methods are:
\begin{itemize}
	\item RALM: Riemannian Augmented Lagrangian Method, Section~\ref{sec:ALM};
	\item REPMS($Q^{\textrm{lqh}}$): exact penalty method with smoothing (linear-quadratic and pseudo-Huber), Section~\ref{sec:REPMS};
	\item REPMS($Q^{\textrm{lse}}$): exact penalty method with smoothing (log-sum-exp), Section~\ref{sec:REPMS};
	\item REPMSD: exact penalty method via nonsmooth optimization, Section~\ref{sec:REPMSD};
	\item Matlab's \texttt{fmincon}: does not exploit manifold structure.
\end{itemize}

We supply \texttt{fmincon} with the gradients of both the objective function and the constraints. We use the default settings: minimum step size is $10^{-10}$ and relative constraint violation tolerance is $10^{-6}$.\footnote{When the step size is of order $10^{-10}$, we believe that the current point is close to convergence. We also conducted experiments with minimum step size $10^{-7}$ for minimum balanced cut and non-negative PCA, and the performance profiles are visually similar to those displayed here.} Furthermore, we disable the stopping criterion based on a maximum number of iterations or queries in order to allow \texttt{fmincon} to converge to good solutions. For all of our methods, we define $d_{\mathrm{min}} = 10^{-10}, \epsilon_0 = 10^{-3}, \epsilon_{\min} = 10^{-6}, \theta_\epsilon = (\epsilon_{\min}/\epsilon_0)^\frac{1}{30}, \rho_0 = 1, \theta_{\rho} = 3.3$. Specifically, for RALM, $\theta_{\sigma} = 0.8$; for exact penalty methods, $\tau = 10^{-6}$, $u_0 = 10^{-1}, u_{\min} = 10^{-6}, \theta_u= (u_{\min}/u_0)^\frac{1}{30}$. As subsolver for RALM and the smoothing methods REPMS, we use LRBFGS: a Riemannian, limited-memory BFGS~\cite{huang2015broyden} as implemented in Manopt~\cite{boumal2014manopt}. For REPMSD, we use a minimum-norm tangent vector in the extended subgradient, then we use a type of LRBFGS inverse Hessian approximation for Hessian updates to choose the update direction~\cite{hosseini2016line}. For these limited-memory subsolvers, we let the memory be 30, the maximum number of iterations be 200, and the minimum step size be $10^{-10}$. For each experiment, all solvers have the same starting point randomly chosen on the manifold. An experiment is also terminated if it runs over one hour. We register the last produced iterate. Maximum constraint violation (Maxvio), cost function value and computation time are recorded for each solver, where Maxvio is defined as:
\begin{align*}
	\mathrm{Maxvio = } \max\left(\{|h_j(x)|\big|j\in {\cal{E}}\}\cup\{g_i(x)|i\in {\cal{I}}\}\cup\{0\}\right).
\end{align*}

For minimum balanced cut and non-negative PCA, we present performance profiles to compare computation time across problem instances for the various solvers. Performance profiles were popularized in optimization by Dolan and Mor\'e~\cite{dolan2002benchmarking}. Quoting from that reference, performance profiles show ``(cumulative) distribution functions for a performance metric as a tool for benchmarking and comparing optimization software.'' In particular, we show ``the ratio of the computation time of each solver versus the best time of all of the solvers as the performance metric.'' The profiles of REPMSD are only shown in lower dimensions to reduce computation time. See Figure~\ref{bmincut} for further details.

We consider that a point is feasible if Maxvio is smaller than $5\cdot 10^{-4}$. By denoting $f_{\min}$ as the minimum cost among all feasible solutions returned by solvers, we consider a solution to be best-in-class if it is feasible $and$ the cost $f$ satisfies $\left|f/f_{\min}-1\right| < 2\%$. In view of the objective functions of these two problems, a relative error tolerance is reasonable. We consider that a solver solves the problem if the returned point is best-in-class.

For $k$-means, we give a table of experimental results for Maxvio, cost and time across all datasets.

\subsection{Results and analysis}
\subsubsection{Minimum balanced cut for graph bisection}
We display in Figure~\ref{bmincut} the performance profiles for various dimensions, corresponding to the number of vertices in the graph. We note that apart from REPMSD, all methods perform well in the low dimensional case. In the high dimensional case, \texttt{fmincon} fails: in all test cases it converges to points far from feasible despite having no iteration limit; exact penalty methods and RALM are still able to give satisfactory results in some cases.

\begin{figure}[h!]
	\centering
	\includegraphics[width=1.0\linewidth]{bc_new}
	\caption{Performance profiles of computation time for different dimensions of the minimum balanced cut problem (with maximum constraint violation and cost accounted for---see Section~\ref{sec:methodology}). For each dimension, all solvers are run on a basket of problems. For each problem that could be solved, one solver obtained the fastest computation time. The curve for a solver passes through point $(\log_2\tau, q)$ if it solved a fraction $q$ of the problems within a factor $\tau$ of the fastest solver (which may change for each problem). Thus, upper-left is best. In particular, for $\tau = 1$ ($\log_2\tau = 0$), the curve of solver $A$ passes at level $q$ if solver $A$ was the fastest on a fraction $q$ of the problems. These may not sum to 100\% since some problems were not solved by any solver (and there could be ties, though that is unlikely).}
	\label{bmincut}
\end{figure}

\subsubsection{Non-negative PCA}
Table~\ref{nnpca} displays the performance profiles for non-negative PCA for various dimensions, corresponding to the length of the sought vector. RALM and REPMS($Q^{\textrm{lqh}}$) outperform \texttt{fmincon} as dimension increases. REPMS($Q^{\textrm{lse}}$) is rather slow. Notice that in this problem there are lots of inequality constraints involved. For REPMS($Q^{\textrm{lqh}}$), when we compute the gradient of the objective function, gradients of constraints that are not violated at the current point are not computed--- they are 0. However, they are computed in REPMS($Q^{\textrm{lse}}$), which slows down the algorithm. This observation suggests that, for problems with a large number of inequality constraints, REPMS($Q^{\textrm{lse}}$) may not be the best choice.

\begin{figure}[h!]
	\centering
	\includegraphics[width=1\linewidth]{pca}
	 \caption{Performance profile of computational time for different dimensions of non-negative PCA (with maximum constraint violation and cost accounted for---see Section~\ref{sec:methodology}). See caption of Figure~\ref{bmincut} for details on performance profiles.}
	 \label{nnpca}
\end{figure}

\subsubsection{$k$-means}
Table~\ref{kmeansresult} gives the results for $k$-means clustering. As the dimension gets larger, \texttt{fmincon} performs worse than RALM and REPMS in both Maxvio and Cost. Among all these methods, REPMS($Q^{\textrm{lqh}}$) and RALM are the better methods since they have relatively shorter solving time and lower Maxvio. In addition, REPMS($Q^{\textrm{lqh}}$) achieves the lowest cost for high dimensions.

\begin{table}

	\centering
	{\begin{tabular}{lllllll}
			&          & RALM                                      & REPMS$(Q^{\textrm{lqh}})$                         & REPMS$(Q^{\textrm{lse}})$                         & fmincon                                  & REPMSD                                   \\ \hline
			Iris    & Maxvio   & $1.92 \cdot 10^{-5}$                                 & $6.49 \cdot 10^{-6}$                                 & $4.26 \cdot 10^{-2}$                                 & $4.44 \cdot 10^{-5}$                                 & {$\mathbf{2.13 \cdot 10^{-7}}$} \\
			& Cost     & $3.31 \cdot 10^{-1}$                                 & {$\mathbf{4.43 \cdot 10^{-2}}$} & $8.20 \cdot 10^{+0}$                                 & $1.14 \cdot 10^{+1}$                                 & $2.80 \cdot 10^{-1}$                                 \\
			& Time (s) & $4.72 \cdot 10^{+2}$                                 & $4.89 \cdot 10^{+2}$                                 & {$\mathbf{1.70 \cdot 10^{+2}}$} & $3.13 \cdot 10^{+2}$                                 & $3.86 \cdot 10^{+3}$                                 \\ \hline
			Wine    & Maxvio   & $7.25 \cdot 10^{-5}$                                 & $6.62 \cdot 10^{-4}$                                 & $4.81 \cdot 10^{-2}$                                 & {$\mathbf{1.75 \cdot 10^{-5}}$}                               & -                                        \\
			& Cost     & $1.89 \cdot 10^{+0}$                                 & {$\mathbf{1.68 \cdot 10^{-1}}$}                    & $8.43 \cdot 10^{+0}$                                 & $1.19 \cdot 10^{+1}$                                 & -                                        \\
			& Time (s) & $3.45 \cdot 10^{+2}$                                 & $2.87 \cdot 10^{+2}$                                 & $1.85 \cdot 10^{+2}$                                 & {$\mathbf{1.59 \cdot 10^{+2}}$} & -                                        \\ \hline
			Sonar   & Maxvio   & $3.02 \cdot 10^{-5}$                                 & $1.42 \cdot 10^{-5}$                                 & $5.48 \cdot 10^{-2}$                                 & {$\mathbf{6.65 \cdot 10^{-7}}$} & -                                        \\
			& Cost     & {$\mathbf{8.99 \cdot 10^{-1}}$} & $9.50 \cdot 10^{+0}$                                 & $1.50 \cdot 10^{+1}$                                 & $1.80 \cdot 10^{+1}$                                 & -                                        \\
			& Time (s) & $5.28 \cdot 10^{+2}$                                 & $3.48 \cdot 10^{+2}$                                 & {$\mathbf{2.55 \cdot 10^{+2}}$} & $6.70 \cdot 10^{+2}$                                 & -                                        \\ \hline
			Ecoli   & Maxvio   & {$\mathbf{8.33 \cdot 10^{-4}}$}                     & $2.65 \cdot 10^{-3}$                                 & $6.73 \cdot 10^{-2}$                                 & $9.67 \cdot 10^{-1}$                                 & -                                        \\
			& Cost     & $4.08 \cdot 10^{+1}$                                 &{$\mathbf{1.24 \cdot 10^{-1}}$}                       & $1.87 \cdot 10^{+1}$                                 & $6.45 \cdot 10^{+0}$                                 & -                                        \\
			& Time (s) & $1.75 \cdot 10^{+3}$                                 & $1.44 \cdot 10^{+3}$                                 & {$\mathbf{1.01 \cdot 10^{+3}}$}                    & $3.62 \cdot 10^{+3}$                                 & -                                        \\ \hline
			Pima    & Maxvio   & {$\mathbf{2.10 \cdot 10^{-10}}$} & $1.82 \cdot 10^{-3}$                                 & $9.10 \cdot 10^{-2}$                                 & $2.34 \cdot 10^{-5}$                                 & -                                        \\
			& Cost     & $2.60 \cdot 10^{-2}$                                 & {$\mathbf{9.48 \cdot 10^{-3}}$} & $1.56 \cdot 10^{+0}$                                 & $2.13 \cdot 10^{+1}$                                 & -                                        \\
			& Time (s) & $1.37 \cdot 10^{+3}$                                 & $1.25 \cdot 10^{+3}$                                 & {$\mathbf{5.79 \cdot 10^{+2}}$} & $3.62 \cdot 10^{+3}$                                 & -                                        \\ \hline
			Vehicle & Maxvio   & $8.87 \cdot 10^{-3}$                                 & {$\mathbf{4.35 \cdot 10^{-4}}$} & $9.17 \cdot 10^{-2}$                                 & $2.71 \cdot 10^{+2}$                                 & -                                        \\
			& Cost     & $3.18 \cdot 10^{+0}$                                 & {$\mathbf{3.77 \cdot 10^{-2}}$} & $2.23 \cdot 10^{+1}$                                 & $6.71 \cdot 10^{+2}$                                 & -                                        \\
			& Time (s) & $2.88 \cdot 10^{+3}$                                 & $2.70 \cdot 10^{+3}$                                 & {$\mathbf{2.61 \cdot 10^{+3}}$} & $3.63 \cdot 10^{+3}$                                 & -                                        \\ \hline
			Cloud   & Maxvio   & $1.81 \cdot 10^{-2}$                                 & {$\mathbf{1.83 \cdot 10^{-3}}$} & $6.79 \cdot 10^{-1}$                                 & $3.70 \cdot 10^{+3}$                                 & -                                        \\
			& Cost     & $1.36 \cdot 10^{-1}$                                 & {$\mathbf{5.49 \cdot 10^{-4}}$} & $1.97 \cdot 10^{+0}$                                 & $2.20 \cdot 10^{+3}$                                 & -                                        \\
			& Time (s) & $4.08 \cdot 10^{+3}$                                 & {$\mathbf{3.65 \cdot 10^{+3}}$} & $3.78 \cdot 10^{+3}$                                 & $3.84 \cdot 10^{+3}$                                 & -                                        \\ \hline
	\end{tabular}}
	\caption{Maximum constraint violation, cost function value, and computation time results of different algorithms for $k$-means. For dataset `cloud' (which does not come with a specified number of clusters), we set the number of clusters $k$ to 4. For all other datasets, we used the number of clusters recommended by the dataset documentation.}
	\label{kmeansresult}
\end{table}

\section{Conclusion}
In this paper, augmented Lagrangian methods and exact penalty methods are extended to Riemannian manifolds, along with some essential convergence results. These are compared on three applications against a baseline, which is to treat the manifold as a set of general constraints. The three applications are minimum balanced cut, non-negative PCA and $k$-means. The conclusions from the numerical experiments are that, in high dimension, it seems to be beneficial to exploit the manifold structure; as to which Riemannian algorithm is better, the results vary depending on the application.

 We consider this work to be a first systematic step towards understanding the empirical behavior of straightforward extensions of various techniques of constrained optimization from the Euclidean to the Riemannian case. One direct advantage of exploiting the Riemannian structure is that this part of the constraints is satisfied up to numerical accuracy at each iteration. While our numerical experiments indicate that some of these methods perform satisfactorily as compared to a classical algorithm which does not exploit Riemannian structure (especially in high dimension), the gains are moderate. For future research, it is of interest to pursue refined versions of some of the algorithms we studied here, possibly inspired by existing refinements in the Euclidean case but also by a more in depth study of the geometry of the problem class. Furthermore, it is interesting to pursue the study of the convergence properties of these algorithms---and the effects of the underlying Riemannian geometry---beyond the essential results covered here, in particular because the Riemannian approach extends to general abstract manifolds, including some which may not be efficiently embedded in Euclidean space through practical equality constraints.

\section*{Acknowledgments}
We thank an anonymous reviewer for detailed and helpful comments on the first version of this paper. NB is partially supported by NSF grant DMS-1719558.

\bibliographystyle{abbrv}


The no-three-in-line problem on a torus

Abstract: Let $T(\Z_m \times \Z_n)$ denote the maximal number of points that can be placed on an $m \times n$ discrete torus with "no three in a line," meaning no three in a coset of a cyclic subgroup of $\Z_m \times \Z_n$. By proving upper bounds and providing explicit constructions, for distinct primes $p$ and $q$, we show that $T(\Z_p \times \Z_{p^2}) = 2p$ and $T(\Z_p \times \Z_{pq}) = p+1$. Via Gröbner bases, we compute $T(\Z_m \times \Z_n)$ for $2 \leq m \leq 7$ and $2 \leq n \leq 19$.

\section{Introduction}

In the \textit{no-three-in-line problem} \cite{Dudeney}, one wishes
to place as many points as possible on an $n\times n$ lattice with no
three points on a line.  A predominant conjecture is that $2n$ points
can be placed with no three in a line for all $n\times n$
lattices---note this requires $2$ points for each row (or column), and
hence cannot be improved upon.

As a lower bound, Paul Erd\"os in \cite{kR51} proved that for a
$p\times p$ lattice, $p$ being prime, one can place $p$ points via a
``parabola'' modulo $p$.  This means for $x = 0,\dots,p-1$, no
three of the points $(x, x^2 \bmod{p})$ will be in a line.  Later in
\cite{HJSW75}, this lower bound was improved by considering a
$2p\times 2p$ lattice and placing the points on a ``hyperbola'' modulo
$p$. This construction is somewhat more complex, and for a $2p\times
2p$ lattice, it permits $3p$ points to be placed with no three in a
line. In summary, at this point it is known that $(\frac{3}{2} -
\varepsilon)n$ points can be placed on an $n\times n$ grid.

Instead of attacking this long unsolved problem, we analyze a
variation of it.  Again consider an $n\times n$ lattice, but now
associate opposite edges, so that we may view this as a discrete
$n\times n$ torus (see Figure~\ref{figure:donut}).  We define
\textit{lines} on this discrete torus to be the images of lines in
$\mathbb Z\times \mathbb Z$ under the covering projection.  We ask the following
question:

\begin{figure}
\label{figure:donut}
\includegraphics{donut.pdf}
\begin{caption}
{A $9\times 9$ discrete torus}
\end{caption}
\end{figure}

\begin{ques}
How many points can be placed on an $n\times n$ discrete torus, such
that no three points are in a line?
\end{ques}

In this setting, we reproduce Erd\"os' lower bound for $p \times p$
discrete tori in Theorem~\ref{thm:erdos-analogue}.  However, the
explicit examples in Section \ref{S:ComAlg} show that this lower bound
cannot be improved with the methods of \cite{HJSW75}.  Interestingly,
the size of solutions on tori diverge from those on the lattice almost
immediately. On a $3\times 3$ lattice we may place $6$ points, while
on a corresponding torus, we may only place $4$ points.  Since the
lines can ``wrap around'' the edges, it is harder to place points so
that there are no three in a line.
\begin{figure}
\includegraphics{3x3Solns.pdf}
\begin{caption}
{Maximal solutions on the lattice and the torus}
\end{caption}
\end{figure}

In Section \ref{S:DT}, we give upper and lower bounds (some of which
are given alongside maximal constructions) for the number of points
that can be placed on various $n\times m$ discrete tori with no three
points in a line.  Finally in Section \ref{S:ComAlg}, we will give
some empirical results and give a description of the methods used to
obtain them.

\section{Results for discrete tori}\label{S:DT}

To start, note that working with an $n\times n$ torus is essentially a
reformulation of the no-three-in-line problem for the group
$\mathbb Z_n\times \mathbb Z_n$.

\begin{dfn}
We will say that two points $a = (x_a,y_a)$ and $A
=(x_A,y_A)$ are \textbf{congruent} modulo $n$ if
\[
x_a \equiv x_A \bmod{n} \qquad\text{and}\qquad y_a \equiv y_A \bmod{n}
\]
and in this case we will simply write $a \equiv A \bmod{n}$.
\end{dfn}

\begin{dfn}\label{D:lines}
Three distinct points $a$, $b$ and $c$ are \textbf{in a line} on the discrete torus
$\mathbb Z_n\times \mathbb Z_n$ if and only if there are three points $A$, $B$, and
$C$ in a line in the universal cover $\mathbb Z\times \mathbb Z$ such that
\[
a \equiv A \bmod{n}, \qquad b \equiv B \bmod{n}, \qquad c \equiv C \bmod{n}.
\]
\end{dfn}

\subsection{Upper bounds}

While it is easy to show that at most $2n$ points can be placed with
no three in a line on a $n\times n$ lattice, this bound is much too
high to be of real use when studying the no-three-in-line problem on
the discrete torus. We arrived at a somewhat general question that
sheds some light on this:

\begin{ques}
Given a group, how many elements of it can be chosen so that no three
are in a coset of a (maximal) cyclic subgroup?
\end{ques}

Essentially, lines on a discrete torus correspond to cosets of cyclic
subgroups of $\mathbb Z_n\times \mathbb Z_n$. Since we are interested in looking at
whole lines, we can restrict ourselves to looking at cyclic subgroups
that are maximal with respect to set-inclusion.

\begin{dfn}
Given a group $G$, let $T(G)$ denote the number of elements of $G$
that can be chosen so that no three are in a coset of a cyclic
subgroup of $G$.
\end{dfn}

Note, for any cyclic group $Z$, $T(Z) = 2$, hence when $m$ and $n$ are
relatively prime, $T(\mathbb Z_m\times\mathbb Z_n) = 2$.

\begin{prop}
For any positive integer $n$, $T(\mathbb Z_2 \times \mathbb Z_{2n}) = 4$.
\end{prop}

\begin{proof}
Consider the following arrangement of $4$ points:
\[
\includegraphics{2x2nSolns.pdf}
\]
By inspection we can see that no three elements are in a line on
this torus and hence $T(\mathbb Z_2 \times \mathbb Z_{2n}) = 4$.
\end{proof}

\begin{prop}
For any positive integers $m$ and $n$, $T(\mathbb Z_m\times \mathbb Z_m) \le T(\mathbb Z_m
\times \mathbb Z_{mn})$.
\end{prop}
\begin{proof}
This follows as an $m\times mn$ torus is a cover for an $m\times m$
torus. Hence, the lines that pass through any three points of the
$m\times m$ torus are precisely those that pass through an $m\times m$
section of an $m\times mn$ torus.

\end{proof}

\begin{thm}
For any prime integer $p$, $T(\mathbb Z_p \times \mathbb Z_p)\le p+1$.
\end{thm}

\begin{proof}
Consider the lines on the $p\times p$ torus. These lines
correspond to cosets of maximal cyclic subgroups of $\mathbb Z_p\times
\mathbb Z_p$. We claim that there are exactly $p+1$ maximal cyclic subgroups
of $\mathbb Z_p\times \mathbb Z_p$. To see this, consider the following list of
subgroups:
\[
\{ \langle(0,1)\rangle, \langle(1,0)\rangle, \langle(1,1)\rangle, \langle(1,2)\rangle, \dots, \langle(1,p-1)\rangle\}
\]
We have listed $p+1$ maximal cyclic subgroups of $\mathbb Z_p\times
\mathbb Z_p$. Moreover, we claim that there are no others. Consider $(a,b)\in
\mathbb Z_p\times \mathbb Z_p$. If $a$ is zero, then $\langle(a,b)\rangle \leq
\langle(0,1)\rangle$. If $a\ne 0$, then consider the $a$th multiple of
each of the generators above. Since $\mathbb Z_p$ is a field, the $a$th
multiple of one of those generators is equal to $(a,b)$, forcing
$\langle(a,b)\rangle$ to be a subset of the maximal cyclic subgroup
generated by that generator.

Since every line is a coset of a maximal cyclic subgroup of
$\mathbb Z_p\times \mathbb Z_p$, and the cosets of a subgroup partition the group,
every point is in exactly one coset of each maximal cyclic subgroup
listed above. Hence every point on the $p\times p$ torus is contained
in exactly $p+1$ lines.

If we attempt to place points on the $p\times p$ torus such that no
three are in a line, the first point must be on $p+1$ lines, the
second on $p$ lines new lines, the third on $p-1$ new lines, and so on
until the last point which is on just a single new line. No more
points can be placed or we would have three in a line. Hence, at most
$p+1$ points can be placed on a $p\times p$ torus.
\end{proof}

\begin{thm}
For any distinct prime integers $p$ and $q$, $T(\mathbb Z_p \times
\mathbb Z_{pq})\le p+1$.
\end{thm}

\begin{proof}
Again, the ``lines'' on the $p\times pq$ torus correspond to cosets of
maximal cyclic subgroups of $\mathbb Z_p\times \mathbb Z_{pq}$. We claim that there
are exactly $p+1$ maximal cyclic subgroups of $\mathbb Z_p\times
\mathbb Z_{pq}$. Consider the following list of subgroups:
\[
\{ \langle(0,1)\rangle, \langle(1,1)\rangle, \langle(2,1)\rangle, \dots, \langle(p-1,1)\rangle, \langle (1, p)\rangle\}
\]
We claim that these $p+1$ subgroups are all of the maximal cyclic
subgroups of $\mathbb Z_p\times \mathbb Z_{pq}$. Consider $(a,b)\in \mathbb Z_p\times
\mathbb Z_{pq}$. If $a$ is zero, then $\langle(a,b)\rangle \leq
\langle(0,1)\rangle$. If $a\ne 0$, and $p\nmid b$, then consider the
$b$th multiple of each of the generators above. Since $\mathbb Z_p$ is a
field, the $b$th multiple of one of those generators is equal to
$(a,b)$. If $p|b$ then consider the $ib/p$th multiples of $(1,p)$
where $i\in\{0,\dots, p-1\}$. Since $(p,q)= 1$, we see that
$\langle(a,b)\rangle$ to be a subset of the maximal cyclic subgroup
generated by $(1,p)$. Working as in the proof of the previous theorem
we see that at most $p+1$ points can be placed on a $p\times pq$
torus.
\end{proof}

\subsection{Constructions}

A construction originally given by Erd\"os in \cite{kR51} shows that
if $p$ is prime, we may place $p$ points on a $p\times p$ discrete
torus such that no three are in a line.  To see this, recall the
determinant criterion for checking whether points are in a line:

\begin{lem}\label{L:det}
Three points $(x_1,y_1)$, $(x_2,y_2)$, and $(x_3,y_3)$ are in line if
and only if
\[
\det \begin{bmatrix}
1 & 1 & 1\\
x_1 & x_2 & x_3 \\
y_1 & y_2 & y_3
\end{bmatrix} =0.
\]
\end{lem}

Using this lemma we will adapt the proof given in \cite{AHK74} to
prove the following theorem.

\begin{thm}
\label{thm:erdos-analogue}
Given a prime $p$ and the discrete torus $\mathbb Z_{p}\times \mathbb Z_{p}$,
there are $p$ points none of which are three-in-line.
\end{thm}

\begin{proof}
Consider the set of points:
\[
\{(x, x^2 \bmod p):x=0,\dots,p-1\}
\]
By Lemma~\ref{L:det} we should examine the following determinant
\[
\det \begin{bmatrix}
1 & 1 & 1\\
x + pa & y+pb & z+pc \\
x^2+pi & y^2+pj & z^2+pk
\end{bmatrix}
\]
which equals
\[
(y-x)(x-z)(y-z) + p(\text{other terms}).
\]
The first term is nonzero and not divisible by $p$ because $x$, $y$,
and $z$ are distinct elements of $\{0,\dots,p-1\}$. Thus the
determinant in question is neither nonzero nor is it divisible by
$p$. Thus we have shown that $p$ points can be placed on the $p\times
p$ discrete torus with no three-in-line.
\end{proof}

The construction above places $p$ points on either the discrete torus
or lattice. However, in neither case is the construction maximal. The
following constructions are all maximal.

\begin{thm}
For any prime integer $p$, $T(\mathbb Z_p \times \mathbb Z_{p^2}) = 2p$.
\end{thm}
\begin{proof}
The proof uses a construction similar to Erd\"os' construction for the
$p \times p$ lattice. Consider the set of points:
\[
X=\{(x, p x^2 \bmod{p^2}):x=0,\dots,p-1\}
\]
along with
\[
Y=\{(p-x-1, -px^2-1,\bmod{p^2}):x=0,\dots,p-1\}
\]
Here $Y$ is essentially an $180$ degree rotation of the points in
$X$. We claim that together these sets produce $p-1$ points where no
three are in a line. First we must argue that these sets are disjoint.

Seeking a contradiction, suppose $X\cap Y \neq \emptyset$, then plugging the
first entry of a point of $Y$ into the formula for the second
entry of a point of $X$ will equal the second entry of a
point of $Y$. Writing this out:
\begin{align*}
p(p-x-1)^2 &\equiv -px^2 - 1 \bmod{p^2} \\
px^2 +2px + p&\equiv -px^2 - 1 \bmod{p^2} \\
2px^2 + 2px +p +1 &\equiv 0 \bmod{p^2}
\end{align*}
However, multiplying both sides by $p$, we see this to be impossible.

Now we claim that no three of the $2p$ points of $X\cup Y$ are in a
line. If there were three points in a line, then either all of those
points are from $X$, all are from $Y$, or two are from one set and the
third is from the other set. Since $Y$ is merely a $180$ degree
rotation of the first set of points, we can work as we did before and
examine the following determinant:
\[
\det
\begin{bmatrix}
1           & 1            & 1 \\
x+ap        & y+bp         & z+cp \\
px^2+ ip^2  & py^2+jp^2    & pz^2+kp^2 \\
\end{bmatrix}
\]
On the other hand, if one point is from $Y$ and two points are from
$X$, or vice versa, we examine this determinant.
\[
\det
\begin{bmatrix}
1           & 1            & 1 \\
p-x-1+ap        & y+bp         & z+cp \\
-px^2-1+ ip^2  & py^2+jp^2    & pz^2+kp^2 \\
\end{bmatrix}
\]
By symmetry, these two determinants are sufficient to account for all
cases.  The first determinant above is equal to:
\[
-p(x-y)(x-z)(y-z)+p^2(\text{other terms})
\]
Since $x$, $y$, and $z$ are distinct elements of $\{0\dots ,p-1\}$
this first term must be nonzero and not divisible by $p^2$.  Thus the
determinant is nonzero.  The other determinant equals
\[
(y-z) + p(\text{other terms})
\]
which by the same logic is also nonzero.  Thus we have shown that $2p$
points can be placed on a the $p \times p^2$ torus.
\end{proof}

Next we give construction for placing $p+1$ points on a
$p\times p$ torus.

\begin{thm}
For any prime $p$,
  \[
  T(\mathbb Z_p \times \mathbb Z_p) = p+1.
  \]
\end{thm}

\begin{proof}
  Since $T(\mathbb Z_p \times \mathbb Z_p) \leq p+1$, constructing an arrangement of
  $p+1$ points will suffice to prove the theorem.  The construction
  relies on counting points on spheres for quadratic forms over finite
  fields, for which we referred to Cassleman's survey \cite{casselman}
  of Minkowski's counting arguments \cite{minkowski}.

  If $p = 2$, any configuration of 3 points works.  For $p > 2$, we
  begin by choosing a quadratic nonresidue $q$.  Regarding $\mathbb Z_p
  \times \mathbb Z_p$ as the affine plane over the finite field $\mathbb Z_p$, the
  variety
  \[
  V := \{ (x,y) \in {\mathbb Z_p}^2 : x^2 + q \, y^2 = 1 \}.
  \]
  is an absolutely irreducible degree two hypersurface; if it were
  reducible over the algebraic closure $\overline{\mathbb Z_p}$, the
  irreducible components of the projective closure of $\Spec
  \overline{\mathbb Z_p}[x,y]/(x^2 + q\, y^2 - 1)$ would intersect by B\'ezout,
  giving a singular point, but the homogeneous polynomial $x^2 + q\, y^2 -
  z^2$ has partial derivatives which simultaneously vanish only at
  $(0,0,0)$, so the projective closure is nonsingular.

  Also by B\'ezout's theorem, any line (a degree one hypersurface)
  intersects $V$ in at most two points.  In other words, $V$ satisfies
  the no-three-in-line condition.  It remains to count the points on
  $V$.  Define the finite field extension $k := \mathbb Z_p[t]/(t^2 - q)$
  having $p^2$ elements, and consider the norm map $N : k \to \mathbb Z_p$.
  Regarding $k$ as a two-dimensional vector space over $\mathbb Z_p$, we may
  identify $V$ with the preimage $N^{-1}(1)$.

  Let $F : k \to k$ be the Frobenius; then
  \[
  N(x) = x \cdot F(x) = x^{1+p},
  \]
  and the units $k^{\times}$ is a cyclic group, so $N$ is surjective.
  Because $N$ is a group homomorphism on nonzero elements, the fiber
  over each nonzero element of $\mathbb Z_p$ has the same number of elements,
  so the fiber has size $(p^2 - 1)/(p-1) = p+1$.  This $V$ has $p+1$
  points, as desired.
\end{proof}

\begin{thm}
For distinct odd primes $p$ and $q$, $T(\mathbb Z_p \times \mathbb Z_{pq})= p+1$.
\end{thm}

\begin{proof}
The proof uses a similar construction to the one used for the $p
\times p^2$ torus. Consider the set of points:
\[
X=\{(q x^2 \bmod p, p x^4 \bmod{p q}):x=0,\dots,(p-1)/2\}
\]
along with
\[
Y=\{(p-1)/2-q x^2 \bmod p, q (p-1)^2/4 - p x^4 \bmod{p q}):x=0,\dots,(p-1)/2\}
\]
Again, points in $Y$ are essentially an $180$ degree rotation of the
points in $X$. First we must show that $X\cap Y = \emptyset$.  Suppose
that $X\cap Y \neq \emptyset$, then for some values of $x$ and $y$,
\[
q x^2 \equiv \frac{p-1}{2} - q y^2 \pmod{p} \qquad \Rightarrow \qquad x^2 \equiv \frac{p-1}{2q} - y^2 \pmod{p}
\]
and
\[
p x^4 \equiv \frac{q (p-q)^2}{4} - py^4 \pmod{pq}
\]

Combining the equations above:
\[
p\left(\frac{p-1}{2q} - y^2\right)^2 \equiv \frac{q(p-1)^2}{4} - py^4 \pmod{pq}
\]
Multiplying by $q$:
\begin{align*}
0 &\equiv \frac{q^2(p-q)^2}{4} + q \pmod{pq} \\
0 &\equiv q^2 + 4q \pmod{pq}
\end{align*}
which, is impossible.

Again we claim that no three of the $p+1$ points of $X\cup Y$ are in a
line and we examine the following determinant:
\[
\det
\begin{bmatrix}
1           & 1             & 1 \\
q x^2+ap    & q y^2+bp      & q z^2+cp \\
p x^4+ipq   & p y^4+jpq     & p z^4+kpq \\
\end{bmatrix}
\]
On the other hand, if one point is from $Y$ and two points are from
$X$, or vice versa, we examine this determinant.
\[
\det
\begin{bmatrix}
1                       & 1             & 1 \\
(p-1)/2-ap-qx^2         & q y^2+bp      & q z^2+cp \\
q(p-1)^2/4-ipq-px^4   & p y^4+jpq     & q z^4+kpq \\
\end{bmatrix}
\]
By symmetry, these two determinants are sufficient to account for all
cases.  The first determinant above is equal to:
\[
p^2(c-b)x^4+(a-c)y^4+(b-a)z^4-pq(x-y)(x+y)(x-z)(y-z)(x+z)(y+z)
\]
Here we choose to work mod $p^2$, allowing us to ignore the first term
at the expense of potential roots.  Thus we need only show:
\[
pq(x-y)(x+y)(x-z)(y-z)(x+z)(y+z)
\]
cannot be zero. As above, since $x$, $y$, and $z$ are distinct elements
of $\{0,\dots,(p-1)/2\}$ none of the differences can be zero. Thus the
determinant is nonzero.  The other determinant equals
\[
-q^2(y-z)(y+z)/4 + p(\text{other terms})
\]
which by the same logic is also nonzero (mod $p$).  Thus we have shown that $p+1$
points can be placed on a the $p \times p q$ torus.
\end{proof}

\section{Commutative algebra}
\label{S:ComAlg}

Before we found the upper-bounds and constructions described above,
our work on this problem was mostly computer-based. However our
approach was somewhat different than what was done in \cite{CHJ76,
  kT78, kT79,aF92,aF98}. Since we did not know have upper bounds for
the number of points that could be placed on an $n\times m$ discrete
torus with no-three-in-line, we could not search for solutions and
stop when a maximal solution was found. To remedy this, we used the
tools of commutative ring theory.  Let $K$ be a field and consider the
polynomial ring:
\[
K[x_{1,1},\dots,x_{n,n}]
\]
By thinking of each indeterminate $x_{i,j}$ as the point $(i,j)$ on
the $n\times n$ lattice or discrete torus, we can use the tools of
commutative algebra to attack these combinatorial problems. While the
use of commutative algebra in combinatorics is not new
\cite{rS96,mK05}, this is the first time that we are aware of that
such methods have been used in connection to the no-three-in-line
problem. In what follows below, $K = \mathbb Z_2$ and we will always be
working with a quotient ring
\[
R = K[x_{1,1},\dots,x_{n,n}]/I
\]
where $I$ is an ideal generated by a set of ``undesirable''
points. Specifically, $I$ will contain all products of indeterminates
representing ``three points in a line,'' and squares of every
indeterminate of $K[x_{1,1},\dots,x_{n,n}]$.  As an example, for the
$3\times 3$ lattice,
\begin{align*}
I_\l = ( &x_{1,1}x_{2,1}x_{3,1}, x_{1,1}x_{1,2}x_{1,3}, x_{1,2}x_{2,2}x_{3,2}, x_{2,1}x_{2,2}x_{2,3}, \\
       &x_{1,3}x_{2,3}x_{3,3}, x_{3,1}x_{3,2}x_{3,3}, x_{1,3}x_{2,2}x_{3,1}, x_{1,1}x_{2,2}x_{3,3}, \\
       &x_{1,1}^2, x_{1,2}^2, x_{1,3}^2, x_{2,1}^2, x_{2,2}^2, x_{2,3}^2, x_{3,1}^2, x_{3,2}^2, x_{3,3}^2)
\end{align*}
Looking at the subscripts we see the vertical, horizontal and diagonal
lines on the $3\times 3$ lattice represented as degree three
monomials. Of course, for larger $n$ there are many more lines and
therefore many more such products in the ideal.  Next we see perfect
square monomials, representing the fact that no point can occupy the
same spot twice. On the torus, we have $4$ extra monomials in the
ideal:
\begin{align*}
I = I_\l + ( &x_{1,1}x_{2,3}x_{3,2}, x_{1,2}x_{2,1}x_{3,3}, x_{1,2}x_{2,3}x_{3,1}, x_{1,3}x_{2,1}x_{3,2})
\end{align*}
If one inspects these monomials, we see that they correspond exactly
to lines on the torus that do not exist on the lattice. Hence we see
that monomials of degree $d$ in $R$ will correspond to arrangements of
$d$ points on the discrete torus where no three of those points are in
a line. To see how this setup will allow us to attack this problem, we
need the following well-known definitions; while we restrict ourselves
to the setting of our work, the curious reader may consult \cite{KR05}
for a complete development.

\begin{dfn}
The \textbf{Hilbert function} $\mathop{\mathrm{HF}}\nolimits_K:\mathbb N\to \mathbb N$ is defined by
\[
\mathop{\mathrm{HF}}\nolimits_R(d) := \dim_K(R_d)
\]
where  $R_d$ is the $K$-vector subspace of homogeneous polynomials of degree $d$.
\end{dfn}
In our setting $R = K[\mathbf x]/I$, hence a degree $d$ basis of $R$ is a
list of all arrangements of $d$ points on the $n\times n$ lattice or
torus, with no three in a line. Thus $\mathop{\mathrm{HF}}\nolimits_R(d)$ will correspond to the
number of arrangements of $d$ points on the $n\times n$ discrete torus
with no three in a line.

It is important to notice that since the ideal $I$ in our definition
of $R$ will always contain the squares of each indeterminate of
$K[x_{1,1},\dots,x_{n,n}]$, we see that $\mathop{\mathrm{HF}}\nolimits_R(d) = 0$ whenever
$d>n^2$.  As such, we can rephrase the no-three-in-line problem as the
following:

\begin{ques}
With $R = K[\mathbf x]/I$ as defined above, what is the greatest degree $d$
such that $\mathop{\mathrm{HF}}\nolimits_R(d) \neq 0$?
\end{ques}

With this re-phrasing in mind, we wish to obtain as much information
as possible regarding the Hilbert function of $R$. Hence we are
interested in the generating function for the Hilbert function, known
as the \textit{Hilbert series} of $R$:

\begin{dfn}
The \textbf{Hilbert series} of a quotient of a polynomial ring $R =
K[\mathbf x]/I$, is a power series whose degree $n$ coefficients are exactly
$\mathop{\mathrm{HF}}\nolimits_R(n)$.
\end{dfn}

A possible advantage to using Hilbert series to study the
no-three-in-line problem, especially over the majority of methods that
are seen elsewhere, is that they give information about placing any
number of points---not just a maximum number of points as the
coefficient of the degree $k$ term is exactly the number of ways that
$k$ points can be placed on an $n \times n$ lattice or torus. Since
our ideal contains the square of every indeterminate, our Hilbert
series will always have finite degree, and hence will be a
polynomial. The degree of this polynomial will always be the size of
the largest possible solution to the no-three-in-line problem on a
lattice or torus.

By encoding this problem in the language of commutative ring theory,
we were able to use the computer algebra system \texttt{Macaulay2},
\cite{M2}, to compute the Hilbert function, Hilbert series, and
relevant bases of our rings.

\subsection{A survey of our findings}

We have been able to reproduce some of the known results on the
no-three-in-line problem for the $n\times n$ lattice via computations
involving the ideals above and their corresponding Hilbert series.  By
looking at the degree of the highest order term and it's coefficient,
we found the highest number of points that can be placed on the
lattice and the number of solutions of that size, respectively.  The
following table lists these data for the first 5 non-trivial cases:
\[
    \begin{array}{c || c | c}
        n & \#\text{ of Points} & \#\text{ of Solutions} \\ \hline\hline
        3 & 6 & 2 \\
        4 & 8 & 11 \\
        5 & 10 & 32 \\
        6 & 12 & 50 \\
        7 & 14 & 132 \\
        \vdots & \vdots & \vdots \\
    \end{array}
\]
Here is the same table for tori:
\[
    \begin{array}{c || c | c}
        n & \#\text{ of Points} & \#\text{ of Solutions} \\ \hline\hline
        3 & 4 & 6 \\
        4 & 6 & 2 \\
        5 & 6 & 40 \\
        6 & 8 & 6 \\
        7 & 8 & 126 \\
        \vdots & \vdots & \vdots \\
    \end{array}
\]
Comparing the two tables, one of the most striking differences is the
surprisingly low number of solutions for even tori while the odd tori
stay fairly close in number to the lattice solutions.  More unexpected
is the size of the solutions, with the tori containing fewer points
every time.  Another interesting detail is the repetition of solutions
sizes.  The progression of torus solution sizes is:
\[
1,4,4,6,6,8,8,8,9,12,12,\dots
\]
However, one anomaly is far more intriguing than the rest.  For the
$14 \times 14$ discrete torus, only 12 points can be placed.  This is
of particular interest as the size of the torus exceeds the size of
its maximal solutions.  For rectangular tori, we have collected the
following data:
\[
    \begin{array}{ c || c | c | c | c | c | c | c | c | c | c | c | c | c | c | c | c | c | c |}
        m\backslash n & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 \\ \hline \hline
        2      & 4 & 2 & 4 & 2 & 4 & 2 & 4 & 2 & 4  & 2  & 4  & 2  & 4  & 2  & 4  & 2  & 4  & 2  \\ \hline
        3      &   & 4 & 2 & 2 & 4 & 2 & 2 & 6 & 2  & 2  & 4  & 2  & 2  & 4  & 2  & 2  & 6  & 2  \\ \hline
        4      &   &   & 6 & 2 & 4 & 2 & 8 & 2 & 4  & 2  & 6  & 2  & 4  & 2  & 8  & 2  & 4  & 2  \\ \hline
        5      &   &   &   & 6 & 2 & 2 & 2 & 2 & 6  & 2  & 2  & 2  & 2  & 6  & 2  & 2  & 2  & 2  \\ \hline
        6      &   &   &   &   & 8 & 2 & 4 & 6 & 4  & 2  & 8  & 2  & 4  & 4  & 4  & 2  & 10 & 2  \\ \hline
        7      &   &   &   &   &   & 8 & 2 & 2 & 2  & 2  & 2  & 2  & 8  & 2  & 2  & 2  & 2  & 2  \\ \hline
    \end{array}
\]
This table shows how many points can be placed on the $m\times n$
torus, with no three in a line. This data was used in formulating the
conjectures that eventually became our maximal constructions above.

\bibliographystyle{alpha}

Combinatorics (math.CO); Commutative Algebra (math.AC)

The no-three-in-line problem on a torus