cvxpy

A Python-embedded modeling language for convex optimization problems.

https://github.com/cvxpy/cvxpy

Science Score: 36.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
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    34 of 219 committers (15.5%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.6%) to scientific vocabulary

Keywords

convex-optimization cvxpy mathematical-optimization modeling-language numerical-optimization optimization optimization-modeling python

Keywords from Contributors

closember distributed tensor quadratic-programming autograd optimization-algorithms nonlinear-programming semidefinite-programming deep-neural-networks portfolio-optimization
Last synced: 6 months ago · JSON representation

Repository

A Python-embedded modeling language for convex optimization problems.

Basic Info
  • Host: GitHub
  • Owner: cvxpy
  • License: apache-2.0
  • Language: C++
  • Default Branch: master
  • Homepage: https://www.cvxpy.org
  • Size: 205 MB
Statistics
  • Stars: 5,878
  • Watchers: 127
  • Forks: 1,118
  • Open Issues: 266
  • Releases: 57
Topics
convex-optimization cvxpy mathematical-optimization modeling-language numerical-optimization optimization optimization-modeling python
Created over 12 years ago · Last pushed 6 months ago
Metadata Files
Readme Contributing License Code of conduct

README.md

CVXPY

Build Status PyPI - downloads Conda - downloads Discord Coverage Benchmarks OpenSSF Scorecard

The CVXPY documentation is at cvxpy.org.

We are building a CVXPY community on Discord. Join the conversation! For issues and long-form discussions, use Github Issues and Github Discussions.

Contents - Installation - Getting started - Issues - Community - Contributing - Team - Citing

CVXPY is a Python-embedded modeling language for convex optimization problems. It allows you to express your problem in a natural way that follows the math, rather than in the restrictive standard form required by solvers.

For example, the following code solves a least-squares problem where the variable is constrained by lower and upper bounds:

```python3 import cvxpy as cp import numpy

Problem data.

m = 30 n = 20 numpy.random.seed(1) A = numpy.random.randn(m, n) b = numpy.random.randn(m)

Construct the problem.

x = cp.Variable(n) objective = cp.Minimize(cp.sum_squares(A @ x - b)) constraints = [0 <= x, x <= 1] prob = cp.Problem(objective, constraints)

The optimal objective is returned by prob.solve().

result = prob.solve()

The optimal value for x is stored in x.value.

print(x.value)

The optimal Lagrange multiplier for a constraint

is stored in constraint.dual_value.

print(constraints[0].dual_value) ```

With CVXPY, you can model * convex optimization problems, * mixed-integer convex optimization problems, * geometric programs, and * quasiconvex programs.

CVXPY is not a solver. It relies upon the open source solvers Clarabel, SCS, and OSQP. Additional solvers are available, but must be installed separately.

CVXPY began as a Stanford University research project. It is now developed by many people, across many institutions and countries.

Installation

CVXPY is available on PyPI, and can be installed with pip install cvxpy

CVXPY can also be installed with conda, using conda install -c conda-forge cvxpy

CVXPY has the following dependencies:

  • Python >= 3.11
  • Clarabel >= 0.5.0
  • OSQP >= 0.6.2
  • SCS >= 3.2.4.post1
  • NumPy >= 1.22.4
  • SciPy >= 1.13.0

For detailed instructions, see the installation guide.

Getting started

To get started with CVXPY, check out the following: * official CVXPY tutorial * example library * API reference

Issues

We encourage you to report issues using the Github tracker. We welcome all kinds of issues, especially those related to correctness, documentation, performance, and feature requests.

For basic usage questions (e.g., "Why isn't my problem DCP?"), please use StackOverflow instead.

Community

The CVXPY community consists of researchers, data scientists, software engineers, and students from all over the world. We welcome you to join us!

  • To chat with the CVXPY community in real-time, join us on Discord.
  • To have longer, in-depth discussions with the CVXPY community, use Github Discussions.
  • To share feature requests and bug reports, use Github Issues.

Please be respectful in your communications with the CVXPY community, and make sure to abide by our code of conduct.

Contributing

We appreciate all contributions. You don't need to be an expert in convex optimization to help out.

You should first install CVXPY from source. Here are some simple ways to start contributing immediately: * Read the CVXPY source code and improve the documentation, or address TODOs * Enhance the website documentation * Browse the issue tracker, and look for issues tagged as "help wanted" * Polish the example library * Add a benchmark

If you'd like to add a new example to our library, or implement a new feature, please get in touch with us first to make sure that your priorities align with ours.

Contributions should be submitted as pull requests. A member of the CVXPY development team will review the pull request and guide you through the contributing process.

Before starting work on your contribution, please read the contributing guide.

Team

CVXPY is a community project, built from the contributions of many researchers and engineers.

CVXPY is developed and maintained by Steven Diamond, Akshay Agrawal, Riley Murray, Philipp Schiele, Bartolomeo Stellato, and Parth Nobel, with many others contributing significantly. A non-exhaustive list of people who have shaped CVXPY over the years includes Stephen Boyd, Eric Chu, Robin Verschueren, Jaehyun Park, Enzo Busseti, AJ Friend, Judson Wilson, Chris Dembia, and William Zhang.

For more information about the team and our processes, see our governance document.

Citing

If you use CVXPY for academic work, we encourage you to cite our papers. If you use CVXPY in industry, we'd love to hear from you as well, on Discord or over email.

Owner

  • Name: CVXPY
  • Login: cvxpy
  • Kind: organization

A Python-embedded modeling language for convex optimization

GitHub Events

Total
  • Create event: 96
  • Release event: 17
  • Issues event: 128
  • Watch event: 484
  • Delete event: 60
  • Issue comment event: 773
  • Push event: 282
  • Pull request event: 379
  • Pull request review comment event: 349
  • Pull request review event: 470
  • Fork event: 73
Last Year
  • Create event: 96
  • Release event: 17
  • Issues event: 128
  • Watch event: 484
  • Delete event: 60
  • Issue comment event: 773
  • Push event: 282
  • Pull request event: 379
  • Pull request review comment event: 349
  • Pull request review event: 470
  • Fork event: 73

Committers

Last synced: over 1 year ago

All Time
  • Total Commits: 3,209
  • Total Committers: 219
  • Avg Commits per committer: 14.653
  • Development Distribution Score (DDS): 0.474
Past Year
  • Commits: 161
  • Committers: 46
  • Avg Commits per committer: 3.5
  • Development Distribution Score (DDS): 0.77
Top Committers
Name Email Commits
Steven Diamond s****2@s****u 1,687
Akshay Agrawal a****7@g****m 314
Steven Diamond d****d@c****u 153
phschiele 4****e 108
Robin r****n@g****m 63
Riley Murray r****y 58
rileyjmurray i****8@g****m 58
AJ Friend a****d@g****m 55
Jaehyun Park j****k@c****u 47
Akshay Agrawal a****a@c****u 37
Bartolomeo Stellato b****o@g****m 27
Eric Chu e****u@g****m 21
William Zijie Zhang 8****n 20
Richard Barnes r****s@u****u 20
dependabot[bot] 4****] 19
Parth Nobel p****l@b****u 17
Judson Wilson w****n@g****m 16
sschnug u****e 15
Christopher Dembia c****2@c****u 14
Robert McGibbon r****o@g****m 14
Matt Wytock m****k@g****m 14
macklin m****n@s****r 14
Tri Dao t****q@g****m 13
Steven Diamond d****l@g****m 13
Paul 9****k 12
aszekMosek m****k@m****m 11
Eric Chu e****u 11
alex a****i@n****u 9
Misrab Faizullah-Khan f****b@g****m 8
Aryaman Jeendgar 5****r 7
and 189 more...

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 332
  • Total pull requests: 861
  • Average time to close issues: 6 months
  • Average time to close pull requests: 14 days
  • Total issue authors: 220
  • Total pull request authors: 95
  • Average comments per issue: 3.13
  • Average comments per pull request: 2.58
  • Merged pull requests: 585
  • Bot issues: 0
  • Bot pull requests: 146
Past Year
  • Issues: 96
  • Pull requests: 423
  • Average time to close issues: 17 days
  • Average time to close pull requests: 8 days
  • Issue authors: 61
  • Pull request authors: 49
  • Average comments per issue: 1.33
  • Average comments per pull request: 2.07
  • Merged pull requests: 235
  • Bot issues: 0
  • Bot pull requests: 88
Top Authors
Issue Authors
  • Transurgeon (19)
  • rileyjmurray (14)
  • phschiele (11)
  • langestefan (6)
  • yasirroni (5)
  • adishavit (5)
  • akshayka (5)
  • warwickmm (5)
  • govindchari (5)
  • carlosgmartin (5)
  • tschm (4)
  • jonathanberthias (4)
  • SteveDiamond (4)
  • sdementen (4)
  • enzbus (4)
Pull Request Authors
  • Transurgeon (221)
  • dependabot[bot] (146)
  • phschiele (82)
  • SteveDiamond (54)
  • PTNobel (49)
  • govindchari (28)
  • tschm (24)
  • Paulnkk (13)
  • r-barnes (11)
  • maxschaller (8)
  • rileyjmurray (8)
  • senhalil (8)
  • enzbus (7)
  • aryamanjeendgar (7)
  • mlubin (7)
Top Labels
Issue Labels
help wanted (29) good first issue (16) solver interfaces (12) bug (11) feature request (10) enhancement (9) documentation (7) canonicalization (5) Interface: MOSEK (4) performance (4) Interface: XPRESS (2) tests (1) Interface: OSQP (1) installation (1) Interface: CVXOPT (1) where were we? (1) needs attention! (1) Interface: SCS (1) Interface: GUROBI (1)
Pull Request Labels
dependencies (148) PR no backport needed (103) PR backport needed (51) github_actions (39) backport bugfix to 1.1; 1.2; 1.3 (16) backport bugfix to 1.4 and 1.5 (16) documentation (15) bug (13) release-blocker (12) CI (8) backport to 1.4 (8) solver interfaces (6) backport to 1.3 and 1.4 (5) backport bugfix to 1.3 (5) Interface: XPRESS (2) backport bugfix to 1.2 and 1.3 (2) Interface: MOSEK (2) Interface: SCS (1) codex (1)

Packages

  • Total packages: 8
  • Total downloads:
    • pypi 2,364,129 last-month
  • Total docker downloads: 26,512
  • Total dependent packages: 225
    (may contain duplicates)
  • Total dependent repositories: 2,353
    (may contain duplicates)
  • Total versions: 400
  • Total maintainers: 5
pypi.org: cvxpy

A domain-specific language for modeling convex optimization problems in Python.

  • Versions: 139
  • Dependent Packages: 209
  • Dependent Repositories: 2,210
  • Downloads: 2,287,449 Last month
  • Docker Downloads: 26,512
Rankings
Dependent packages count: 0.1%
Dependent repos count: 0.2%
Downloads: 0.4%
Average: 0.7%
Stargazers count: 0.8%
Forks count: 1.3%
Docker downloads count: 1.3%
Maintainers (2)
Last synced: 6 months ago
pypi.org: cvxpy-base

A domain-specific language for modeling convex optimization problems in Python.

  • Versions: 41
  • Dependent Packages: 2
  • Dependent Repositories: 12
  • Downloads: 76,564 Last month
Rankings
Stargazers count: 0.8%
Forks count: 1.3%
Average: 2.4%
Downloads: 2.7%
Dependent packages count: 3.2%
Dependent repos count: 4.2%
Maintainers (3)
Last synced: 6 months ago
conda-forge.org: cvxpy

CVXPY is a Python-embedded modeling language for convex optimization problems. It allows you to express your problem in a natural way that follows the math, rather than in the restrictive standard form required by solvers.

  • Versions: 32
  • Dependent Packages: 13
  • Dependent Repositories: 115
Rankings
Dependent repos count: 3.2%
Average: 4.5%
Dependent packages count: 4.8%
Forks count: 4.9%
Stargazers count: 5.2%
Last synced: 6 months ago
alpine-edge: py3-cvxpy-pyc

Precompiled Python bytecode for py3-cvxpy

  • Versions: 4
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Forks count: 1.9%
Stargazers count: 3.4%
Average: 4.8%
Dependent packages count: 13.9%
Maintainers (1)
Last synced: 6 months ago
alpine-edge: py3-cvxpy

a Python-embedded modeling language for convex optimization problems

  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Stargazers count: 3.2%
Forks count: 3.3%
Average: 5.3%
Dependent packages count: 14.6%
Maintainers (1)
Last synced: 6 months ago
proxy.golang.org: github.com/cvxpy/cvxpy
  • Versions: 138
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 8.6%
Average: 9.2%
Dependent repos count: 9.7%
Last synced: 6 months ago
conda-forge.org: cvxpy-base

CVXPY is a Python-embedded modeling language for convex optimization problems. It allows you to express your problem in a natural way that follows the math, rather than in the restrictive standard form required by solvers.

  • Versions: 30
  • Dependent Packages: 1
  • Dependent Repositories: 16
Rankings
Forks count: 4.9%
Stargazers count: 5.2%
Dependent repos count: 8.9%
Average: 12.0%
Dependent packages count: 29.0%
Last synced: 6 months ago
pypi.org: tyba-cvxpy

A domain-specific language for modeling convex optimization problems in Python.

  • Versions: 11
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 116 Last month
Rankings
Stargazers count: 1.0%
Forks count: 1.2%
Dependent packages count: 6.6%
Average: 14.1%
Dependent repos count: 30.6%
Downloads: 31.0%
Maintainers (1)
Last synced: 6 months ago

Dependencies

doc/requirements.txt pypi
  • alabaster *
  • cloud_sptheme *
  • cvxpy *
  • ecos *
  • numpy *
  • numpydoc *
  • recommonmark *
  • scipy *
  • scs *
  • sphinx *
requirements.txt pypi
  • ecos *
  • numpy *
  • osqp *
  • scipy *
  • scs *
setup.py pypi
  • ecos *
  • numpy *
  • osqp *
  • scipy *
  • scs *
.github/workflows/benchmarks.yml actions
  • JamesIves/github-pages-deploy-action v4.2.2 composite
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
.github/workflows/build.yml actions
  • SonarSource/sonarcloud-github-action master composite
  • actions/checkout v2 composite
  • actions/download-artifact v2 composite
  • actions/setup-python v2 composite
  • actions/upload-artifact v1 composite
  • actions/upload-artifact v2 composite
  • conda-incubator/setup-miniconda v2 composite
  • jamescurtin/isort-action master composite
  • joerick/cibuildwheel v2.11.2 composite
  • py-actions/flake8 v1 composite
  • rokroskar/workflow-run-cleanup-action master composite
.github/workflows/docs.yml actions
  • JamesIves/github-pages-deploy-action v4.2.2 composite
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
.github/workflows/pr_benchmark_comment.yml actions
  • actions/github-script v6 composite
  • peter-evans/create-or-update-comment v2 composite
  • peter-evans/find-comment v2 composite
.github/workflows/pr_benchmarks.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • actions/upload-artifact v3 composite
.github/workflows/scorecards.yml actions
  • actions/checkout a12a3943b4bdde767164f792f33f40b04645d846 composite
  • actions/upload-artifact 6673cd052c4cd6fcf4b4e6e60ea986c889389535 composite
  • github/codeql-action/upload-sarif 5f532563584d71fdef14ee64d17bafb34f751ce5 composite
  • ossf/scorecard-action 99c53751e09b9529366343771cc321ec74e9bd3d composite
.github/workflows/test_backends.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
pyproject.toml pypi