Correlative Sparsity Detection

The sparsity.py module implements automatic detection of correlative sparsity in polynomial optimization problems. Correlative sparsity exploits the structure of variable interactions to decompose large moment matrices into smaller block- diagonal components, dramatically reducing SDP solve times.

Theory

Correlative Sparsity via UnionFind

A polynomial optimization problem exhibits correlative sparsity when the variables appearing in each constraint and the objective can be partitioned into overlapping subsets that interact only through shared variables. Formally, define the sparsity graph \(G = (V, E)\) where:

  • Vertices \(V = \{x_1, \dots, x_n\}\) are the problem variables

  • An edge \((x_i, x_j) \in E\) exists if variables \(x_i\) and \(x_j\) appear together in some monomial of a constraint or the objective

The connected components of this graph determine which variable subsets can be treated independently. If \(G\) has \(k\) connected components with vertex sets \(V_1, \dots, V_k\), then the moment matrix decomposes into \(k\) smaller blocks rather than one monolithic \(n\)-variable block.

The implementation uses a Union-Find (disjoint-set union) data structure to compute connected components efficiently:

# Pseudocode for sparsity detection from polynomial list
uf = UnionFind(n_variables)
for poly in [objective, *constraints]:
    for monomial in poly.monomials():
        vars_in_monomial = [i for i in range(n) if monomial.degree[i] > 0]
        for i in range(1, len(vars_in_monomial)):
            uf.union(vars_in_monomial[0], vars_in_monomial[i])

components = uf.components()  # List of integer sets

Chordal Decomposition of Moment Matrices

When the sparsity graph is chordal (every cycle of length \geqslant 4 has a chord), the moment matrix \(M_t(y)\) admits an exact block-diagonal decomposition via the running intersection property. This means:

  1. The PSD constraint \(M_t(y) \succeq 0\) is equivalent to a set of smaller PSD constraints on clique-based submatrices

  2. Each submatrix involves only the variables in one clique, reducing dimension from \(\binom{n+td}{td}\) to sums of \(\binom{|C_i|+td}{td}\)

For non-chordal graphs, a chordal completion adds edges to make the graph chordal while preserving the problem structure. The implementation detects this automatically and reports the completed clique structure.

Block-Diagonal Reduction Factors

The reduction factor depends on the sparsity pattern:

  • Fully dense (one component of size \(n\)): No reduction, matrix size \(\binom{n+td}{td}\)

  • Two disjoint components of size \(n/2\): Matrix sizes sum to \(2 \cdot \binom{n/2+td}{td}\), typically a \(10\times\)–\(100\times\) reduction for large \(n\)

  • Many small components: Near-linear scaling in \(n\) rather than polynomial

API Reference

CorrelativeSparsity Class

from Irene.sparsity import CorrelativeSparsity, detect_sparsity_from_polys

# From a list of polynomials (objective + constraints)
sparsity = detect_sparsity_from_polys([objective, g1, g2, ...], n_variables)

# Access component structure
components = sparsity.components    # List of sets of variable indices
n_components = len(components)      # Number of disjoint blocks
clique_sizes = [len(c) for c in components]  # Variables per block

The detect_sparsity_from_polys function returns a CorrelativeSparsity object with:

  • components (list[set[int]]): Connected components as sets of variable indices

  • n_components (int): Number of disjoint blocks

  • max_clique_size (int): Largest component size (determines worst-case block dimension)

  • reduction_factor (float): Estimated dimension reduction ratio

Integration with Relaxation Pipeline

Sparsity detection is automatically applied when configured in the relaxation engine:

from Irene.relaxations import RelaxationConfig
from Irene.relaxation_api import RelaxationEngine

config = RelaxationConfig(
    sparsity_detection=True,
    verbose_reduction=True,  # Shows detected components
)
engine = RelaxationEngine(prog, order=2, config=config)
result = engine.solve("sos")

When verbose_reduction=True, the engine prints detected component structure:

Sparsity detection: 3 components found
  Component 0: variables {x1, x2, x5} (size 3)
  Component 1: variables {x3, x4} (size 2)
  Component 2: variables {x6, x7, x8} (size 3)
Estimated reduction factor: 12.4x

Practical Notes

  1. Sparsity detection is free — it adds negligible overhead to the relaxation pipeline

  2. The Union-Find structure runs in nearly-linear time \(O(m \cdot \alpha(n))\) where \(m\) is the total monomial count and \(\alpha\) is the inverse Ackermann function

  3. For problems with no sparsity (all variables interact), detection correctly returns a single component of size \(n\), incurring no penalty

  4. Sparsity works best when combined with Newton polytope pruning — the two reductions are complementary

References

  • Waki, H., Kim, S.-J., & Vanderbei, R. J. (2007). “Sums of squares and sparsity in semidefinite programming.” SIAM Journal on Optimization, 18(1), 41–60.

  • Lasserre, J.-B. & Parrilo, P. A. (2004). “Sparse polynomial optimizations via sum-of-squares and global optimization.” Mathematical Programming, 103(1), 267–292.

  • Aufberger, J., Dimauri, A., & Safey El Din, M. (2018). “Exploiting sparsity in polynomial optimization via the Lasserre hierarchy.” SIAM Journal on Optimization, 28(4), 3365–3391.