DCCP
DCCP package provides an organized heuristic for convex-concave programming. It tries to solve nonconvex problems where every function in the objective and the constraints has any known curvature according to the rules of disciplined convex programming (DCP). For instance, DCCP can be used to maximize a convex function. The full details of our approach are discussed in the associated paper. DCCP is built on top of CVXPY, a domain-specific language for convex optimization embedded in Python.
Installation
Requirements:
- Python 3.11 or higher
- CVXPY 1.9.0 or higher
You can install the latest DCCP package via pip:
pip install dccp
To install the development version, clone this repository and install in development mode:
git clone https://github.com/cvxgrp/dccp.git
cd dccp
pip install -e .
Note: DCCP now includes full type hints and passes strict type checking with pyright.
DCCP Rules
A problem satisfies the rules of disciplined convex-concave programming (DCCP) if it has the form
$$ \begin{align} \text{minimize/maximize} \quad & o(x) \ \text{subject to} \quad & l_i(x) \sim r_i(x), \quad i=1,\ldots,m, \end{align} $$
where $o$ (the objective), $l_i$ (left-hand sides), and $r_i$ (right-hand sides) are expressions (functions in the variable $x$) with curvature known from the DCP composition rules, and $\sim$ denotes one of the relational operators $==$, $<=$, or $>=$.
In a disciplined convex program, the curvatures of $o$, $l_i$, and $r_i$ are restricted to ensure that the problem is convex. For example, if the objective is $\text{maximize} , o(x)$, then $o$ must be concave according to the DCP composition rules. In a disciplined convex-concave program, by contrast, the objective and right and left-hand sides of the constraints can have any curvature, so long as all expressions satisfy the DCP composition rules.
The variables, parameters, and constants in DCCP should be real numbers. Problems containing complex numbers may not be supported by DCCP.
Example
The following code uses DCCP to approximately solve a simple nonconvex problem.
import cvxpy as cp
import dccp
x = cp.Variable(2)
y = cp.Variable(2)
myprob = cp.Problem(cp.Maximize(cp.norm(x - y, 2)), [0 <= x, x <= 1, 0 <= y, y <= 1])
print("problem is DCP:", myprob.is_dcp()) # False
print("problem is DCCP:", dccp.is_dccp(myprob)) # True
result = myprob.solve(method='dccp', seed=3)
print("x =", x.value.round(3))
print("y =", y.value.round(3))
print("cost value =", result)
The output of the above code is as follows.
problem is DCP: False
problem is DCCP: True
x = [1. 0.]
y = [0. 1.]
cost value = 1.4142135623730951
The solutions obtained by DCCP can depend on the initial point of the CCP algorithm.
The algorithm starts from the values of any variables that are already specified; for any that are not specified, random values are used.
You can specify an initial value manually by setting the value field of the variable.
For example, the following code runs the CCP algorithm with the specified initial values for x and y:
import numpy
x.value = numpy.array([1, 2])
y.value = numpy.array([-1, 1])
result = myprob.solve(method='dccp')
By first clearing the variable values using x.value = None and y.value = None, the CCP algorithm will use random initial values.
Setting the parameter k_ccp specifies the number of times that the CCP algorithm runs, starting from random initial values for all variables. The best solution found is returned.
For all available parameters, see the documentation.
License
This project is licensed under GPLv3 - see the LICENSE file for details.
Citation
If you wish to cite DCCP, please cite the DCCP papers listed in our citation guide or copy the text below.
@article{shen2016disciplined,
author = {Xinyue Shen and Steven Diamond and Yuantao Gu and Stephen Boyd},
title = {Disciplined convex-concave programming},
journal = {2016 IEEE 55th Conference on Decision and Control (CDC)},
pages = {1009--1014},
year = {2016},
url = {https://stanford.edu/~boyd/papers/dccp.html},
}
Release files for dccp 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dccp-1.1.1.tar.gz | 827.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dccp-1.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 858.1 kB
Release files / dccp-1.1.1.tar.gz
| Download URL | dccp-1.1.1.tar.gz |
|---|---|
| Size | 827.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0b1a1346bb38c38b5a0c079238395f184558e48aaada5ef57ac80c2168c5eb83
|
|
BLAKE2b-256 checksum How to use checksums |
71d9fc583c545a6c77e294dd7bb19164cbffdd911ebb0d2a02bb2e06ecafe08a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 8, 2026.
Transparency logRelease files / dccp-1.1.1-py3-none-any.whl
| Download URL | dccp-1.1.1-py3-none-any.whl |
|---|---|
| Size | 30.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4735c4106b017f3cfe3fb33d79cdcf52b3ef8501d57d844a7354e6c898c38c95
|
|
BLAKE2b-256 checksum How to use checksums |
c95ce4efb07b3e914c4ed42db83a01e6633d1deee0a1e8ff1f9231eceea1b9eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 8, 2026.
Transparency log