Convexifying Butterfly Functions
- Butterfly-shaped functions are bivariate, piecewise quadratic maps defined by four wing patches, illustrating nonconvexity that requires convex envelopes for optimization.
- Convex envelope computation uses polyhedral subdivision and Fenchel duality to derive piecewise rational approximations, ensuring global convexity across regions.
- QP-based convex surrogate fitting efficiently approximates the convex envelope from sample data, guaranteeing optimality and reproducibility in analysis.
A butterfly-shaped function refers to a prototypical bivariate surface exhibiting nonconvexity and piecewise structure, often modeled as multiple quadratic patches meeting along diagonals. Convexifying such functions—explicitly constructing their convex envelopes or fitting convex surrogates—is fundamental in convex analysis, optimization, and convex regression. The canonical butterfly map provides a benchmark example for techniques bridging nonconvex surfaces with convex programmatic representations in both symbolic and numeric settings.
1. Butterfly-Shaped Functions: Structure and Modeling
Butterfly-shaped functions typically arise as bivariate, piecewise quadratic surfaces segmented into four "wing" patches meeting along two diagonals. Mathematically, each patch is defined as
where may be indefinite, , , and is a region (e.g., triangle or trapezoid) in the plane (Kumar et al., 2021). The butterfly form exemplifies piecewise quadratic maps with contour discontinuities at the region boundaries, producing nonconvexity not only locally due to the indefinite , but also globally due to the stitched structure.
Such functions serve as illustrative testbeds for convex analysis methods as they encompass both smooth and nonsmooth behaviors, enforce exact geometry at vertices and edges, and reveal the challenges of convex envelope computation and surrogate fitting (Kumar et al., 2021, Schaller et al., 4 Jun 2025).
2. Convex Envelope Computation via Polyhedral Subdivision
The closed convex envelope of a butterfly-shaped map is the maximal convex underestimator. For each quadratic patch, if is positive semidefinite, the envelope coincides with everywhere. For indefinite , one must:
- Apply a linear change of variables so is expressed in mixed form (bilinear plus affine),
- Identify "McCormick-lines"—critical lines segmenting the region along which the bilinear nonconvexity is maximal,
- Subdivide into subpolygons along these lines (Kumar et al., 2021).
Within each , the convex envelope is written as
with coefficients derived via supporting planes and convexity constraints. The envelope is always below , is piecewise rational, and its level sets are linearly ruled. The graph is but not typically across region boundaries; for the butterfly wing example, exactly three subtriangles arise per patch, each admitting such an explicit formula (Kumar et al., 2021).
3. Biconjugation: Fenchel Analysis and Explicit Envelope Recovery
Convexification by biconjugation leverages Fenchel duality:
- Compute the Fenchel conjugate for each rational envelope on :
- Vertex regions: is affine, valid in normal cones at vertices.
- Edge regions: admits a rational-over-square-root format,
where , are explicit affine functions from the patch coefficients. - Interior regions: follows by , tracing parabolic arcs (Kumar et al., 2021).
- Reassemble: take the supremum over all per-cell conjugates to form , defined piecewise on a parabolic subdivision of the dual space.
- Take the conjugate again, , restoring the closed convex envelope:
reducing to a piecewise function again, with regions corresponding to square-over-linear forms (Kumar et al., 2021). For the butterfly, this yields a piecewise rational envelope exactly matching the convex hull.
The process—involving subdivision, dualization, supremization, and re-dualization—is symbolic and, except for initial envelope computation, can be completed in linear time with respect to polygon edges (Kumar et al., 2021).
4. Convex Surrogate Fitting via Quadratic Programming
An alternative, data-driven approach to convexification fits a surrogate parametrically:
where are free parameters and are anchor points sampled across the butterfly domain (Schaller et al., 4 Jun 2025). By construction, is convex in for any .
To fit to observed or simulated data , solve the convex quadratic program: \begin{align*} \min_{f_i,\,g_i} &\quad \sum_{i=1}N (f_i - y_i)2 + \lambda \sum_{i=1}N |g_i|_22 \ \text{s.t.} &\quad f_j \geq f_i + g_i\top (x_j - x_i),\quad i,j=1,\dots,N, \end{align*} where regularizes the subgradients and constraints enforce convexity and disciplined convex programming (DCP) compliance (Schaller et al., 4 Jun 2025).
Sampling on a fine grid (e.g., over ), the procedure fits the convex envelope in seconds using solvers (CVX, CVXPY, MOSEK, Gurobi). Evaluation via RMSE on held-out data reveals that the surrogate matches the main convex "envelope" of the butterfly efficiently, with full reproducibility and guarantee of global optimality of the fitted envelope (Schaller et al., 4 Jun 2025).
5. Symbolic and Numerical Implementation Considerations
Symbolic envelope computation, especially for indefinite quadratics, requires polyhedral subdivision and management of rational-over-linear forms for each cell. The conjugation and biconjugation steps can be implemented in time, where is the cumulative number of edges across all subpolygons. The bottleneck remains the initial envelope calculation, which can be exponential in the polygonal complexity unless is positive semidefinite.
Numerically, the QP-based fitting method allows convex envelopes to be learned directly from sampled data and interfaced with DCP-compliant modeling languages. Hyperparameters, notably , control surrogate smoothness and prevent overfitting or oscillatory fit; cross-validation is recommended for selection (Schaller et al., 4 Jun 2025).
Evaluating the fit involves computing on test grids and reporting RMSE. For grid sizes () and moderate , the convex hull-style surrogate consistently captures the convex envelope with low average error (Schaller et al., 4 Jun 2025).
6. Applications and Significance in Convex Analysis
Convexification of butterfly-shaped functions formalizes the process of bridging nonconvex quadratic surfaces with convex optimization frameworks. This is salient for parametric modeling of optimization families and specification in domain-specific languages for convex programming (Schaller et al., 4 Jun 2025). The techniques described—symbolic envelope with explicit formulas and QP-based surrogate fitting—are foundational for:
- Analyzing piecewise-quadratic maps in robust control, signal processing, and statistics,
- Enabling disciplined programmatic convexity in optimization modeling systems,
- Providing benchmark examples for algorithmic, symbolic, and numeric convexification strategies.
A plausible implication is that convex surrogate fitting and explicit envelope construction methods generalize to broader nonconvex and piecewise-defined surfaces beyond the butterfly, especially with improvements in computational geometry and symbolic algebraic methods for envelope determination.
7. Complexity and Algorithmic Efficiency
- Envelope Computation: Exponential in the number of polygon vertices for indefinite quadratics; bottleneck of symbolic approach (Kumar et al., 2021).
- Conjugation and Biconjugation: Linear time in total edge number ; per-cell dualization and pointwise supremum are efficient.
- QP Surrogate Fitting: Numerical solvers compute the global optimum rapidly for practical ; reproducible and DCP-compliant (Schaller et al., 4 Jun 2025).
All steps, aside from initial envelope decomposition, admit streamlined, implementable routines. No additional complexity is induced by vertices at which numerator and denominator vanish simultaneously; extension by continuity suffices.
| Step | Symbolic Envelope (Kumar et al., 2021) | Convex QP Surrogate (Schaller et al., 4 Jun 2025) |
|---|---|---|
| Data Required | Closed-form parameters | Sampled grid points |
| Complexity | (excluding envelope) | (QP solver) |
| Result Description | Piecewise rational (square/linear) | Max-of-affine hyperplane envelope |
Explicit construction and QP fitting both guarantee global convexity and approximation fidelity for the butterfly-shaped surface.