DBCP is a CVXPY extension for modeling and approximately solving biconvex optimization problems of the form
where
DBCP extends CVXPY's disciplined convex programming rules with structured products between expressions from the two variable blocks. A model is accepted when fixing either supplied block produces a DCP-compliant CVXPY problem.
DBCP solves accepted models with proximal alternating convex search.
BiconvexProblem.solve() uses the original constraints by default; its
mode="penalty" option instead introduces and penalizes constraint slacks to
permit infeasible iterates. The user guide
describes the modeling rules, solution methods, and result statuses in detail.
DBCP requires Python 3.12 or newer, CVXPY 1.9 or newer, and NumPy 2.3.3 or newer. Install it from PyPI with:
pip install dbcpDBCP manages its development environment with uv. After installing uv, clone the repository and install the locked development dependencies:
git clone https://github.com/dxogrp/dbcp.git
cd dbcp
make syncThis example factors a nonnegative matrix
The objective is convex in
import cvxpy as cp
import numpy as np
import dbcp
rng = np.random.default_rng(10015)
m, n, k = 5, 10, 3
A = rng.random((m, k)) @ rng.random((k, n))
X = cp.Variable((m, k), name="X")
Y = cp.Variable((k, n), name="Y")
X.value = rng.random(X.shape)
Y.value = rng.random(Y.shape)
problem = dbcp.BiconvexProblem(
cp.Minimize(cp.sum_squares(X @ Y - A)),
[X],
[Y],
[X >= 0, Y >= 0],
)
assert problem.is_dbcp()
value = problem.solve()The [X] and [Y] arguments supply the x_var and y_var variable groups,
while the last argument encodes the nonnegativity constraints. DBCP alternately
optimizes one group while holding the other fixed and writes the result into
the original CVXPY variables.
Because unset variables are initialized randomly, different starting points
can produce different factorizations. Assign X.value and Y.value before
solve() when a specific warm start is desired.
The complete user guide and API reference are available in the published documentation. To build and preview the documentation locally, run:
make docsThe examples directory contains seven
Marimo notebooks demonstrating DBCP. Run
make marimoto install Marimo and open the notebooks in your browser. Executed, non-interactive versions are available in the published example gallery.
DBCP is licensed under the Apache License 2.0.
If you find DBCP useful in your research, please consider citing our paper.