CVXPY is a Python-embedded modeling language for convex optimization problems.

Overview

CVXPY

Build Status PyPI - downloads Conda - downloads

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

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:

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 ECOS, 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.6
  • OSQP >= 0.4.1
  • ECOS >= 2
  • SCS >= 1.1.6
  • NumPy >= 1.15
  • SciPy >= 1.1.0

For detailed instructions, see the installation guide.

Getting started

To get started with CVXPY, check out the following:

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:

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, and Bartolomeo Stellato, 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, Philipp Schiele, Michael Sommerauer, Jaehyun Park, Enzo Busseti, AJ Friend, Judson Wilson, and Chris Dembia.

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.

Comments
  • Unknown

    Unknown "TypeError: invalid index arguments" when trying to solve?

    I am running anaconda-python2.7 on windows 8. I have installed cvxopt, ecos, cvxpy, numpy, scipy, etc. When trying to setup a simple copy/paste of a problem I was solving in matlab cvx, I get the following error which I dont think has to do with my code. Previously I was using mosek as my cvx solver in matlab.

    Any help would be great! Thanks!

    relevant code:

    import numpy as np
    import cvxpy as cp
    
    def myfunc():
        ...
        # construct problem
        N = 300
        mysum = 0
        L = cp.Variable(dimension, K)
        for itr in np.arange(N):
            mysum = mysum + helper(L, A, J, Y, M)
        objective = cp.Minimize(mysum)
    
        # solve problem
        p = cp.Problem(objective)
        val = p.solve()
        ...
    def helper(currL, currA, currJ, Y, M):
        # note in cvxpy, the * IS matrix multiplication
        result = cp.norm(Y-M*(currL*currA)) + cp.norm(currL*currA, p=1) \
            - cp.log_det(currL*currJ)
        return result
    

    resulting error

    TypeError                                 Traceback (most recent call last)
    <ipython-input-16-48b95775314a> in <module>()
    ----> 1 myfunc()
    
    <ipython-input-15-c27775a2189c> in myfunc()
         59     # solve problem
         60     p = cp.Problem(objective)
    ---> 61     val = p.solve()
    
    C:\Anaconda\lib\site-packages\cvxpy-0.1-py2.7.egg\cvxpy\problems\problem.pyc in solve(self, *args, **kwargs)
        188             return func(self, *args, **kwargs)
        189         else:
    --> 190             return self._solve(*args, **kwargs)
        191 
        192     @classmethod
    
    C:\Anaconda\lib\site-packages\cvxpy-0.1-py2.7.egg\cvxpy\problems\problem.pyc in _solve(self, solver, ignore_dcp, verbose)
        242             result = self._cvxopt_solve(objective, constr_map, dims,
        243                                         sorted_vars, var_offsets, x_length,
    --> 244                                         verbose)
        245         else: # If possible, target ECOS.
        246             result = self._ecos_solve(objective, constr_map, dims,
    
    C:\Anaconda\lib\site-packages\cvxpy-0.1-py2.7.egg\cvxpy\problems\problem.pyc in _cvxopt_solve(self, objective, constr_map, dims, sorted_vars, var_offsets, x_length, verbose)
        371             kktsolver = get_kktsolver(G, dims, A, F)
        372             results = cvxopt.solvers.cpl(c.T, F, G, h, A=A, b=b,
    --> 373                                          dims=dims, kktsolver=kktsolver)
        374         else:
        375             # Get custom kktsolver.
    
    C:\Anaconda\lib\site-packages\cvxopt\cvxprog.pyc in cpl(c, F, G, h, dims, A, b, kktsolver, xnewcopy, xdot, xaxpy, xscal, ynewcopy, ydot, yaxpy, yscal)
        568     ind = mnl + dims['l']
        569     for m in dims['q']:
    --> 570         z[ind] = 1.0
        571         s[ind] = 1.0
        572         ind += m
    
    TypeError: invalid index arguments
    
    opened by diego898 39
  • Quadratic forms cause ECOS error

    Quadratic forms cause ECOS error

    Doing the following:

    import cvxpy as cp import numpy as np x=cp.Variable(2,1) z=np.ones([2,1]) p = cp.Problem(cp.Minimize((cp.quad_form(x-z,np.eye(2))))) p.solve()

    Leads to an error "dims['q'] ought to be a list of positive integers" in ecos.py

    even changing it to

    p = cp.Problem(cp.Minimize((cp.norm( np.eye(2)*x-z ))))

    gives the same result

    opened by akatvz 38
  • cvxpy dependency fails to compile - no wheels available

    cvxpy dependency fails to compile - no wheels available

    Hi @SteveDiamond and CVXPY developers,

    Our Travis bots (DIPY) have different issues with cvxpy after your last release. We had no issues before.

    As you can see here, building wheel for osqp is failing. We got this problem on many bots as you can see here

    Any ideas?

    opened by skoudoro 33
  • cvxpy fails to install on Apple Silicon under Rosetta2 Homebrew Python

    cvxpy fails to install on Apple Silicon under Rosetta2 Homebrew Python

    Describe the bug A clear and concise description of what the bug is.

    Python 3.9.0_5 installs fine and so do most pypi packages as recommended for Homebrew 2.6.0 using Rosetta2.

    Python % arch -x86_64 pip3 install cvxpy
    Collecting cvxpy
      Using cached cvxpy-1.1.7.tar.gz (1.0 MB)
      Installing build dependencies ... done
      Getting requirements to build wheel ... error
      ERROR: Command errored out with exit status 1:
       command: /usr/local/opt/[email protected]/bin/python3.9 /usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /var/folders/sj/0mpllhrn5dgbk_sjm6l34jl40000gn/T/tmpwb8n3knm
           cwd: /private/var/folders/sj/0mpllhrn5dgbk_sjm6l34jl40000gn/T/pip-install-7edffu8y/cvxpy_b036aee14ee549eb9ea539d7d269f653
      Complete output (22 lines):
      Traceback (most recent call last):
        File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
          main()
        File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 114, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/private/var/folders/sj/0mpllhrn5dgbk_sjm6l34jl40000gn/T/pip-build-env-dcf2qxbq/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 149, in get_requires_for_build_wheel
          return self._get_build_requires(
        File "/private/var/folders/sj/0mpllhrn5dgbk_sjm6l34jl40000gn/T/pip-build-env-dcf2qxbq/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 130, in _get_build_requires
          self.run_setup()
        File "/private/var/folders/sj/0mpllhrn5dgbk_sjm6l34jl40000gn/T/pip-build-env-dcf2qxbq/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 253, in run_setup
          super(_BuildMetaLegacyBackend,
        File "/private/var/folders/sj/0mpllhrn5dgbk_sjm6l34jl40000gn/T/pip-build-env-dcf2qxbq/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 145, in run_setup
          exec(compile(code, __file__, 'exec'), locals())
        File "setup.py", line 39, in <module>
          python_target = distutils.version.LooseVersion(
        File "/usr/local/Cellar/[email protected]/3.9.0_5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/version.py", line 306, in __init__
          self.parse(vstring)
        File "/usr/local/Cellar/[email protected]/3.9.0_5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/version.py", line 314, in parse
          components = [x for x in self.component_re.split(vstring)
      TypeError: expected string or bytes-like object
      ----------------------------------------
    ERROR: Command errored out with exit status 1: /usr/local/opt/[email protected]/bin/python3.9 /usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /var/folders/sj/0mpllhrn5dgbk_sjm6l34jl40000gn/T/tmpwb8n3knm Check the logs for full command output.
    
    

    To Reproduce A minimal code example that reproduces the bug or unexpected behavior.

    See above.

    Expected behavior A clear and concise description of what you expected to happen.

    Normal pip3 install under Rosetta2

    Output If applicable, include program output. If reporting a program crash, please include the entire stack trace.

    See above

    Version

    • OS: Mac Big Sur 11.0.1
    • CVXPY Version: 1.1.17
    • Apple Mac-mini. 2020.

    Additional context Add any other context about the problem here.

    Using Rosetta 2 (arch -x86_64), cvxopt, scs and ecos install and run fine. So does Jupyter notebook.

    https://brew.sh/2020/12/01/homebrew-2.6.0/

    work-around identified 
    opened by sunilshah 31
  • cvxcore limits nnz of constraint matrix to 2^32

    cvxcore limits nnz of constraint matrix to 2^32

    Describe the bug Hi everyone. First of all, thank you all for the great tool you have built. I am facing a problem trying to run a fairly large optimization problem in my opinion. You can see the code below. The variable b size is 500 x 96. What I am trying to do is to match a sum of timeseries profiles (351236 x 15 min timesteps) with a bigger profile by minimizing their difference. With the same formulation and a much smaller problem (672 timesteps and a b variable of the size 10 x 5) the problem is solved in under 2 seconds without a problem. But when I am running it for the full scale problem I get the error you see below.

    I am running this on Jupyter Lab and python 3.7.4. The python installation is done with conda.

    To Reproduce

    X_opt = cp.Constant(np.asarray(X.iloc[:,:500])) # the array size is (35136,500) K_opt = cp.Constant(np.asarray(K.YearlyDemand)) # the vector size is 96 b = cp.Variable((500,96),boolean = True, value = np.zeros((500,96))) Y_opt = cp.Constant(np.asarray(y)) # the vector size is 35136

    constraints = []

    constraints.append( cp.sum(b, axis = 0) == 1 ) # the sum of the elements of every column of b must be equal to 1 constraints.append( cp.sum(b, axis = 1) <= 1 ) # the sum of the elements of every row of b must be smaller or equal to 1

    objective = cp.Minimize(cp.sum(cp.abs(Y_opt-cp.sum((cp.diag(K_opt)*(([email protected]).T)).T, axis = 1))))

    prob = cp.Problem(objective, constraints)

    prob.solve(solver = cp.GLPK_MI, verbose = True)

    Expected behavior I would expect the problem to solve as with the much smaller problem. But when I run this one, RAM usage explodes up to 100 GB (about 99% of the available RAM on the server). After a while the RAM usage goes down and then a periodical swinging begins (RAM goes up and down from 50% to 100% every few minutes). From the error and after a lot of googling my suspicion is that the problem is too big for the memory and that at some point data is getting broken down to smaller pieces. I do not think it reaches to the point, where the solver does its work. I tried to optimize the code by vectorizing everything (current version) and trying not to have loops etc. in the formulation. But this did not change anything. Do you guys have any clue if this is a bug or a limitation? Or do you maybe have an idea on how to solve this?

    Output

    ValueError Traceback (most recent call last) in

    D:\Anaconda3\envs\py37DuAL\lib\site-packages\cvxpy\problems\problem.py in solve(self, *args, **kwargs) 287 else: 288 solve_func = Problem._solve --> 289 return solve_func(self, *args, **kwargs) 290 291 @classmethod

    D:\Anaconda3\envs\py37DuAL\lib\site-packages\cvxpy\problems\problem.py in _solve(self, solver, warm_start, verbose, parallel, gp, qcp, **kwargs) 567 self._construct_chains(solver=solver, gp=gp) 568 data, solving_inverse_data = self._solving_chain.apply( --> 569 self._intermediate_problem) 570 solution = self._solving_chain.solve_via_data( 571 self, data, warm_start, verbose, kwargs)

    D:\Anaconda3\envs\py37DuAL\lib\site-packages\cvxpy\reductions\chain.py in apply(self, problem) 63 inverse_data = [] 64 for r in self.reductions: ---> 65 problem, inv = r.apply(problem) 66 inverse_data.append(inv) 67 return problem, inverse_data

    D:\Anaconda3\envs\py37DuAL\lib\site-packages\cvxpy\reductions\matrix_stuffing.py in apply(self, problem) 98 # Batch expressions together, then split apart. 99 expr_list = [arg for c in cons for arg in c.args] --> 100 Afull, bfull = extractor.affine(expr_list) 101 if 0 not in Afull.shape and 0 not in bfull.shape: 102 Afull = cvxtypes.constant()(Afull)

    D:\Anaconda3\envs\py37DuAL\lib\site-packages\cvxpy\utilities\coeff_extractor.py in affine(self, expr) 76 size = sum([e.size for e in expr_list]) 77 op_list = [e.canonical_form[0] for e in expr_list] ---> 78 V, I, J, b = canonInterface.get_problem_matrix(op_list, self.id_map) 79 A = sp.csr_matrix((V, (I, J)), shape=(size, self.N)) 80 return A, b.flatten()

    D:\Anaconda3\envs\py37DuAL\lib\site-packages\cvxpy\cvxcore\python\canonInterface.py in get_problem_matrix(linOps, id_to_col, constr_offsets) 65 66 # Unpacking ---> 67 V = problemData.getV(len(problemData.V)) 68 I = problemData.getI(len(problemData.I)) 69 J = problemData.getJ(len(problemData.J))

    D:\Anaconda3\envs\py37DuAL\lib\site-packages\cvxpy\cvxcore\python\cvxcore.py in getV(self, values) 320 321 def getV(self, values): --> 322 return _cvxcore.ProblemData_getV(self, values) 323 324 def getI(self, values):

    ValueError: negative dimensions are not allowed

    Version

    • OS: Windows Server 2012 R2
    • CVXPY Version: 1.0.25

    Additional context Add any other context about the problem here.

    opened by aselviar 31
  • Adds error for mixing NumPy and CVXPY

    Adds error for mixing NumPy and CVXPY

    Following up on #1647

    This code is supposed to not raise an error on anything that used to succeed (which was just the np.hstack/np.vstack equivalents I believe); however, by adding the __array_function__ method NumPy is now assuming we can handle everything and when we say we can't (i.e. we return NotImplemented) it chooses to errors instead of creating an array of objects as it used to. The error message has changed on a number of things to say that we have a TypeError instead of an AttributeError.

    If breaking code that constructs arrays with np.hstack and np.vstack is not acceptable, (np.array will still work though) then we can probably just eliminate the __array_function__ implementation, but I don't see any easy way to generate the warning while preserving old behavior unless we want to do AutoDiff-style manual implementation of each thing we want to keep working.

    opened by PTNobel 30
  • The c-extension module _multiarray_umath is new to numpy 1.16.0

    The c-extension module _multiarray_umath is new to numpy 1.16.0

    Describe the bug The doc specified that it depends on numpy>=1.15, but it not true.

    To Reproduce I have installed numpy==1.15.2, and then I installed the latest version of CVXPY(1.0.28), it will goes wrong when importing the library.

    Expected behavior It should update the requirements.

    Version

    • OS: Linux
    • CVXPY Version: v1.0.28 or lastest version

    Attachment Ref: https://numpy.org/devdocs/release/1.16.0-notes.html#umath-and-multiarray-c-extension-modules-merged-into-a-single-module 1

    opened by ringyear 30
  • Stable release of 1.1.0

    Stable release of 1.1.0

    This is a tracking issue for making 1.1.0 stable. We'll have at least one more prerelease, 1.1.0a2, before we get there.

    Below is an incomplete outline of the release notes we might publish alongside the stable release.

    New features

    • Disciplined parametrized programming (for cone programs)
    • Differentiation through cone programs (specifically, those solved by SCS)

    Enhancements

    • Allow use of the Python builtin sum function in DGP
    • Allow use of cp.max, cp.min in DQCP (in addition to cp.maximum, cp.minimum)
    • New atoms: support function

    Bug fixes

    • Dual variable recovery
    • Detection of monotone functions for DQCP

    Breaking changes

    • Incompatible with Python 2
    • Removed solvers: SuperSCS

    Known issues

    • Problems with many parameters can take a long time to compile
    opened by akshayka 29
  • simplify and update conda recipe

    simplify and update conda recipe

    Updated to use the Anaconda 5.0 compiler tools.

    I've also taken the liberty to remove the solvers as conda-specific dependencies. I would really like to encourage you to adopt this. For one thing, because the free version of ECOS is GPLv3, you're effectively preventing anyone who is GPL-averse from using cvxpy through conda. But more fundamentally, it reduces the install requirements for people who know exactly which solver they want.

    To play devil's advocate, this may confuse users who do not appreciate that at least one solver must be present. A remedy here is to update the documentation but also to print an informative error message when the solver resolution is attempted. I can add that code if you like.

    While Anaconda isn't yet putting cvxpy into the defaults channel, I am actually building it for a couple of customers, and this is the recipe (or a slight modification of it) is the one that I will be using.

    opened by mcg1969 27
  • Add support for CPLEX

    Add support for CPLEX

    With this commit a new legacy CPLEX solver has been added that supports LP, QP, SOCP, and MIP. This is exposed via a new 1.0 style solver under cvxpy/reductions/solvers/conic_solvers. Minor changes have been made to the existing CPLEX solver under cvxpy/reductions/solvers/qp_solvers for consistency. As expected, the solver output will be hidden by default, but can be shown by setting the verbose keyword argument to True. The warm_start solver option is supported for linear constraints. There are two CPLEX-specific solver options which are supported: 1) cplex_params is a keyword argument that accepts a dictionary of parameter names (as used in the CPLEX Python API) and parameter values; 2) cplex_filename takes a file path which will be used to export the model to a given file format (e.g., SAV, LP, MPS) before solving.

    For example, the following snippet will set the solver to CPLEX, display the engine log, set a CPLEX parameter, and export the model to LP format:

    >>> # Set CPXPARAM_Benders_Strategy (1501) to FULL (3)
    ... cpx_params = {"benders.strategy": 3}
    >>> prob.solve(solver=cvx.CPLEX, verbose=True,
                   cplex_params=cpx_params,
                   cplex_filename="example.lp")
    
    opened by rkersh 27
  • Python 3 support for Anaconda installation on Windows

    Python 3 support for Anaconda installation on Windows

    Currently it is not possible to build a cvxpy conda package for Python 3 on Windows. The issue is that conda cannot find any version of SCS built for Python 3 on Windows. I find this odd, since I made some here: https://anaconda.org/cvxgrp/scs/files But for whatever reason they're not getting picked up during conda build.

    help wanted 
    opened by SteveDiamond 27
  • DCP check fails on a positive definite quadratic form (ARPACK convergence failure)

    DCP check fails on a positive definite quadratic form (ARPACK convergence failure)

    Describe the bug

    I did solve two equivalent optimisation problems using cvxpy with default solver, cvxopt or mosek and I observed each time the same pattern. The two problems are equivalent in the following sense, the second one corresponds to the first one with a simple change of variable. The second problem is quickly solved, but the first one either fails or takes a long time to run. When both succeed, solutions match.

    To Reproduce The following python code reproduces what I got :

    import cvxpy as cp
    import numpy as np
    np.set_printoptions(precision=2)
    np.set_printoptions(linewidth=200)
    
    import matplotlib.pyplot as plt
    
    print(f"cvxpy: {cp.__version__}")
    print(f"numpy: {np.__version__}")
    
    nb_ineq = 10
    nb_var = 200
    
    np.random.seed(1)
    
    P = np.random.randn(nb_var, nb_var)
    P = P.T @ P
    
    U = np.linalg.cholesky(P).T
    U_inv = np.linalg.inv(U)
    
    a = np.random.randn(nb_var)
    G = np.random.uniform(low=-10, high=10, size=nb_ineq*nb_var).reshape((nb_ineq, nb_var))
    h = np.random.uniform(low=1, high=10, size=nb_ineq)
    
    ## initial problem
    x = cp.Variable(nb_var)
    prob = cp.Problem(cp.Maximize([email protected] - (1/2)*cp.quad_form(x, P)), [G @ x <= h])
    prob.solve()
    x_sol = x.value
    
    ## transformed problem
    y = cp.Variable(nb_var)
    prob_tr = cp.Problem(cp.Maximize((a.T @ U_inv)@y - (1/2)*cp.quad_form(y, np.eye(nb_var))), 
                      [(G @ U_inv) @ y <= h])
    prob_tr.solve()
    x_tr_sol = U_inv @ y.value
    

    The run time for the first problem can be several orders of magnitude larger than the run time for the second one. Most of the time with large values for nb_var, the first problem will fail with error ending like this `ArpackNoConvergence: ARPACK error -1: No convergence (2001 iterations, 0/1 eigenvectors converged)

    Expected behavior I would expect both problem to converge and use approximately the same time. The problem is feasible here since $h\geq0$.

    Output If applicable, include program output. If reporting a program crash, please include the entire stack trace.

    Version

    • OS: Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64
    • CVXPY Version: 1.2.3

    I have run the same code on a linux box with same version of cvxpy, and notice the same problem.

    opened by jomoussafir 7
  • Add visual feature

    Add visual feature

    For programmers who use the CVXPY library, and for the developers of the library we want to add visuals to the optimization problems that found in the CVXPY library. Our idea is to add a feature as known as visual() function , the function will show the problem by tree diagrams like this example: עינבמעצבנת1

    עינבהחרק2

    opened by nivmoti 1
  • "cloglog" DCP atom

    Requested feature:
    adding a cvxpy DCP atom for the (vectorized) function f(x) = log(1-exp(-exp(x)))

    Rationale:
    log(1 + exp(x)) is a (non-syntactically) convex function, which is useful for the computation of the (log likelihood) of a logistic GLM model, so the cvxpy.logistic(x) (vectorized) atom was created. Likewise, f(x) = log(1-exp(-exp(x))) is a (non-syntactically) cocave function, which is useful for the computation of the (log likelihood) of a "cloglog" GLM model.
    Specifically, if eta is the linear predictor, r is a rate, r = exp(eta), and the probability p of an event after an exposure of duration t obeys 1-p = exp(-r*t), then log(p) is expressible by this function.
    I therefore suggest to add a cvxpy DCP atom for this (vectorized) function f(x).

    Note:
    The naming of this function should receive some consideration.
    The cvxpy.logistic function is not the function which is usually denoted "logistic".
    The function I propose is the log of the inverse of the "cloglog" function, usually defined as cloglog(p) = log(-log(1-p)) (see e.g. here).

    opened by Ehud-Schreiber 1
  • Building wheel for cvxpy did not run successfully during installation

    Building wheel for cvxpy did not run successfully during installation

    Using the pip install method in the command prompt in Windows 11, I get an error while pip is trying to build the wheels for cvxpy.

    To Reproduce python -m pip install cvxpy

    Expected behavior cvxpy should be installed with no issues.

    Output Full Output: cvxpy pip install error output.txt Abbreviated Output:

    Building wheels for collected packages: cvxpy Building wheel for cvxpy (pyproject.toml) ... error error: subprocess-exited-with-error

    × Building wheel for cvxpy (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [407 lines of output]

    ...

      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -Icvxpy/cvxcore/src/ -Icvxpy/cvxcore/python/ -Icvxpy/cvxcore/include/ -IC:\Users\emily\AppData\Local\Programs\Python\Python311\include -IC:\Users\emily\AppData\Local\Programs\Python\Python311\Include -IC:\Users\emily\AppData\Local\Temp\pip-build-env-jy51ojh_\overlay\Lib\site-packages\numpy\core\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" /EHsc /Tpcvxpy/cvxcore/python/cvxcore_wrap.cxx /Fobuild\temp.win-amd64-cpython-311\Release\cvxpy/cvxcore/python/cvxcore_wrap.obj -O3 -std=c++11 -Wall -pedantic "" ""
      cl : Command line warning D9002 : ignoring unknown option '-O3'
      cl : Command line warning D9002 : ignoring unknown option '-std=c++11'
      cl : Command line warning D9002 : ignoring unknown option '-pedantic'
      cl : Command line warning D9024 : unrecognized source file type '', object file assumed
      cl : Command line warning D9027 : source file '' ignored
      cl : Command line warning D9024 : unrecognized source file type '', object file assumed
      cl : Command line warning D9027 : source file '' ignored
      cvxcore_wrap.cxx
      C:\Users\emily\AppData\Local\Programs\Python\Python311\include\pyconfig.h(59): fatal error C1083: Cannot open include file: 'io.h': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]
    

    note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for cvxpy Failed to build cvxpy ERROR: Could not build wheels for cvxpy, which is required to install pyproject.toml-based projects

    Version

    • OS: Windows 11
    • CVXPY Version: 1.2

    cvxpy pip install error output.txt

    opened by emilyziech 1
  • set Parameter bounds for better DCP rules engine

    set Parameter bounds for better DCP rules engine

    Is your feature request related to a problem? Please describe.

    I have a model with a parameter q between [0,1] that multiplies concave/affine expressions in a >= constraint (q * x + (1-q)*minimum(x,0) >=0). Yet as the parameter can only be defined as non negative [0,+inf], I get the exception Problem does not follow DCP rules..

    I need to define the complementary non negative parameter one_minus_q and write the constraint as q * x + one_minus_q*minimum(x,0) >=0 to make it work.

    It would be nice to be able to define a Parameter with its lower/upper bounds so that the DCP rule engine can work properly,e.g:

    q = cp.Parameter(bounds=[0,1])
    

    Simple example

    import cvxpy as cp
    
    I = 2
    
    # parameters
    q = cp.Parameter(nonneg=True)
    one_minus_q = cp.Parameter(nonneg=True)
    b = cp.Parameter(I)
    
    # variables
    x = cp.Variable()
    y = cp.Variable(I)
    
    q.value = 0.3
    one_minus_q.value = 1 - q.value
    b.value = [10, 3]
    problem = cp.Problem(
        cp.Maximize(x),
        [
            # this constraint does not work
            # cp.sum(q * y+ cp.minimum(y, 0) * (1 - q)) >= 0,
            # one must rewrite it as
            cp.sum(q * y + cp.minimum(y, 0) * one_minus_q) >= 0,
            y == 20 - x - b,
        ],
    )
    print(problem.solve())
    
    
    opened by sdementen 1
  • reduced cost of variables / slack in constraints

    reduced cost of variables / slack in constraints

    Is there a way to get the reduced cost of the variables (my problem is an LP) ? and also the slack of each constraint ? I guess I am missing the obvious ...

    opened by sdementen 0
Releases(v1.3.0)
  • v1.3.0(Jan 4, 2023)

    CVXPY 1.3

    This release marks our first minor release since the introduction of semantic versioning in March 2022. It comes packed with many new features, bug fixes, and performance improvements. This version of CVXPY supports Python 3.7 through 3.11, and is our first release that supports Python 3.11. While working on the next release, we continue to officially support CVXPY 1.2 and 1.3, and will backport important bug fixes to 1.1, if feasible.

    New features

    • New atoms:
      • dotsort
      • tr_inv
      • von_neumann_entr
      • perspective
    • Support for native quadratic forms (x.T @ P @ x)
    • New solver interfaces: COPT, SDPA, Clarabel, proxqp
    • A new SciPy-based backend
    • New constraints:
      • FiniteSet
      • RelEntrConeQuad
      • OpRelEntrConeQuad
    • ... and many more!

    Other big developments

    • The new OpRelEntrConeQuad constraint class is the first major piece of our effort to improve support for quantum information modeling (GSOC project)
    • Continuous performance benchmarking (GSOC project)

    API changes

    Moving forward, the public API of CVXPY is considered to be everything that is importable directly from the cvxpy namespace. We plan to introduce a cvxpy.experimental namespace for features in development where the API has not yet been fixed. It is explicitly not a part of our API whether atoms are implemented by functions or classes, e.g. we do not consider replacing cvxpy.power, which is currently a class, with a function to be a breaking change or replacing cp.quad_form which is a function to become a class to be a breaking change. Code of the form cvxpy.power(a, b) is guaranteed to remain working.

    Community

    We were thrilled to see the CVXPY community grow since our last release. In GitHub issues and the increasingly utilized GitHub discussions, we saw a lot of great reports and questions. Reaching almost 1000 members, the CVXPY Discord has become a great place to ask questions and get quick help. It was great to meet some of you at SciPy 2022 and ICCOPT 2022.

    Planned projects

    A major upcoming project is an overhaul of the web documentation, making it more modern, structured, and interactive. For this, we received a NumFOCUS Small Development Grant and are currently looking for a web developer to help us with the implementation. Email us at [email protected] if interested.

    Contributors

    This release would not have been possible without the contributions of many CVXPY users and developers. Across 30 contributors and 95 PRs, we would like to thank the following people for their contributions to this release (in alphabetical order):

    • @aryamanjeendgar | #1740, #1789, #1833, #1875, #1899
    • @BehrouzSohrabi | #1966
    • @Brown2345 | #1754
    • @chrisyeh96 | #1814, #1861, #1862
    • @dcajasn | #1897
    • @ericlux | #1869, #1867
    • @fabinsch | #1882, #1894
    • @goulart-paul | #1888
    • @h-vetinari | conda-forge PR #75
    • @imcjp | #1822
    • @JiaxinWang-thu | #1720
    • @jlchen0 | #1986
    • @joycebrum | #1892, #1927
    • @KerimovEmil | #1871
    • @merraksh | #1935
    • @Michael-123123 | #1793
    • @mkoeppe | #1707, #1705, #1719, #1727
    • @mlubin | #1859, #1872
    • @parthb83 | #1768, #1810, #1798
    • @phschiele | #1748, #1783, #1725, #1792, #1804, #1803, #1838, #1839, #1846, #1851, #1874, #1852, #1887, #1893, #1896, #1922, #1931, #1840, #1933, #1937, #1936, #1929, #1979
    • @piiq | #1951
    • @r-barnes | #1693
    • @rileyjmurray | #1733, #1736, #1738, #1866, #1977, #1976, #1978, #1984, #1987
    • @rluce | #1962
    • @roberthuisman | #1854
    • @SteveDiamond | #1689, #1757, #1761, #1794, #1802, #1807, #1796, #1818, #1820, #1829, #1835, #1844, #1856, #1880, #1885, #1886, #1877, #1898, #1909
    • @tasseff | #1830
    • @usamamuneeb | #1769
    • @wujianjack | #1836
    • @yasirroni | #1744, #1745, #1756

    Special thanks to @michaels0m for numerous discussions about the new backend.

    Source code(tar.gz)
    Source code(zip)
    cvxpy-1.3.0-cp310-cp310-macosx_10_9_universal2.whl(1.10 MB)
    cvxpy-1.3.0-cp310-cp310-macosx_10_9_x86_64.whl(906.68 KB)
    cvxpy-1.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl(3.77 MB)
    cvxpy-1.3.0-cp310-cp310-win_amd64.whl(864.40 KB)
    cvxpy-1.3.0-cp311-cp311-macosx_10_9_universal2.whl(1.10 MB)
    cvxpy-1.3.0-cp311-cp311-macosx_10_9_x86_64.whl(906.72 KB)
    cvxpy-1.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl(3.78 MB)
    cvxpy-1.3.0-cp311-cp311-win_amd64.whl(864.40 KB)
    cvxpy-1.3.0-cp37-cp37m-macosx_10_9_x86_64.whl(906.47 KB)
    cvxpy-1.3.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl(3.78 MB)
    cvxpy-1.3.0-cp37-cp37m-win_amd64.whl(864.42 KB)
    cvxpy-1.3.0-cp38-cp38-macosx_10_9_universal2.whl(1.10 MB)
    cvxpy-1.3.0-cp38-cp38-macosx_10_9_x86_64.whl(907.05 KB)
    cvxpy-1.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl(3.77 MB)
    cvxpy-1.3.0-cp38-cp38-win_amd64.whl(864.43 KB)
    cvxpy-1.3.0-cp39-cp39-macosx_10_9_universal2.whl(1.10 MB)
    cvxpy-1.3.0-cp39-cp39-macosx_10_9_x86_64.whl(906.68 KB)
    cvxpy-1.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl(3.77 MB)
    cvxpy-1.3.0-cp39-cp39-win_amd64.whl(864.38 KB)
    cvxpy-1.3.0.tar.gz(1.26 MB)
  • v1.2.3(Dec 27, 2022)

    This is a patch release for 1.2. The patch includes bug fixes from many contributors:

    @phschiele @h-vetinari SciPy 1.9 compatibility https://github.com/cvxpy/cvxpy/pull/1931

    @piiq Pin setuptools version https://github.com/cvxpy/cvxpy/pull/1951

    @rileyjmurray Make log_det robust https://github.com/cvxpy/cvxpy/pull/1866

    @rluce Adapt to API changes in gurobipy https://github.com/cvxpy/cvxpy/pull/1962

    @rileyjmurray Correct handling of KNOWN_SOLVER_ERRORS https://github.com/cvxpy/cvxpy/pull/1984

    @rileyjmurray Bugfixes related to complex2real https://github.com/cvxpy/cvxpy/pull/1978

    @rileyjmurray More bugfixes related to complex2real https://github.com/cvxpy/cvxpy/pull/1987

    Source code(tar.gz)
    Source code(zip)
  • v1.1.22(Dec 27, 2022)

    This is a patch release for 1.1. The patch includes bug fixes from many contributors:

    @phschiele @h-vetinari SciPy 1.9 compatibility https://github.com/cvxpy/cvxpy/pull/1931

    @piiq Pin setuptools version https://github.com/cvxpy/cvxpy/pull/1951

    @rileyjmurray Make log_det robust https://github.com/cvxpy/cvxpy/pull/1866

    @rluce Adapt to API changes in gurobipy https://github.com/cvxpy/cvxpy/pull/1962

    @rileyjmurray Bugfixes related to complex2real https://github.com/cvxpy/cvxpy/pull/1978

    @rileyjmurray More bugfixes related to complex2real https://github.com/cvxpy/cvxpy/pull/1987

    Source code(tar.gz)
    Source code(zip)
  • v1.2.2(Nov 4, 2022)

    This is a patch release for 1.2. The patch includes bug fixes from many contributors:

    @mlubin Fix time_limit_sec for GLOP and PDLP #1859

    @fabinsch Fix OSQP warm start https://github.com/cvxpy/cvxpy/pull/1882

    @SteveDiamond Switch SCS timings to seconds https://github.com/cvxpy/cvxpy/pull/1880

    @phschiele Allow deepcopy of constraints https://github.com/cvxpy/cvxpy/pull/1852

    @phschiele Fix linters https://github.com/cvxpy/cvxpy/pull/1851

    @rileyjmurray @SteveDiamond @phschiele Fix SOC residual https://github.com/cvxpy/cvxpy/pull/1844

    @SteveDiamond Fix bug with diff https://github.com/cvxpy/cvxpy/pull/1835

    @akshayka @SteveDiamond Fix DQCP issue with sign function https://github.com/cvxpy/cvxpy/pull/1829

    @SteveDiamond Minor test formatting fix https://github.com/cvxpy/cvxpy/pull/1886

    @SteveDiamond New SCIP interface https://github.com/cvxpy/cvxpy/pull/1898

    @phschiele Allow lists as shapes https://github.com/cvxpy/cvxpy/pull/1922

    @roberthuisman Fix gradient for multidimensional quad form https://github.com/cvxpy/cvxpy/pull/1854

    @KerimovEmil Add edge case handling for string inputs into norm https://github.com/cvxpy/cvxpy/pull/1871

    Source code(tar.gz)
    Source code(zip)
  • v1.1.21(Nov 4, 2022)

    This is a patch release for 1.1. The patch includes bug fixes from many contributors:

    @fabinsch Fix OSQP warm start https://github.com/cvxpy/cvxpy/pull/1882

    @SteveDiamond Switch SCS timings to seconds https://github.com/cvxpy/cvxpy/pull/1880

    @phschiele Allow deepcopy of constraints https://github.com/cvxpy/cvxpy/pull/1852

    @phschiele Fix linters https://github.com/cvxpy/cvxpy/pull/1851

    @rileyjmurray @SteveDiamond @phschiele Fix SOC residual https://github.com/cvxpy/cvxpy/pull/1844

    @SteveDiamond Fix bug with diff https://github.com/cvxpy/cvxpy/pull/1835

    @akshayka @SteveDiamond Fix DQCP issue with sign function https://github.com/cvxpy/cvxpy/pull/1829

    @SteveDiamond Minor test formatting fix https://github.com/cvxpy/cvxpy/pull/1886

    @SteveDiamond New SCIP interface https://github.com/cvxpy/cvxpy/pull/1898

    @phschiele Allow lists as shapes https://github.com/cvxpy/cvxpy/pull/1922

    @roberthuisman Fix gradient for multidimensional quad form https://github.com/cvxpy/cvxpy/pull/1854

    @KerimovEmil Add edge case handling for string inputs into norm https://github.com/cvxpy/cvxpy/pull/1871

    Source code(tar.gz)
    Source code(zip)
  • v1.2.1(May 16, 2022)

    CVXPY 1.2.1 is a patch release (i.e., a bugfix release) in the 1.2.X release series. Special thanks to @mkoeppe for his contribution!

    Changes since 1.2.0:

    • Web documentation updates (#1731).
    • More web doc updates (#1732).
    • Fix sign error with log_sum_exp (#1689).
    • Handle new CyLP statuses from https://github.com/coin-or/CyLP/pull/150 (#1707), from @mkoeppe.
    • Fix TypeError in GLOP and PDLP interfaces (#1736).
    • Update error message for mixed-integer problems (#1738).
    • Propagate SCIP interface bugfix from PR (#1739).
    Source code(tar.gz)
    Source code(zip)
  • v1.1.20(May 16, 2022)

    CVXPY 1.1.20 is a patch release (i.e., a bugfix release) in the 1.1.X release series. Special thanks to @mkoeppe for his contribution!

    Changes since 1.1.19:

    • Fix sign error with log_sum_exp (#1689).
    • Handle new CyLP statuses from https://github.com/coin-or/CyLP/pull/150 (#1707), from @mkoeppe.
    • Update error message for mixed-integer problems (#1738).
    • Propagate SCIP interface bugfix from PR (#1739).
    Source code(tar.gz)
    Source code(zip)
  • v1.2.0(Mar 10, 2022)

    CVXPY 1.2

    This release marks a big milestone in CVXPY's development. It's the first time we've incremented the minor version number since releasing CVXPY 1.1 in June 2020. Since then we've added many new features and improved CVXPY's efficiency in important ways. A summary of those changes -- including many which were released with little fanfare between CVXPY 1.1.1 and 1.1.18 -- can be found on cvxpy.org. Changes specific to CVXPY 1.2 include:

    • Four new and improved "atoms" for use in optimization modeling: xexp, partial_trace, partial_transpose, and kron. The latter three atoms significantly expand CVXPY's modeling capabilities for matrix representations of tensor products; they'll be especially useful for quantum information applications.
    • Two new interfaces to numerical solvers. CVXPY can now interface with Google OR Tools to call GLOP and PDLP.
    • Support for Python versions 3.7 to 3.10.

    We've also grown in ways that can't be seen from changes to source code alone. We've adopted open governance principles, become a NumFOCUS affiliated project, and -- starting this week -- we're adopting semantic versioning.

    Semantic versioning

    Our adoption of semantic versioning will fundamentally change the way we approach CVXPY's maintenance and development. The most observable change is that new features will only be released in major or minor releases, as opposed to patch releases. Since CVXPY receives new feature contributions on a regular basis, that means you can expect minor releases from us much more often: multiple times per year instead of once in two years. It also means we'll support multiple minor-release series at any given time. Right now we provide bugfix support for CVXPY 1.1 and 1.2. Once CVXPY 1.3 comes out later this year, we'll provide bugfix support for CVXPY 1.1, 1.2, and 1.3.

    While this approach creates more work for day-to-day maintenance, it has two major benefits:

    1. It gives us space to heavily refactor CVXPY's back-end for improved efficiency in the future. This will be important for CVXPY users who want to scale their convex optimization workflows to larger and more sophisticated problems.

    2. It makes it easier for us to publicly recognize and encourage CVXPY's many volunteer contributors. This is crucial for the long-term health of CVXPY as an open-source software project.

    Our adoption of semantic versioning is an ongoing process. Stay tuned for announcements on our Discord server, website, or Twitter for more information.

    Who made this possible?

    CVXPY 1.2.0 includes contributions from 15 people across more than 25 pull requests. In no particular order, those contributors are

    • @phschiele (PRs #1607, #1617, #1624, #1628)
    • @xinyueshen (PR #1660)
    • @allenlawrence94 (PR #1621)
    • @lochsh (PR #1677)
    • @PTNobel (PR #1648)
    • @Michael-git96 (PR #1684)
    • @chrisyeh96 (PR #1616)
    • @TimonKnigge (PRs #1637, #1646)
    • @dcajasn (PR #1640)
    • @parthb83 (PRs #1641, #1683)
    • @mlubin (PRs #1655, #1682)
    • @AtsushiSakai (PR #1665)
    • @h-vetinari (for conda-forge PR 68)
    • @SteveDiamond (PRs #1606, #1659, #1669)
    • @rileyjmurray (PRs #1598, #1643, #1670, #1688)

    Among those listed above, we would like to call special attention to @phschiele, @Michael-git96, and @dcajasn -- each of whom has made contributions to CVXPY prior to version 1.1.18. Those recurring contributions are instrumental to CVXPY's success.

    On behalf of the CVXPY project maintainers, Riley Murray CC: @akshayka @SteveDiamond, @bstellato

    Source code(tar.gz)
    Source code(zip)
    cvxpy-1.2.0-cp310-cp310-macosx_10_9_x86_64.whl(859.54 KB)
    cvxpy-1.2.0-cp310-cp310-manylinux_2_24_x86_64.whl(2.63 MB)
    cvxpy-1.2.0-cp310-cp310-win_amd64.whl(813.34 KB)
    cvxpy-1.2.0-cp37-cp37m-macosx_10_9_x86_64.whl(859.17 KB)
    cvxpy-1.2.0-cp37-cp37m-manylinux_2_24_x86_64.whl(2.64 MB)
    cvxpy-1.2.0-cp37-cp37m-win_amd64.whl(813.21 KB)
    cvxpy-1.2.0-cp38-cp38-macosx_10_9_x86_64.whl(859.95 KB)
    cvxpy-1.2.0-cp38-cp38-manylinux_2_24_x86_64.whl(2.63 MB)
    cvxpy-1.2.0-cp38-cp38-win_amd64.whl(813.36 KB)
    cvxpy-1.2.0-cp39-cp39-macosx_10_9_x86_64.whl(859.54 KB)
    cvxpy-1.2.0-cp39-cp39-manylinux_2_24_x86_64.whl(2.63 MB)
    cvxpy-1.2.0-cp39-cp39-win_amd64.whl(813.33 KB)
    cvxpy-1.2.0.tar.gz(1.22 MB)
  • v1.1.18(Dec 28, 2021)

    Changelog/bug fixes:

    • Use s.LOGGER instead of stdout in mosek. (#1476)
    • Prevent bad Xpress license from breaking cvxpy (#1526)
    • Fix handling of 2d arrays in PowCone3D (apply same fix to ExpCone)
    • Gershgorin circle theorem PSD/NSD checks (#1534)
    • Update Expression.curvature to include log-log curvature (#1539)
    • Specify tests paths (#1542)
    • User-facing "infeasible or unbounded" status (#1535)
    • Have complex2real properly handle absence of dual variables (#1551)
    • [CI] Adding Sonar (v2) (#1565)
    • Change logging in MOSEK (#1570)
    • Replace usage of eval() in processing cplex params (#1584)
    • Fix bugs in the example of Channel Capacity (#1582)
    • Add some types to Variable, Expression, and performance_utils (#1575)
    • Add deployment/testing with Python 3.10 (#1593)
    Source code(tar.gz)
    Source code(zip)
  • v1.1.17(Nov 3, 2021)

  • v1.1.16(Nov 3, 2021)

    Changelog:

    • Support for Gurobi Environments (#1445)
    • Validate constraints on problem creation (#1463)
    • Fix SCS requirement issue (Issue #1474) (#1481)
    • Fixes for DQCP (#1484)
    • [CI] Build cvxpy-base (Issue 1478) (#1485)
    • More types (#1389)
    • Sort imports (#1488)
    • Improved handling of solver import errors (#1498)
    • Add pre-commit config (#1507)
    • Improve solver inheritance (#1509)
    Source code(tar.gz)
    Source code(zip)
  • v1.1.15(Aug 13, 2021)

    Changelog

    • Update performance_utils.py (#1437)
    • Fix Constant.is_psd() and Constant.is_nsd() (#1456)
    • Fixed DIFFCP interface to handle ECOS
    • Use builtin types instead of deprecated numpy aliases (#1442)
    Source code(tar.gz)
    Source code(zip)
  • v1.1.14(Jul 24, 2021)

    • Update SCS status map to use status vals rather than string matching (#1441)
    • Added relative entropy atom (#1427)
    • Fix CVXOPT interface (#1427)
    • Add some aggressive compilation warning settings (#1432)
    • Eliminate some old/extraneous test files and scripts (#1434)
    • [CI] Only install Mosek if license is available (#1435)
    • Specify solvers in tests (#1430)
    • More Solvers for CI (#1417)
    • remove model update within soc constraint for loop (#1411)
    • Gurobi CI (#1413)
    • Adding dual variables for SciPy LP solver interfaces #1425 (#1426)
    • Add an interface to SciPy-accessible LP solvers - Issue: #1414 (#1416)
    • loggamma approximation (#1400)
    • Move Windows CI to GitHub Action v2 (#1398)
    • add py.typed file so that users of cvxpy get type info from the package (#1388)
    • Skip deploy step (#1396)
    Source code(tar.gz)
    Source code(zip)
  • v1.1.13(May 26, 2021)

    Key changes

    • Dropped Python 3.5 support (#1386)
    • Build Manylinux Wheels (#1378)

    Improvements

    • Add boolean type annotations (#1319)
    • Move Travis CI to GitHub Actions (#1368)
    • Annotations for warm_start, verbose, and shape (#1364)
    • use flexible numpy version in pyproject.toml (#1376)

    Bug fixes

    • Fixed bug with verbose=True that was causing exceptions.
    • Logistic atom - improved gradient calculation (#1359)
    • Fix edge case for vstack (#1339)
    Source code(tar.gz)
    Source code(zip)
  • v1.1.12(May 26, 2021)

    Improvements

    • Gurobi warm start (#1248)
    • param_dict and var_dict (#1279)
    • Implement handling of bool valued constraints (#1283)
    • Use lazy interpolation for logging (#1312)
    • Set prob.value to prob.objective.value (#1300)
    • populate solver_stats for ecos_bb, ecos & scs (#1323)

    Bug fixes

    • Gurobi: fix for when time limit is hit with no solution (#1270)
    • Gurobi: fix for when time limit is hit with no solution (QP case) (#1272)
    • Fix NonPos (#1277)
    • Switch to using safe default arguments (#1311)
    Source code(tar.gz)
    Source code(zip)
  • v1.1.11(Mar 5, 2021)

    CVXPY version 1.1.11 introduces better verbose logging, several performance improvements, and various bug fixes. One performance optimization, namely multi-threaded compilation with OpenMP, is experimental, and must be opted into (see below).

    Better verbose logging

    When solving problems with verbose=True, you will now see detailed logging that describes CVXPY's compilation of your problem, in addition to logs output by the underlying solver. This logging can be helpful when compiling large problems. (It is sometimes easy to forget that CVXPY is a compiler that interfaces your problems to low-level numerical solvers; CVXPY is not a solver.)

    Here's an example of the new output.

    =============================================================================== 
                                         CVXPY                                     
                                        v1.1.11                                   
    ===============================================================================
    (CVXPY) Feb 26 10:30:24 PM: Your problem has 20 variables, 2 constraints, and 0 parameters.
    (CVXPY) Feb 26 10:30:24 PM: It is compliant with the following grammars: DCP, DQCP
    (CVXPY) Feb 26 10:30:24 PM: (If you need to solve this problem multiple times, but with different data, consider using parameters.)
    (CVXPY) Feb 26 10:30:24 PM: CVXPY will first compile your problem; then, it will invoke a numerical solver to obtain a solution.
    -------------------------------------------------------------------------------
                                      Compilation                                   
    -------------------------------------------------------------------------------
    (CVXPY) Feb 26 10:30:24 PM: Compiling problem (target solver=OSQP).
    (CVXPY) Feb 26 10:30:24 PM: Reduction chain: CvxAttr2Constr -> Qp2SymbolicQp -> QpMatrixStuffing -> OSQP
    (CVXPY) Feb 26 10:30:24 PM: Applying reduction CvxAttr2Constr
    (CVXPY) Feb 26 10:30:24 PM: Applying reduction Qp2SymbolicQp
    (CVXPY) Feb 26 10:30:24 PM: Applying reduction QpMatrixStuffing                                                                          
    (CVXPY) Feb 26 10:30:24 PM: Applying reduction OSQP                                                                                      
    (CVXPY) Feb 26 10:30:24 PM: Finished problem compilation (took 5.444e-03 seconds).
    (CVXPY) Feb 26 10:30:24 PM: (Subsequent compilations of this problem, using the same arguments, should take less time.)
    -------------------------------------------------------------------------------
                                    Numerical solver                                
    -------------------------------------------------------------------------------
    (CVXPY) Feb 26 10:30:24 PM: Invoking solver OSQP to obtain a solution.
    -----------------------------------------------------------------
               OSQP v0.6.0  -  Operator Splitting QP Solver
                  (c) Bartolomeo Stellato,  Goran Banjac
            University of Oxford  -  Stanford University 2019
    -----------------------------------------------------------------
    problem:  variables n = 50, constraints m = 70
              nnz(P) + nnz(A) = 700
    settings: linear system solver = qdldl,
              eps_abs = 1.0e-05, eps_rel = 1.0e-05,
              eps_prim_inf = 1.0e-04, eps_dual_inf = 1.0e-04,
              rho = 1.00e-01 (adaptive),
              sigma = 1.00e-06, alpha = 1.60, max_iter = 10000
              check_termination: on (interval 25),
              scaling: on, scaled_termination: off
              warm start: on, polish: on, time_limit: off
    
    iter   objective    pri res    dua res    rho        time
       1   0.0000e+00   1.95e+00   6.37e+02   1.00e-01   1.61e-04s
     200   1.9831e+01   2.92e-05   5.58e-06   1.29e+00   7.50e-04s
    plsh   1.9831e+01   3.35e-16   8.89e-15   --------   8.37e-04s
    
    status:               solved
    solution polish:      successful
    number of iterations: 200
    optimal objective:    19.8313
    run time:             8.37e-04s
    optimal rho estimate: 4.33e+00
    
    -------------------------------------------------------------------------------
                                        Summary                                     
    -------------------------------------------------------------------------------
    (CVXPY) Feb 26 10:30:24 PM: Problem status: optimal
    (CVXPY) Feb 26 10:30:24 PM: Optimal value: 1.983e+01
    (CVXPY) Feb 26 10:30:24 PM: Compilation took 5.444e-03 seconds
    (CVXPY) Feb 26 10:30:24 PM: Solver (including time spent in interface) took 1.555e-03 seconds
    

    See #1251 for more context.

    Performance improvements

    We have made several optimizations to CVXPY's compilation process (#1255, #1259). These optimizations can sometimes yield modest to large reductions in the time CVXPY spends compiling your problem.

    CVXPY 1.1.11 also includes experimental multi-threaded compilation, which can yield dramatic speed-ups on problems with many expressions. To enable multi-threaded compilation, you'll need to have OpenMP installed and compile from source. For example, on Linux with GCC, use

    CFLAGS='-fopenmp' LDFLAGS='-lgomp' pip install cvxpy --no-binary cvxpy
    

    Control the number of threads used either by setting the OMP_NUM_THREADS environment variable, or by using the function cvxpy.set_num_threads. The latter takes precedence.

    Bug fixes

    • CVXPY no longer resets warning filters on loggers (#1240 by @rileyjmurray )
    • The diag atom's is_nonneg method now checks for PSD-ness (#1242 by @phschiele)
    • A fix to the Gurobi interface (#1246 by @bstellato)
    • Reshaping with order=C now works properly (#1264 by @akshayka )
    • The gradient of quad_form was fixed to handle complex inputs (#1261 by @SteveDiamond )
    Source code(tar.gz)
    Source code(zip)
  • v1.1.10(Feb 16, 2021)

    There were many changes between CVXPY versions 1.1.7 and 1.1.8. However, CVXPY 1.1.8 should not be used because of NumPy configuration issues and CVXPY 1.1.9 was quickly followed by a bugfix. Therefore CVXPY version 1.1.10 is the spiritual successor to 1.1.7. Here's an account of the merged PR's since 1.1.7:

    Features, infrastructure, and speed improvements.

    • @tommyod helped us switch from nose to pytest (see #1166).
    • @nrontsis created a mechanism by which you can write custom solver interfaces without affecting CVXPY source code (see #1172).
    • @merraksh improved the speed with which we can pass problems to XPRESS (see #1210).
    • @h-vetinari has put in a lot of work over at conda-forge/cvxpy-feedstock.
    • @rileyjmurray added support for 3D and ND power cone constraints (see #1211).
    • @ali-tny added a log_normcdf atom based on piecewise quadratic approximation (see #1224).
    • @phschiele improved a speed bottleneck for DPP problems with many parameters (see #1235).

    Bug-fixes:

    • Constructing OSQP problem data (#1162 by @akshayka)
    • Domains of Expression objects (#1181 by @RSchwan)
    • CVXOPT status handling and a new test case for all MILP solvers (#1199 by @b1a0).
    • @h-vetinari fixed a bug in one of our unittests (#1208).
    • Raise SolverErrors when appropriate in the affine2direct code path (#1227 by @rileyjmurray).
    • Account for when ECOS_BB is not installed (#1233 by @phschiele).
    • Pin NumPy versions in pyproject.toml for source installations via pip (#1234 by @akshayka).

    Documentation improvements:

    • @WillianFuks corrected a link in a helper function implementation note (#1200)
    • @lumbric added notes about ECOS_BB changes to the web docs (#1180)
    • @tomas789 cleaned up a docstring (#1167)
    Source code(tar.gz)
    Source code(zip)
  • v1.1.5(Aug 27, 2020)

  • v1.1.4(Aug 14, 2020)

  • v1.0.31(Apr 9, 2020)

  • v1.0.29(Apr 1, 2020)

  • v1.0.28(Feb 24, 2020)

    This release gives priority to conic solvers over QP solvers when solving LPs.

    ECOS, the default conic solver, solves QPs more reliably than the default QP solver (OSQP).

    1.0.27 was meant to add this functionality, but didn't due to a small bug.

    Source code(tar.gz)
    Source code(zip)
  • v1.0.27(Feb 24, 2020)

    This release gives priority to conic solvers over QP solvers when solving LPs.

    ECOS, the default conic solver, solves QPs more reliably than the default QP solver (OSQP).

    Source code(tar.gz)
    Source code(zip)
  • v1.0.26(Feb 21, 2020)

    This release includes a bug fix for DQCP.

    Fix detection of monotone real functions.

    Fixes a bug in DQCP analysis in analyzing monotone real functions; DQCP analysis previously did not check whether the argument of a scalar function was also scalar. This bug caused DQCP analysis to be too permissive, incorrectly labeling things as DQCP and causing the reduction to fail in surprising ways.

    As an extension, this change adds the vector atoms cp.max and cp.min to the DQCP atom library, letting users take the max or min of quasiconvex or quasiconcave expressions. Previously, only the elementwise cp.maximum and cp.minimum atoms were allowed.

    Source code(tar.gz)
    Source code(zip)
  • v1.1.0a2(Jan 6, 2020)

    New features:

    • Support function atom (PR #860)
    • Scalar product atom (PR #910)

    Bug fixes and enhancements:

    • Fix formatting of MOSEK cone programs with exponential cones (PR #862)
    • Allow warm-starting diffcp (PR #867)
    • Default to conic solvers for LPs (PR #871)
    • Restart SCS without AA when solution inaccurate (PR #876)
    • Fix bugs in detection of monotone real functions for DQCP (PR #909)
    • Fix bugs in conic dual variable recovery (PR #910)
    Source code(tar.gz)
    Source code(zip)
Time series changepoint detection

changepy Changepoint detection in time series in pure python Install pip install changepy Examples from changepy import pelt from cha

Rui Gil 92 Nov 08, 2022
Conducted ANOVA and Logistic regression analysis using matplot library to visualize the result.

Intro-to-Data-Science Conducted ANOVA and Logistic regression analysis. Project ANOVA The main aim of this project is to perform One-Way ANOVA analysi

Chris Yuan 1 Feb 06, 2022
ML Optimizers from scratch using JAX

Toy implementations of some popular ML optimizers using Python/JAX

Shreyansh Singh 38 Jul 29, 2022
Forecast dynamically at scale with this unique package. pip install scalecast

🌄 Scalecast: Dynamic Forecasting at Scale About This package uses a scaleable forecasting approach in Python with common scikit-learn and statsmodels

Michael Keith 158 Jan 03, 2023
A simple application that calculates the probability distribution of a normal distribution

probability-density-function General info An application that calculates the probability density and cumulative distribution of a normal distribution

1 Oct 25, 2022
Automated machine learning: Review of the state-of-the-art and opportunities for healthcare

Automated machine learning: Review of the state-of-the-art and opportunities for healthcare

42 Dec 23, 2022
Temporal Alignment Prediction for Supervised Representation Learning and Few-Shot Sequence Classification

Temporal Alignment Prediction for Supervised Representation Learning and Few-Shot Sequence Classification Introduction. This package includes the pyth

5 Dec 06, 2022
Transpile trained scikit-learn estimators to C, Java, JavaScript and others.

sklearn-porter Transpile trained scikit-learn estimators to C, Java, JavaScript and others. It's recommended for limited embedded systems and critical

Darius Morawiec 1.2k Jan 05, 2023
A collection of Machine Learning Models To Web Api which are built on open source technologies/frameworks like Django, Flask.

Author Ibrahim Koné From-Machine-Learning-Models-To-WebAPI A collection of Machine Learning Models To Web Api which are built on open source technolog

Ibrahim Koné 2 May 24, 2022
WAGMA-SGD is a decentralized asynchronous SGD for distributed deep learning training based on model averaging.

WAGMA-SGD is a decentralized asynchronous SGD based on wait-avoiding group model averaging. The synchronization is relaxed by making the collectives externally-triggerable, namely, a collective can b

Shigang Li 6 Jun 18, 2022
Generate music from midi files using BPE and markov model

Generate music from midi files using BPE and markov model

Aditya Khadilkar 37 Oct 24, 2022
LiuAlgoTrader is a scalable, multi-process ML-ready framework for effective algorithmic trading

LiuAlgoTrader is a scalable, multi-process ML-ready framework for effective algorithmic trading. The framework simplify development, testing, deployment, analysis and training algo trading strategies

Amichay Oren 458 Dec 24, 2022
Python Machine Learning Jupyter Notebooks (ML website)

Python Machine Learning Jupyter Notebooks (ML website) Dr. Tirthajyoti Sarkar, Fremont, California (Please feel free to connect on LinkedIn here) Also

Tirthajyoti Sarkar 2.6k Jan 03, 2023
Deepchecks is a Python package for comprehensively validating your machine learning models and data with minimal effort

Deepchecks is a Python package for comprehensively validating your machine learning models and data with minimal effort

2.3k Jan 04, 2023
scikit-learn: machine learning in Python

scikit-learn is a Python module for machine learning built on top of SciPy and is distributed under the 3-Clause BSD license. The project was started

neurodata 3 Dec 16, 2022
An open source framework that provides a simple, universal API for building distributed applications. Ray is packaged with RLlib, a scalable reinforcement learning library, and Tune, a scalable hyperparameter tuning library.

Ray provides a simple, universal API for building distributed applications. Ray is packaged with the following libraries for accelerating machine lear

23.3k Dec 31, 2022
flexible time-series processing & feature extraction

A corona statistics and information telegram bot.

PreDiCT.IDLab 206 Dec 28, 2022
Fundamentals of Machine Learning

Fundamentals-of-Machine-Learning This repository introduces the basics of machine learning algorithms for preprocessing, regression and classification

Happy N. Monday 3 Feb 15, 2022
Firebase + Cloudrun + Machine learning

A simple end to end consumer lending decision engine powered by Google Cloud Platform (firebase hosting and cloudrun)

Emmanuel Ogunwede 8 Aug 16, 2022
Simulate & classify transient absorption spectroscopy (TAS) spectral features for bulk semiconducting materials (Post-DFT)

PyTASER PyTASER is a Python (3.9+) library and set of command-line tools for classifying spectral features in bulk materials, post-DFT. The goal of th

Materials Design Group 4 Dec 27, 2022