Skip to main content
Log in

Computing tighter bounds on the n-queens constant via Newton’s method

  • Original Paper
  • Published:
Optimization Letters Aims and scope Submit manuscript

Abstract

In recent work Simkin shows that bounds on an exponent occurring in the famous n-queens problem can be evaluated by solving convex optimization problems, allowing him to find bounds far tighter than previously known. In this note we use Simkin’s formulation, a sharper bound developed by Knuth, and a Newton method that scales to large problem instances, to find even sharper bounds.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Simkin, M.: The number of \(n\)-queens configurations (2021). arXiv:2107.13460 [math.CO]

  2. Bell, J., Stevens, B.: A survey of known results and research areas for \(n\)-queens. Discret. Math. 309(1), 1–31 (2009)

    Article  MathSciNet  MATH  Google Scholar 

  3. Luria, Z.: New bounds on the number of \(n\)-queens configurations (2017). arXiv:1705.05225 [math.CO]

  4. Luria, Z., Simkin, M.: A lower bound for the \(n\)-queens problem (2021). arXiv:2105.11431 [math.CO]

  5. Knuth, D.: Xqueens and Xqueenons (2021). https://cs.stanford.edu/~knuth/papers/Xqueens-and-Xqueenons.pdf

  6. Zhang, C., Ma, J.: Counting solutions for the \(n\) -queens and Latin-square problems by Monte Carlo simulations. Phys. Rev. E. Stat. Nonlinear Soft Matter. Phys. 79, 016703 (2009)

    Article  Google Scholar 

  7. Boyd, S., Vandenberghe, L.: Convex Optimization. Cambridge University Press, Cambridge (2004)

    Book  MATH  Google Scholar 

  8. Boyd, S., Vandenberghe, L.: Introduction to Applied Linear Algebra: Vectors, Matrices, and Least Squares. Cambridge University Press, Cambridge (2018)

    Book  MATH  Google Scholar 

  9. Nocedal, J., Wright, S.: Numerical Optimization. Springer, Berlin (2006)

    MATH  Google Scholar 

  10. Saad, Y.: Iterative Methods for Sparse Linear Systems. SIAM, Philadelphia (2003)

    Book  MATH  Google Scholar 

  11. Hestenes, M., Stiefel, E.: Methods of conjugate gradients for solving linear systems. J. Natl. Bureau Stand. 49(6), 409–4361 (1952)

    Article  MathSciNet  MATH  Google Scholar 

  12. Paige, C., Saunders, M.: Solution of sparse indefinite systems of linear equations. SIAM J. Numer. Anal. 12(4), 617–629 (1975)

    Article  MathSciNet  MATH  Google Scholar 

  13. The Sage Developers. SageMath, the Sage Mathematics Software System (Version 9.4), 2021. https://www.sagemath.org

Download references

Acknowledgements

We thank Don Knuth for introducing us to this problem and substantial help in navigating the various lower and upper bounds. We thank Michael Simkin for his comments and suggestions on an earlier draft of this note. Parth Nobel was supported in part by the National Science Foundation Graduate Research Fellowship Program under Grant No. DGE-1656518. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation. Stephen Boyd was supported in part by AI Chip Center for Emerging Smart Systems (ACCESS).

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Parth Nobel.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Appendices

Appendix

A Details of convex problems

In this appendix we give the details of the lower and upper bound problems, as well as an approximate upper bound problem. We define the variables in their natural notation, leaving it to the reader to re-arrange these into a single vector variable x. In a similar way, we describe the linear constraints in their natural notation, leaving it to the reader to translate these into \(Ax=b\).

Fig. 1
figure 1

A chessboard with all of its triangles labeled. This chessboard is used to interpret the \(n=8\) problem. The red line represents one of the diagonals of the chessboard. The blue line represents one of the anti-diagonals of the chessboard

1.1 A.1 Common notation

In this section we describe variables and notation that are shared by the lower and upper bound problems.

Chessboard triangle variables. In both problems, the variable x consists of 4 \(n \times n\) matrices NESW, and some additional slack variables. The ijth entry in NESW is interpreted as a value associated with the North, East, South, or West triangle, respectively, formed by dividing each square of an \(n\times n\) chessboard into 4 right triangles. We index these matrices starting at 0, diverging from the notation used in [1, 5] which use indexing that begins at 1. Figure 1 shows the \(n=8\) case.

Diagonal sum operators. We introduce operators \({\mathcal {D}}_k : \mathbf {R}^{n\times n} \rightarrow \mathbf {R}\) and \({\mathcal {A}}_k : \mathbf {R}^{n\times n} \rightarrow \mathbf {R}\) defined for \(k \in \{-n, -n+1, -n +2, \ldots , -1, 0, 1, \ldots , n-2, n-1, n\}\), where \({\mathcal {D}}_k(Z)\) is the sum of the kth diagonal of Z, and \({\mathcal {A}}_k(Z)\) is the sum of the kth anti-diagonal of Z. For example \({\mathcal {D}}_0 Z = \sum _{i=0}^{n-1} Z_{ii} = \mathbf{Tr}{Z}\), \({\mathcal {D}}_1 Z = \sum _{i=1}^{n-1} Z_{i,i-1}\), and \({\mathcal {A}}_{-1} Z = \sum _{i=1}^{n-1} Z_{n-i,i}\). Note that \({\mathcal {D}}_{n} Z ={\mathcal {D}}_{-n} Z = 0\). These are illustrated in Fig. 1: \({\mathcal {D}}_{-2} N\) is the sum of the entries in the North triangles the red line passes through, and \({\mathcal {A}}_1 E\) is the sum of the entries in the East triangles the blue line passes through.

Negative entropy. Following [5], we define the function \(g:\mathbf {R}_+\rightarrow \mathbf {R}\) as \(g(x)=x \log x\) for \(x>0\), and \(g(0) = 0\). (This is the negative entropy function [7, p.72].)

1.2 A.2 Lower bound problem

This problem formulation is taken from [1, Claim 6.3], except that Simkin maximizes a concave function and we minimize its negative, a convex function.

Slack variables We introduce the following slack variables,

$$\begin{aligned} d_k = \frac{1}{n} - {\mathcal {D}}_{k} (S+W) - {\mathcal {D}}_{k+1} (N+E), \quad k \in \{-n, -n+1, \ldots , n - 1\}, \end{aligned}$$

and

$$\begin{aligned} a_k = \frac{1}{n} - {\mathcal {A}}_{k} (S+E) - {\mathcal {A}}_{k+1} (N+W), \quad k \in \{-n, -n+1, \ldots , n - 1\}. \end{aligned}$$

The quantities \(d_k\) and \(a_k\) are the sums along the diagonals and anti-diagonals, respectively, of the chessboard. In Fig. 1, \(d_{-1}\) includes contributions from all triangles the red line passes through and \(a_{0}\) includes contributions from triangles the blue line passes through.

These equations form 4n entries in Ab.

Objective. The objective function is

$$\begin{aligned}&\sum _{i=0}^{n-1} \sum _{j=0}^{n-1} \left( g(N_{i,j}) + g(E_{i,j}) + g(S_{i,j}) + g(W_{i,j})\right) \\&\quad + \sum _{k=-n}^{n-1} \left( g(d_k) + g(a_k)\right) + 4 \log n + 2 \log 2 + 3. \end{aligned}$$

Constraints. Simkin also introduces the constraints

$$\begin{aligned} \sum _{j=0}^{n-1} N_{i,j}+E_{i,j}+S_{i,j}+W_{i,j} = \frac{1}{n}, \quad i \in \{0, 1, \ldots , n-1\}, \end{aligned}$$

and

$$\begin{aligned} \sum _{i=0}^{n-1} N_{i,j}+E_{i,j}+S_{i,j}+W_{i,j} = \frac{1}{n}, \quad j \in \{0, 1, \ldots , n-1\}. \end{aligned}$$

These constraints are linearly dependent, with co-rank one, so we delete the first constraint with \(i = 0\) to obtain a total of \(2n - 1\) constraints that we include in Ab.

Properties. This problem has \(n^2\) entries in each of NESW and 2n entries in each of da. Accordingly, the total number of variables is \(p=4n^2 + 4n\). We have 4n constraints affecting the slack variables, and \(2n - 1\) constraints affecting only NESW for a total of \(q= 6n - 1\) constraints.

The objective is a sum of the negative entropy of individual optimization variables, making it separable and strictly convex.

The constraint with the most variables are the row and column constraints, which involve 4n variables. Each triangle is in at most 1 column constraint, 1 row constraint, 1 diagonal constraint, and 1 anti-diagonal constraint. Therefore, each column of A can have at most 4 entries.

1.3 A.3 Upper bound problem

We use Knuth’s formulation of the Xqueenon problem [5], except that he maximizes a concave function and we minimize its negative, a convex function.

Slack variables. We introduce the slack variables

$$\begin{aligned} d^{SW}_{k}= & {} 1 -\frac{1}{2n} {\mathcal {D}}_{k}\left( S + W\right) , \quad k \in \{-n+1, -n+2, \ldots , n-1\},\\ d^{NE}_{k}= & {} 1 -\frac{1}{2n} {\mathcal {D}}_{k}\left( N + E\right) , \quad k \in \{-n+1, -n+2, \ldots , n -1\},\\ a^{SE}_{k}= & {} 1 -\frac{1}{2n} {\mathcal {A}}_{k}\left( S + E\right) , \quad k \in \{-n+1, -n+2, \ldots , n-1\}, \end{aligned}$$

and

$$\begin{aligned} a^{NW}_{k} = 1 -\frac{1}{2n} {\mathcal {A}}_{k}\left( N + W\right) , \quad k \in \{-n+1, -n+2, \ldots , n -1\}. \end{aligned}$$

These equations form \(8n - 4\) entries in Ab.

Objective. For ease of notation, let

$$\begin{aligned} d^{SW}_{-n} = d^{NE}_{n} = a^{SE}_{-n} = a^{NW}_{n} = 1. \end{aligned}$$

Our objective function is

$$\begin{aligned} 3 + L_0(N, E, S, W) + L_-(d^{SW}, d^{NE}) + L_+(a^{SE}, a^{NW}), \end{aligned}$$

where

$$\begin{aligned}&L_0(N, E, S, W) = \frac{1}{4n^2} \sum _{i=0}^{n-1}\sum _{j=0}^{n-1}\\&\quad \left( g(N_{i,j}) + g(E_{i,j}) +g(S_{i,j}) +g(W_{i,j})\right) ,\\&\quad L_-(d^{SW}, d^{NE}) = \frac{1}{n}\sum _{k=-n+1}^{n} \int _{0}^1 g\left( (1 - y)d_{k-1}^{SW} + y d_{k}^{NE}\right) \,dy, \end{aligned}$$

and

$$\begin{aligned} L_+(a^{SE}, a^{NW}) = \frac{1}{n}\sum _{k=-n+1}^{n} \int _{0}^1 g\left( (1 - y)a_{k-1}^{SE} + y a_{k}^{NW}\right) \,dy. \end{aligned}$$

Using a symbolic solver, we were able to generate closed-form expressions for the integrals and their partial derivatives [13].

In order to make the matrix block-diagonal, \(d^{SW}_k\) and \(d^{NE}_k\) must be interleaved in x. Similar interleaving applies to \(a^{SE}_k\) and \(a^{NW}_k\).

Constraints. In addition to the \(8n - 4\) equations involving the slack variables, Knuth requires the following conditions on N and S,

$$\begin{aligned} \sum\limits_{{j = 0}}^{{n - 1}} {N_{{i,j}} } = & n,\quad i \in \{ 0,1, \ldots ,n - 1\} , \\ \sum\limits_{{j = 0}}^{{n - 1}} {S_{{i,j}} } = & n,\quad i \in \{ 0,1, \ldots ,n - 1\} , \\ \end{aligned}$$

and

$$\begin{aligned} \sum _{i=0}^{n-1} N_{i,j} + S_{i,j} = 2n, \quad j \in \{0, 1, \dots , n-1\}. \end{aligned}$$

As any of these equations are linearly dependent on all the others, we choose to eliminate the first column constraint on N.

On E and W, Knuth requires

$$\begin{aligned} \sum\limits_{{i = 0}}^{{n - 1}} {E_{{i,j}} } = & n,\quad j \in \{ 0,1, \ldots ,n - 1\} , \\ \sum\limits_{{i = 0}}^{{n - 1}} {W_{{i,j}} } = & n,\quad j \in \{ 0,1, \ldots ,n - 1\} , \\ \end{aligned}$$

and

$$\begin{aligned} \sum _{j=0}^{n-1} E_{i,j} + W_{i,j} = 2n, \quad i \in \{0, 1, \dots , n-1\}. \end{aligned}$$

As with N and S, one of these equations is linearly dependent, and we choose to eliminate the first row constraint on E.

Properties. This problem has \(n^2\) entries in each of NESW and \(2n- 1\) entries in each of \(d^{SW}_k, d^{NE}_k, a^{SE}_k, a^{NW}_k\). This forms a total of \(p = 4n^2 + 8n - 4\) variables. We also have the \(8n - 4\) constraints involving the slack variables and \(6n - 2\) of the other constraints for a total of \(q = 14n - 6\) constraints. The objective is block separable as each variable appears in only one term of the objective function and no term has more than two variables. The rows of A with the most entries are the entries along the diagonal and anti-diagonal, which contain 2n entries of NESW and 1 slack variable. Each column of A has at most 4 non-zero entries: 1 from its row constraint, 1 from its column constraints, 1 from its diagonal term, and 1 from its anti-diagonal term. Columns associated with slack variables have one non-zero entry.

1.4 A.4 Approximate upper bound problem

In the initial phase of computing \(U_n\) we solve a problem with a diagonal Hessian that approximates the upper bound problem. We do this by applying Jensen’s inequality to the integrals in the diagonal and anti-diagonal terms of the objective.

After applying this approximation, the integral terms of the objective function become

$$\begin{aligned} g\left( \frac{1}{2}d^{SW}_{k-1} +\frac{1}{2}d^{NE}_k\right) , \end{aligned}$$

and

$$\begin{aligned} g\left( \frac{1}{2}a^{SE}_{k-1} +\frac{1}{2}a^{NW}_k\right) . \end{aligned}$$

We introduce new slack variables \(d_k = \frac{1}{2}d^{SW}_{k-1} +\frac{1}{2}d^{NE}_k\) and \(a_k = \frac{1}{2}a^{SE}_{k-1} +\frac{1}{2}a^{NW}_k\) and then replace the integral terms with \(g(d_k)\) and \(g(a_k)\) appropriately.

All other constraints and terms of the objective function are the same.

Rights and permissions

Springer Nature or its licensor holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Nobel, P., Agrawal, A. & Boyd, S. Computing tighter bounds on the n-queens constant via Newton’s method. Optim Lett 17, 1229–1240 (2023). https://doi.org/10.1007/s11590-022-01933-2

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s11590-022-01933-2

Keywords

Navigation