Skip to content

sburer/sdplr

Repository files navigation

SDPLR

SDPLR is a C implementation of a low-rank algorithm for large-scale semidefinite programming (SDP): it parameterizes the positive-semidefinite variable as X = R·Rᵀ and solves the resulting smooth nonlinear program with an augmented Lagrangian / L-BFGS method, scaling to problems where interior-point methods are impractical.

Reference: Burer & Monteiro, "A nonlinear programming algorithm for solving semidefinite programs via low-rank factorization," Mathematical Programming, 2003.


Prerequisites

  • GCC
  • LAPACK and BLAS (+ gfortran runtime)
  • No other external dependencies — a minimal GSL 1.5 subset is bundled

Ubuntu/Debian:

sudo apt-get install gcc liblapack-dev libblas-dev gfortran

macOS (Homebrew):

brew install gcc lapack openblas

Quick start

git clone https://github.com/sburer/sdplr.git
cd sdplr
./configure.sh          # auto-detects LAPACK/BLAS, writes Makefile.inc
make
./sdplr data/vibra1.dat-s

Expected tail of output:

DIMACS error measures: 9.55e-06 0.00e+00 0.00e+00 (n/a) 3.61e-06 -1.48e-05

Run the full test suite:

make test       # all five test problems
make test-fast  # vibra1 only (a few seconds)

Usage

./sdplr <input_file> [params_file] [soln_in] [soln_out]
./sdplr gen_params
  • params_file — optional; if omitted, built-in defaults are used
  • soln_in — warm-start from a previously saved solution file
  • soln_out — write the final solution to a file (requires params_file; use a dummy filename for soln_in if you only want to save, not load)
  • gen_params — interactive wizard that writes a params_file; type i at any prompt for a detailed explanation of that parameter

Key parameters (see sdplr.params for defaults):

Parameter Default Meaning
Feasibility tolerance 1e-5 Primal/dual feasibility stopping criterion
Rank reduction 0 1 = attempt rank reduction during solve
Time limit 3600 s Wall-clock budget
Number of LBFGS vectors 4 L-BFGS memory
Duality gap tolerance 1e-3 Gap-based stopping criterion

Input formats

SDPLR accepts two formats, selected by the Input type parameter (1 = SDPA sparse, 2 = SDPLR).

SDPA sparse format (default)

Each data line has five fields: mat_index blk row col value

  • mat_index = 0 — the objective matrix C; mat_index = i ≥ 1 — constraint matrix Aᵢ
  • Sign convention: SDPLR negates the objective matrix on read, so the problem it solves internally is min −C•X s.t. Aᵢ•X = bᵢ, X ⪰ 0. To minimize f(X) = C•X, write −C as the entry-0 matrix in the file.
  • Block sizes: positive integer = SDP block; negative integer = diagonal (LP) block

Example files are in data/ and tests/data/.

SDPLR format

An extension of SDPA sparse that also supports low-rank data matrices A = BDBᵀ, useful when constraint matrices have known low-rank structure. See CLAUDE.md for the full format specification and a worked example.


MATLAB interface

Build from within MATLAB:

run mexinstall.m   % compiles mexsdplr and sets paths
help sdplr         % full calling convention

Calling convention: [x, y, info, r] = sdplr(A, b, c, K, pars, ...) where K follows SeDuMi cone format (K.s = SDP block sizes, K.l = number of nonneg variables).

Windows note: the top two lines of mexinstall.m may need adjustment to point to MATLAB's LAPACK/BLAS library locations on your system.


Windows (MinGW)

Install the MinGW base system (including make), the gcc/gfortran toolchain, and LAPACK/BLAS libraries for MinGW. Then:

copy Makefile.inc.mingw Makefile.inc   (edit paths as needed)
mingw32-make mingw

Repository layout

source/            C source files
data/              sample problem (vibra1.dat-s)
tests/             test suite (run_tests.sh, check_output.py, test data)
gsl-1.5/           bundled GSL polynomial subset
lib/               built GSL archive (libgsl.a, generated)
sdplr.params       default parameter file
sdplr.m            MATLAB wrapper
mexinstall.m       MATLAB MEX build script
Makefile.inc       local build config (generated by configure.sh)
Makefile.inc.mingw Windows/MinGW template
configure.sh       auto-configuration script
CLAUDE.md          developer reference

Contributors

  • Samuel Burer (University of Iowa)
  • Renato D.C. Monteiro (Georgia Institute of Technology)
  • Changhui Choi (University of Colorado Denver)

License

GPL v2 — see COPYING. The bundled GSL 1.5 subset is also GPL v2.

About

Low-Rank Algorithm for Semidefinite Programming

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors