https://github.com/cvxgrp/dccp

A CVXPY extension for convex-concave programming

https://github.com/cvxgrp/dccp

Science Score: 23.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    5 of 23 committers (21.7%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (16.9%) to scientific vocabulary

Keywords from Contributors

convex-optimization cvxpy mathematical-optimization modeling-language numerical-optimization optimization-modeling
Last synced: 10 months ago · JSON representation

Repository

A CVXPY extension for convex-concave programming

Basic Info
  • Host: GitHub
  • Owner: cvxgrp
  • License: gpl-3.0
  • Language: Python
  • Default Branch: master
  • Homepage:
  • Size: 1.82 MB
Statistics
  • Stars: 132
  • Watchers: 13
  • Forks: 32
  • Open Issues: 17
  • Releases: 1
Created over 10 years ago · Last pushed 11 months ago
Metadata Files
Readme

README.md

DCCP

build docs codecov license pypi

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

You should first install CVXPY 1.5 or greater.

You can install the latest DCCP package via pip:

bash pip install dccp

To install the development version, clone this repository and install in development mode:

bash git clone https://github.com/cvxgrp/dccp.git cd dccp pip install -e .

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 & li(x) \sim ri(x), \quad i=1,\ldots,m, \end{align} $$

where $o$ (the objective), $li$ (left-hand sides), and $ri$ (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$, $li$, and $ri$ 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.

```python 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.isdcp()) # False print("problem is DCCP:", dccp.isdccp(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.

text 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:

```python 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 the Apache License 2.0 - 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.

bibtex @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}, }

Owner

  • Name: Stanford University Convex Optimization Group
  • Login: cvxgrp
  • Kind: organization
  • Location: Stanford, CA

GitHub Events

Total
  • Issues event: 1
  • Watch event: 6
  • Issue comment event: 17
  • Push event: 4
  • Pull request event: 8
  • Pull request review comment event: 5
  • Pull request review event: 10
  • Fork event: 1
  • Create event: 2
Last Year
  • Issues event: 1
  • Watch event: 6
  • Issue comment event: 17
  • Push event: 4
  • Pull request event: 8
  • Pull request review comment event: 5
  • Pull request review event: 10
  • Fork event: 1
  • Create event: 2

Committers

Last synced: about 1 year ago

All Time
  • Total Commits: 116
  • Total Committers: 23
  • Avg Commits per committer: 5.043
  • Development Distribution Score (DDS): 0.776
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Steven Diamond s****2@s****u 26
Xinyue Shen X****e@D****t 17
Xinyue Shen s****3@m****n 15
Xinyue Shen x****s@s****u 13
Xinyue Shen s****e@c****n 10
Steven Diamond d****l@g****m 10
Xinyue Shen x****n@x****n 4
Xinyue Shen x****n@X****l 3
Miguel Mercado m****9@g****m 2
Jaehyun Park j****k@c****u 2
Xinyue Shen X****e@D****t 2
Xinyue Shen X****e@D****t 1
Xinyue Shen X****e@D****t 1
Xinyue Shen X****e@D****t 1
Xinyue Shen X****e@D****t 1
Xinyue Shen X****e@D****t 1
Xinyue Shen X****e@D****t 1
Xinyue Shen X****e@D****t 1
Ben b****n 1
Mingen Pan 3****n 1
Utkarsh Upadhyay m****l@m****n 1
Xinyue Shen x****n@o****m 1
user799595 1****5 1

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 80
  • Total pull requests: 14
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 19 days
  • Total issue authors: 53
  • Total pull request authors: 9
  • Average comments per issue: 3.64
  • Average comments per pull request: 0.43
  • Merged pull requests: 10
  • Bot issues: 0
  • Bot pull requests: 4
Past Year
  • Issues: 1
  • Pull requests: 6
  • Average time to close issues: N/A
  • Average time to close pull requests: 16 minutes
  • Issue authors: 1
  • Pull request authors: 2
  • Average comments per issue: 3.0
  • Average comments per pull request: 0.33
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 4
Top Authors
Issue Authors
  • keithbriggs (18)
  • dave31415 (3)
  • RobertGCNiu (2)
  • Kreol64 (2)
  • jaehyunp (2)
  • mbilalzafar (2)
  • lorenzosteccanella (2)
  • m-yaghini (2)
  • utotch (2)
  • QCmonk (2)
  • gioperin (1)
  • apigott (1)
  • se4u (1)
  • Rex-sys-hk (1)
  • Noilyn (1)
Pull Request Authors
  • dependabot[bot] (4)
  • langestefan (2)
  • miggy2129 (2)
  • mingen-pan (1)
  • jaehyunp (1)
  • bmsherman (1)
  • user799595 (1)
  • xinyueshen (1)
  • musically-ut (1)
Top Labels
Issue Labels
enhancement (1) bug (1) help wanted (1)
Pull Request Labels
dependencies (4) python:uv (4) bug (1)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 695 last-month
  • Total dependent packages: 1
  • Total dependent repositories: 9
  • Total versions: 13
  • Total maintainers: 2
pypi.org: dccp

A CVXPY extension for difference of convex programs.

  • Versions: 13
  • Dependent Packages: 1
  • Dependent Repositories: 9
  • Downloads: 695 Last month
Rankings
Dependent packages count: 4.7%
Dependent repos count: 4.9%
Average: 6.3%
Stargazers count: 6.7%
Forks count: 7.4%
Downloads: 7.9%
Maintainers (2)
Last synced: 11 months ago

Dependencies

setup.py pypi
  • cvxpy *