1 Introduction

Bonami et al. [3] show how to effectively solve the \(\mathcal {NP}\)-hard nonconvex quadratic program with box constraints, i.e.,

figure a

with \(Q \in \mathbb {R}^{n \times n}\) symmetric, via linear programming techniques. Without loss of generality we assume \(l = \mathbf {0}\) and \(u = \mathbf {1}\), because we assume that l and u are finite. They first obtain a convex relaxation of the BoxQP with a linear objective function. This linearization induces nonlinear constraints, which are replaced by the so-called McCormick inequalities [9]. We denote the resulting weak linear relaxation of the BoxQP by LP\(_{\mathcal {M}}\), see Sect. 2.

However, cutting planes from the Boolean Quadric Polytope can be used to turn it into a very strong relaxation of the BoxQP. For given \(A \in \mathbb {Z}^{m \times n}\), \(b \in \mathbb {Z}^m\), and the problem \(Ax \ge b\) with \(x \in \mathbb {Z} ^n\), these cuts are Chvátal–Gomory cuts:

$$\begin{aligned} \alpha ^T Ax \ge \lceil \alpha ^T b \rceil \end{aligned}$$

for any \(\alpha \in \mathbb {R}_+^m\) with \(\alpha ^T A \in \mathbb {Z}^n\). Furthermore, it is shown that all Chvátal–Gomory cuts for the Boolean Quadric Polytope are \(0-\tfrac{1}{2}-\)Chvátal–Gomory cuts (i.e., \(\alpha \in \{0,\tfrac{1}{2}\}^m\)). Caprara and Fischetti [7] show that separating \(0-\tfrac{1}{2}-\)Chvátal–Gomory cuts is \(\mathcal {NP}\)-hard in general. However, Koster et al. [8] study ways to separate them effectively in practice. Fortunately for our purposes, all \(0-\tfrac{1}{2}-\)Chvátal–Gomory cuts of the Boolean Quadric Polytope are dominated by A-odd cycle inequalities, see [3], which can be separated in polynomial time [2].

Boros et al. [4] present a system of inequalities that describes the polyhedron given by the linear relaxation of the Boolean Quadric Polytope with all variables together with all \(0-\tfrac{1}{2}\)–Chvátal–Gomory cuts. Their formulation has \(\mathcal {O}(n^2)\) variables and contains \(\mathcal {O}(n^3)\) inequalities in addition to the \(\mathcal {O}(n^2)\) inequalities from the linear relaxation of the Boolean Quadric Polytope. We present an extended formulation which has also \(\mathcal {O}(n^2)\) variables but only adds \(\mathcal {O}(|E|n)\) inequalities, where |E| is the number of non-zeros in Q above its diagonal. This extended formulation is much more compact for sparse matrices Q, since we have \(|E| \ll n^2\) in this case.

2 Previous work and notation

This section is basically a summary of some results by Bonami et al. [3] and forms the basis for everything novel we derive in Sect. 3. We slightly deviate from the notation adopted in [3].

Let N denote the set \(\{1,\ldots ,n\}\) and

$$\begin{aligned} E :=\big \{ ij \ | \ \{i,j\} \subseteq N, \ i \ne j, \ Q_{ij} \ne 0 \big \} \end{aligned}$$

be the set of undirected edges. Notice that E is well-defined since \(Q_{ij} \ne 0\) if and only if \(Q_{ji} \ne 0\) by symmetry of Q.

A weak linear relaxation of the BoxQP can be obtained by replacing the nonlinear constraints of an obvious convex relaxation of the BoxQP by the so-called McCormick inequalities, see [9]. The resulting linear program is given by

figure b

Notice that the constraint \(x_i \ge X_{ij}\) additionally encompasses \(x_j \ge X_{ij}\) when applying it to \(ji=ij \in E\). Furthermore, this relaxation is strengthened to

figure c

where \(N^+ :=\{i \in N \ | \ Q_{ii} \ge 0\}\) and \(N^- :=\{i \in N \ | \ Q_{ii} < 0\}\) partition N. Although QP\(_{\mathcal {M}^2}\) has linear constraints and only its objective is quadratic, though convex, solving the pure LP\(_{\mathcal {M}}\) is still much faster in general. However, QP\(_{\mathcal {M}^2}\) provides better lower bounds for the BoxQP. Both relaxations can be strengthened with valid cuts from the Boolean Quadric Polytope, i.e., with the A-odd cycle inequalities, whose derivation is presented next.

With the McCormick relaxation

$$\begin{aligned} \text {BQP}^{LP}&= \Big \{(x,X) \in \mathbb {R}^n \times \mathbb {R}^{|E|} \ | \ \min \{x_i,x_j\} \ge X_{ij} \ge \max \{0,x_i + x_j - 1\} \forall \ ij \in E\Big \}, \end{aligned}$$

the Boolean Quadric Polytope can be defined as

$$\begin{aligned} \text {BQP} = {\text {conv}}\Big (\text {BQP}^{LP} \cap \left( \mathbb {Z}^n \times \mathbb {Z}^{|E|} \right) \Big ). \end{aligned}$$

The inequalities of BQP\(^{LP}\) imply box-constraints \(0 \le x_i \le 1\) for all \(i \in N\), since \(0 \le X_{ij} \le x_i\) and \(x_i + x_j - 1 \le x_j\) for all \(ij \in E\), cf. [9]. Moreover, if we combine the McCormick inequalities \(X_{ij} \ge 0\) and \(X_{ij} \ge x_i + x_j - 1\), we have

figure d

Analogously, adding up \(x_i \ge X_{ij}\) and \(x_j \ge X_{ji}\), while using \(ij=ji\), yields

figure e

For inequalities \((A_{ij})\) and \((B_{ij})\), we define their slacks

$$\begin{aligned} w_{ij}^A&= 2X_{ij} - x_i - x_j + 1, \end{aligned}$$
(1)
$$\begin{aligned} w_{ij}^B&= -2X_{ij} + x_i + x_j. \end{aligned}$$
(2)

To obtain additional cuts for BQP, certain combinations of \((A_{ij})\)- and \((B_{ij})\)-inequalities are useful. Let \(E^A \subseteq E\) be the set of all edges ij for which we use inequality \((A_{ij})\) and \(E^B \subseteq E\) be the set of all edges ij for which we use inequality \((B_{ij})\). Let

$$\begin{aligned} N^A \subseteq N: \ \text {vertices incident to exactly two edges in } E^A,\\ N^B \subseteq N: \ \text {vertices incident to exactly two edges in } E^B. \end{aligned}$$

We combine \((A_{ij})\)- and \((B_{ij})\)-inequalities such that \(|E^A|\) is odd and \(E^A \ {\dot{\cup }} \ E^B\) is a simple cycle of arbitrary parity, where \({\dot{\cup }}\) denotes the disjoint union.

Definition 2.1

A cycle \(E^A \,{\dot{\cup }}\, E^B\) with \(E^A,E^B \subseteq E\) is called A-odd if \(|E^A|\) is odd and A-even if \(|E^A|\) is even.

Remark 2.2

Adding inequality \((A_{ij})\) to \((B_{jk})\) eliminates variable \(x_j\).

Adding up inequalities for a simple cycle \(E^A \ {\dot{\cup }} \ E^B\) yields

$$\begin{aligned}2\left( \sum _{ij \in E^A} X_{ij} - \sum _{ij \in E^B} X_{ij} - \sum _{i \in N^A} x_i + \sum _{i \in N^B} x_i \right) + |E^A| \ge 0. \end{aligned}$$

Subtracting \(|E^A|\) and dividing by 2 yields

$$\begin{aligned}\sum _{ij \in E^A} X_{ij} - \sum _{ij \in E^B} X_{ij} - \sum _{i \in N^A} x_i + \sum _{i \in N^B} x_i \ge - \frac{|E^A|}{2}. \end{aligned}$$

In the case of \(|E^A|\) odd, we can strengthen this inequality, cf. [3], to

$$\begin{aligned}\sum _{ij \in E^A} X_{ij} - \sum _{ij \in E^B} X_{ij} - \sum _{i \in N^A} x_i + \sum _{i \in N^B} x_i \ge \bigg \lceil -\frac{|E^A|}{2} \bigg \rceil = -\frac{|E^A|}{2} + \frac{1}{2}, \end{aligned}$$

which yields after another transformation

$$\begin{aligned}2\left( \sum _{ij \in E^A} \left( X_{ij}+\tfrac{1}{2}\right) - \sum _{ij \in E^B} X_{ij} - \sum _{i \in N^A} x_i + \sum _{i \in N^B} x_i \right) \ge 1.\end{aligned}$$

That is equivalent to

$$\begin{aligned}\sum _{ij \in E^A} \left( 2 {X}_{ij} + 1 - {x}_i - {x}_j\right) \ \ + \sum _{ij \in E^B} \left( -2 {X}_{ij} + {x}_i + {x}_j\right) \ge 1 \end{aligned}$$

and substituting by \({w}_{ij}^A\) and \({w}_{ij}^B\) yields

$$\begin{aligned} \sum _{ij \in E^A} {w}_{ij}^A \ \ + \sum _{ij \in E^B} {w}_{ij}^B \ge 1. \end{aligned}$$
(3)

We call inequality (3) an A-odd cycle inequality. Notice that this inequality is sometimes just called odd cycle inequality in literature, but we want to avoid confusion with cycles of odd cardinality. Thus, we prefix A to emphasize that \(|E^A|\) must be odd and the parity of the cycle itself is irrelevant.

3 Separation and extended formulation

The following construction is similar to the separation algorithm for the cut polytope presented by Barahona and Mahjoub [2]. Nevertheless, we give a detailed explanation on how the separation problem for the A-odd cycle inequalities of BQP can be solved, since our extended formulation depends on the separation technique. Let \(G=(V_G,E_G)\) be the simple graph with \(V_G = N\) and \(E_G = E\).

Consider the digraph \(F=(V_F,A_F)\) with vertex set \(V_F=\{0,1\}\) and arc set \(A_F=\bigl \{(0,0),(0,1),(1,0),(1,1)\bigr \}\). The categorical graph product \(H=(V_{G\times F},A_{G\times F})\) of G and F is given by the vertex set \(V_{G\times F}=N \times \{0,1\}\) and the arc set \(A_{G\times F} = \big \{((i,r),(j,s)) | ij \in E_G \text { and } (r,s) \in A_F \big \}\).

Let us mention that, as for every arc ((ir), (js)) in H the anti-parallel arc ((js), (ir)) is present too, the separation algorithm would also work with an undirected graph instead of F, that has two vertices connected by an edge and a loop at both vertices. However, this does not make a difference to our extended formulation (if, for example, some variable \(f_{ij}\) is involved for edge ij, then it simultaneously produces an inequality for variable \(f_{ji}\)). Also, directed edges are better suited for network-flow formulations such as (A-OC), which will be defined later.

Now we assign arc variable \(w_{ij}^A\) to the arcs \(((i,r),(j,1-r)) \in A_{G\times F}\) and \(w_{ij}^B\) to the arcs \(((i,r),(j,r)) \in A_{G\times F}\) for all \(r \in \{0,1\}\). Figure 1 shows the structure of H for a single edge \(ij \in E_G\).

Fig. 1
figure 1

The categorical graph product of an edge ij and F

Whenever we use an \((A_{ij})\)-inequality for an edge \(ij \in E_G\), an arc with arc variable \(w_{ij}^A\) in the product graph H is used and the second index of a vertex in H changes from 0 to 1 or from 1 to 0. Otherwise, using a \((B_{ij})\)-inequality for an edge \(ij \in E_G\) corresponds to an arc with arc variable \(w_{ij}^B\) in H and the second index does not change.

Theorem 3.1

For fixed \(({\bar{x}},{\bar{X}})\), the separation problem for the A-odd cycle inequalities of BQP can be solved by computing the weight of a shortest path from (i, 0) to (i, 1) in H for every \(i \in N\). If every and hence the shortest of these paths has \({\bar{w}}\)-weight at least 1, then \(({\bar{x}},{\bar{X}})\) does not violate any A-odd cycle inequality.

Theorem 3.1 follows directly from Lemmas 3.33.5, that we state after the following definition.

Definition 3.2

A uv-path/walk in G together with an assignment of arc variables, either \(w_{ij}^A\) or \(w_{ij}^B\), to every edge ij of the respective path/walk is called A-odd if the total number of assigned arc variables \(w_{ij}^A\) is odd. If the total number is even, the uv-path/walk is called A-even.

Lemma 3.3

Let \(u,v \in V_G\) and \(r,s \in \{0,1\}\). Every (ur)–(vs)-walk in H corresponds to an A-odd uv-walk in G if and only if \(r \ne s\).

Lemma 3.4

Let \(({\bar{x}},{\bar{X}})\) be fixed. The \({\bar{w}}\)-weight of a shortest A-odd cycle in G is equal to the \({\bar{w}}\)-weight of a shortest (i, 0)–(i, 1)-path in H among all \(i \in N\).

Proof

Notice first that the \({\bar{w}}\)-weight of a shortest (i, 0)–(i, 1)-path in H is equal to the \({\bar{w}}\)-weight of a shortest (i, 1)–(i, 0)-path in H because for every arc there is an anti-parallel arc of equal weight. Let P be a shortest (i, 0)–(i, 1)-path of all (i, 0)–(i, 1)-paths in H with \(i \in N\). If the first index of all vertices except (i, 0) and (i, 1), which serve as start and end point, on P is different, then there is nothing to show. Otherwise, if for some j both vertices (j, 0) and (j, 1) lie on P, the \({\bar{w}}\)-weight of the subpath between (j, 0) and (j, 1) cannot exceed the \({\bar{w}}\)-weight of P as we do not have negative arc weights. Conversely, the subpath between (j, 0) and (j, 1) cannot have less \({\bar{w}}\)-weight than P by the assumption of P being one of the shortest of all (i, 0)–(i, 1)-paths in H with \(i \in N\). Without loss of generality we can replace P by a \({\bar{w}}\)-shortest (j, 0)–(j, 1)-path with fewer arcs. Successively, we end up in the first case. \(\square \)

Lemma 3.5

Given \(({\bar{x}},{\bar{X}}) \in \text {BQP}^{LP}\). Then \(({\bar{x}},{\bar{X}})\) violates an A-odd cycle inequality if and only if there exists a path from (i, 0) to (i, 1) in H for some \(i \in N\) of \({\bar{w}}\)-weight less than 1.

Proof

Let \(E^A \ {\dot{\cup }} \ E^B\) be the edge set of a simple cycle C in G whose A-odd cycle inequality is violated by \(({\bar{x}},{\bar{X}})\). Then

$$\begin{aligned}\sum _{ij \in E^A} {\bar{w}}_{ij}^A \ \ + \sum _{ij \in E^B} {\bar{w}}_{ij}^B < 1\end{aligned}$$

by inequality (3) and because \(|E^A|\) is odd, there exists a path from (i, 0) to (i, 1), and one from (i, 1) to (i, 0), in H for all \(i \in C\) that add up the same \({\bar{w}}_{ij}^A\) and \({\bar{w}}_{ij}^B\) as given above. Thus, the weight of this path is less than 1.

For the converse, consider a path from (i, 0) to (i, 1) in H with weight less than 1. Analogously, there exists an A-odd cycle in G of equal weight. \(\square \)

Theorem 3.1 allows us to solve the separation problem for the A-odd cycle inequalities of BQP with a linear program. Ahuja et al. [1, Chapter 9.4] find a shortest st-path by solving a minimum cost flow problem, i.e., by sending one unit of flow from vertex s to vertex t through the network. We apply their technique of using duality to our graph H and consider for fixed \(i \in N\) the linear program

figure f

where the f-variables are indexed by two vertices in H, hence \(f_{isjt}\) is shorthand for \(f_{(i,s),(j,t)}\) and relates to a lower bound for the weight of paths from (is) to (jt). Moreover, (i, 0) serves as the start vertex and (i, 1) as the target vertex of a path. Notice that we partition the inequalities into two types. Both of them bound the variables \(f_{i0js}\), and hence the weight of a shortest (i, 0)–(js)-path in H, from above by the weight of any (i, 0)–(js)-path in H where the last arc is fixed. The first type of inequalities ensures that the last arc on the path has arc weight \({\bar{w}}_{kj}^A = 2{\bar{X}}_{kj} - {\bar{x}}_k - {\bar{x}}_j + 1\) whenever \(s \ne t\) in order to arrive at vertex (js), i.e., when the last inequality on the path is an \((A_{kj})\)-inequality. For \(s = t\), that is, if the last inequality is a \((B_{kj})\)-inequality, we have to use arcs with arc weight \({\bar{w}}_{kj}^B=-2{\bar{X}}_{kj} + {\bar{x}}_k + {\bar{x}}_j\). Thus, the above linear program increases variable \(f_{i0i1}\) until it is equal to the weight of a shortest (i, 0)–(i, 1)-path in H and therefore it does not exceed the weight of any (i, 0)–(i, 1)-path in H. Obviously, this is also true for every variable \(f_{i0js}\) if vertex (js) is part of a shortest (i, 0)–(i, 1)-path.

If the objective value of a solution of this linear program is greater or equal than 1 for every \(i \in N\), then \(({\bar{x}},{\bar{X}})\) fulfills all A-odd cycle inequalities of BQP.

Using this idea, we obtain the following compact extended formulation that enforces all A-odd cycle inequalities. Notice that x and X as well as w are now variables in contrast to the separation linear program (A-OC).

Theorem 3.6

The linear system

$$\begin{aligned} f_{irir}&= 0&\forall&\ i \in N, \ r \in \{0,1\}, \end{aligned}$$
(4)
$$\begin{aligned} f_{irjs}&\le f_{ir kt} \ + \ w_{kj}^A&\forall&\ kj \in E, \ i \in N, \ r,s,t \in \{0,1\}, \ s \ne t, \end{aligned}$$
(5)
$$\begin{aligned} f_{irjs}&\le f_{ir kt} \ + \ w_{kj}^B&\forall&\ kj \in E, \ i \in N, \ r,s,t \in \{0,1\}, \ s = t, \end{aligned}$$
(6)
$$\begin{aligned} f_{i0i1}&\ge 1&\forall&\ i \in N, \end{aligned}$$
(7)

together with Eqs. (1) and (2) is an extended formulation of the (potentially exponentially many) A-odd cycle inequalities of BQP and therefore provides a relaxation for BQP.

Proof

Let \(({\bar{x}},{\bar{X}}) \in \text {BQP}^{LP}\). Then the weights \({\bar{w}}^A\) and \({\bar{w}}^B\) are explicitly given by equations (1) and (2).

We first show that if inequalities (3) are fulfilled by \(({\bar{x}},{\bar{X}})\), then for every pair (ir) and (js) in \(V_{G\times F}\) there exists \({\bar{f}}_{irjs}\) such that \(({\bar{x}},{\bar{X}},{\bar{f}})\) is feasible for inequalities (4)–(7). Define \({\bar{f}}_{irjs}\) as the weight of a shortest (ir)–(js)-path in H if such a path exists. Otherwise, assign a large value to \({\bar{f}}_{irjs}\). Inequalities (4) are obviously fulfilled, as shortest paths from a vertex to itself have weight 0 in digraphs where all arc weights are nonnegative. Inequalities (5) and (6) express that the weight of a shortest (ir)–(js)-path cannot exceed the weight of an (ir)–(js)-path where the last arc is fixed, which is always true. Finally, Lemma 3.5 ensures that inequalities (7) are fulfilled.

Conversely, let \(({\bar{x}},{\bar{X}},{\bar{f}})\) be feasible for inequalities (4)–(7). Then \({\bar{f}}_{irir}=0\) for every \(i \in N\) and \(r \in \{0,1\}\) by Eq. (4), which is equal to the weight of a shortest path from vertex (ir) in H to itself. Consider the case \((k,t)=(i,r)\) in inequalities (5) and (6). For every \(ij \in E\), variables \(f_{irjs}\) are bounded from above by arc variables \(w_{ij}^A\) if \(r \ne s\). Moreover, variables \(f_{irjs}\) are bounded from above by arc variables \(w_{ij}^B\) if \(r=s\). Taking those cases for inequalities (5) and (6) into account, where \((k,t) \ne (i,r)\), every variable \(f_{irjs}\) is bounded from above by the weight of a shortest path from (ir) to (js) in H. Thus, for every vertex pair (ir) and (js) in H, the value \({\bar{f}}_{irjs}\) is lower or equal than the weight of a shortest path from (ir) to (js) in H. Since \({\bar{f}}_{i0i1}\) is lower or equal than the weight of a shortest (i, 0)–(i, 1)-path in H and \({\bar{f}}_{i0i1} \ge 1\) for \(i \in N\), every shortest (i, 0)–(i, 1)-path in H has weight at least 1. This holds for every \(i \in N\) and therefore all A-odd cycle inequalities (3) are fulfilled by \(({\bar{x}},{\bar{X}})\), see Lemma 3.5. \(\square \)

Remark 3.7

The extended A-odd cycle formulation in Theorem 3.6 requires \(4n^2\) additional variables f, whereas the \(w^A\)- and \(w^B\)-defining equations can be replaced by their definition in terms of x and X. In total, \(16|E|n + n\) inequalities are added. Notice that \(f_{irir}\) for all \(i \in N\) and \(r \in \{0,1\}\) are just constant numbers and every edge \(kj \in E\) produces two inequalities for fixed \(i \in N\) and \(r,s,t \in \{0,1\}\).

The extended formulation of Boros et al. [4] includes four different inequalities for every subset \(\{i,j,k\}\) of three different vertices of N, that all involve variables \(X_{ij}\), \(X_{ik}\), and \(X_{jk}\), independent of the sparsity of Q. Each of these triangle inequalities is equivalent to one A-odd cycle inequality for a cycle of length three in a complete graph and vice versa. The number of inequalities (5) and (6) in our extended formulation depends on the cardinality of N and E. The latter represents the density of Q and hence our formulation is much more compact if Q is sparse.

4 Numerical experiments

In a computational study, Bonami et al. [3] add \(0-\tfrac{1}{2}-\)Chvátal–Gomory cuts heuristically to the basic relaxations LP\(_{\mathcal {M}}\) and QP\(_{\mathcal {M}^2}\) in CPLEX. They apply this method to the 99 BoxQP test instances of Nemhauser and Vandenbussche [11], Burer and Vandenbussche [6], and Burer [5]. Our contribution is to compute the bounds that arise from exact A-odd cycle separation for the pure linear program LP\(_{\mathcal {M}}\). To this end, we add the extended relaxation from Theorem 3.6 to the constraint set of LP\(_{\mathcal {M}}\) and solve the resulting LP with CPLEX v. 12.8.0.0 on the same benchmark set. The computation takes a few seconds on an 8-core Intel Core i7-6700 CPU machine running at 3.40 GHz for each of the smaller instances, whereas a few minutes of running time where consumed when solving the larger ones. The largest instances required up to two hours of running time, but our focus here is more on the strength of the relaxation than on raw speed.

Adding the extended relaxation from Theorem 3.6 to QP\(_{\mathcal {M}^2}\) gives a convex quadratic program with a large number of variables and inequalities. Although we could by far not solve all of these QPs in reasonable running time, we compute the solutions for a subset of all test instances, i.e., all instances where \(n \le 40\) whose density is not too high. Even for some of these small instances, the computation took several hours.

The optimality gap is defined as

$$\begin{aligned} {\text {gap}}(z) :=\left| \frac{z_{\text {BoxQP}}-z}{z} \right| \times 100, \end{aligned}$$

where \(z_{\text {BoxQP}}\) is the optimal objective value of the BoxQP and z is the optimal objective value of the considered relaxation.

We denote the bounds arising from LP\(_{\mathcal {M}}\) and QP\(_{\mathcal {M}^2}\), respectively, by \(z_{\mathcal {M}}\) and \(z_{\mathcal {M}^2}\). The notation LP\(_{\mathcal {M}}^\circ \) is used when \(0-\tfrac{1}{2}-\)Chvátal–Gomory cuts are added heuristically to LP\(_{\mathcal {M}}\) via CPLEX (see [3]) and LP\(_{\mathcal {M}}^\bullet \) is used for LP\(_{\mathcal {M}}\) strengthened with all inequalities (4)–(7) together with Eqs. (1) and (2). We define QP\(_{\mathcal {M}^2}^\circ \) and QP\(_{\mathcal {M}^2}^\bullet \) analogously. The bounds arising from optimal solutions of LP\(_{\mathcal {M}}^\circ \), LP\(_{\mathcal {M}}^\bullet \), QP\(_{\mathcal {M}^2}^\circ \), and QP\(_{\mathcal {M}^2}^\bullet \) are denoted by \(z_{\mathcal {M}}^\circ \), \(z_{\mathcal {M}}^\bullet \), \(z_{\mathcal {M}^2}^\circ \), and \(z_{\mathcal {M}^2}^\bullet \), respectively.

Let d be the percentage of non-zeros in Q. An instance is called sparse, medium, or dense, if \(d \le 40\%\), \(40\% < d \le 60\%\), or \(d > 60\%\), respectively. Moreover, we divide these classes further into small (\(n \in \{20,30,40\}\)), medium (\(n \in \{50,60,70\}\)), large (\(n \in \{80,90\}\)), and jumbo (\(n \in \{100,125\}\)).

The set of small test instances contains 6 sparse, 9 medium, and 27 dense instances. Table 1 shows how much of the optimality gap of LP\(_{\mathcal {M}}\) and QP\(_{\mathcal {M}^2}\) is closed by the A-odd cycle inequalities when adding them heuristically and when separating all of them.

Table 1 Average optimality gap for small instances (\(n \in \{20,30,40\}\))
Fig. 2
figure 2

Average optimality gap for medium and large instances

Fig. 3
figure 3

Average optimality gap for jumbo instances

The average optimality gap left by LP\(_{\mathcal {M}}\), QP\(_{\mathcal {M}^2}\), LP\(_{\mathcal {M}}^\circ \), QP\(_{\mathcal {M}^2}^\circ \), and LP\(_{\mathcal {M}}^\bullet \), respectively, for all instances with \(n \ge 50\) is visualized in Figs. 2 and 3. We obtain that the pure linear relaxation LP\(_{\mathcal {M}}\) together with all or at least some A-odd cycle inequalities closes by far more of the optimality gap than the quadratic relaxation QP\(_{\mathcal {M}^2}\) without the A-odd cycle inequalities, regardless of the choice of the size n or the density d. Moreover, the impact of the A-odd cycle inequalities increases when decreasing the density of Q. Especially on sparse instances, the relaxation LP\(_{\mathcal {M}}^\bullet \) is much stronger than LP\(_{\mathcal {M}}^\circ \). Furthermore, LP\(_{\mathcal {M}}^\bullet \) is on average stronger than QP\(_{\mathcal {M}^2}^\circ \), except for dense instance, where the difference regarding the optimality gap is very small. For all test instances, bounds and optimality gaps are listed in the appendix.

5 Conclusion

We showed how to construct a tight compact extended relaxation for nonconvex QP with box constraints by enforcing the A-odd cycle inequalities for the Boolean Quadric Polytope. Therefore, we avoid running multiple rounds of a separation algorithm. On a large benchmark set, our computational results illustrate how efficient it is to strengthen the weak linear relaxation LP\(_{\mathcal {M}}\). Since our strengthened relaxation remains linear, it is applicable in practice. We think that our extended formulation might be most useful in problems that have a small quadratic programming substructure within larger structures, so that the quadratic subproblem can be strengthened in one step.