CVXPY is a Python-embedded modeling language for convex optimization problems inspired by the MATLAB package CVX.
Questions tagged [cvxpy]
609 questions
1
vote
2 answers
Piecewise Linear Functions in CVXPY
I have a convex optimization problem with separable, convex, piecewise linear functions f_i(var_i) each defined by a list of points [(values, costs)] and a couple other terms that are also convex. I'm trying to figure out how two build those…

rhaskett
- 1,864
- 3
- 29
- 48
1
vote
1 answer
Failed building wheel for qdldl (when installing cvxpy)
Independent whether I install using pip or from source, whether I use python2 or python3 I can't install cvxpy. I've tried now over four hours and I still fail. The github pages of cvxpy or qdldl wouldn't give me any solution. I installed the…

Marc
- 117
- 1
- 6
1
vote
0 answers
cvxpy DCPError: Problem does not follow DCP rules
I am trying to create a modified implementation of fused lasso in cvxpy to solve an optimization problem. The following code gives me an error of:
DCPError: Problem does not follow DCP rules. Specifically:
The objective is not DCP. Its following…

nafizh
- 185
- 3
- 14
1
vote
0 answers
QP Receding Horizon Path Planning Problem
I am working on the following QP Receding Horizon Path Planning Problem:
Problem statement
At each time step, a point (simulating a robot) computes its Voronoi Cell (VC) with respect to the others, plans a path within the VC, then executes the first…

Pepe
- 11
- 1
1
vote
0 answers
Incorporate product of main and auxiliary variables in objective function
This is a follow-up question to a previous post.
The problem I'm trying to solve is to find the largest combination of cells at the intersection of company and category with an average above a certain threshold. Additionally, if I include 3…

matsuo_basho
- 2,833
- 8
- 26
- 47
1
vote
0 answers
Problem of installation of CVXPY on MS Windows
I am trying to install CVXPY on windows.
I had installed Anaconda.
I am following https://www.cvxpy.org/install/index.html 'conda' part
Steps I~III look fine. However, when doing conda install pytest and pytest cvxpy/tests error pops up
run in…

Denny
- 223
- 2
- 15
1
vote
1 answer
How to deal with the error when using Gurobi with cvxpy :Unable to retrieve attribute 'BarIterCount'
How to deal with the error when using Gurobi with cvxpy :AttributeError: Unable to retrieve attribute 'BarIterCount'.
I have an Integer programming problem, using cvxpy and set gurobi as a solver.
When the number of variables is small, the result is…

Allen Guo
- 11
- 2
1
vote
1 answer
How to construct a SOCP problem and solve using cvxpy and cvxpylayers
I'm trying to solve a SOCP problem using cvxpy and integrating it to cvxpylayers. I'm looking at this SOCP problem (problem 11) (here is the scihub link in case you can't access), and here is a snippet of the problem (note min (p-t) comes from an…

ben
- 159
- 1
- 4
- 15
1
vote
1 answer
In CVXPY, How to create an OR constraint like x == 1 OR x == 2?
In CVXPY, How to constract an 'OR' constraint like this ?
The constraint I am looking for is that x can be 1 or 2. The optimizer minimizes x and obtains the optimal x = 1.
For example, [x == 1 or x == 2] is invalid, and [x == 1, x == 2] means x == 1…

Tom
- 3,168
- 5
- 27
- 36
1
vote
1 answer
Intersection between two tetrahedra
I hope to be as clear as possible. I'm trying to implement a function that, given two tetrahedra, checks if they intersect with each other. I am working with python and the only library I am using is NumPy. To describe a tetrahedron I use its 4…

gmarco97
- 35
- 8
1
vote
1 answer
Does Julia's column-major order have any impact while calling CVXPY through PyCall?
I'm using CVXPY through Julia, a language where multidimentional arrays are stored in memory using column-major order. However CVXPY is written in Python and accepts Numpy style arrays (which are row-major by default) to be used as constants.
I want…

fire-bee
- 111
- 1
- 3
1
vote
1 answer
I'm unable to install the CVXPY package for Python 3.6 in a virtual environment
I am trying to install the CVXPY package on a virtual environment for Python 3.6, on Linux Ubuntu 16.04.
I started by creating a virtual environment:
python3.6 -m venv tutorial-env
I then followed the instructions here, and installed the following…

CompleteRegistration
- 23
- 1
- 6
1
vote
2 answers
How do I fix error installing Python package cvxpy
I'm using Windows 10 and Anaconda and trying to install the Python package 'cvxpy' using the command prompt. I keep getting the same error message. I tried installing the package using conda, re-installing Anaconda and trying checking/unchecking the…

cona
- 169
- 1
- 13
1
vote
2 answers
How to check if cvxpy's solve() is successful?
This my first time trying to use cvxpy. I have 2 very simple constrains:
x = cp.Variable((5, 5))
constrains = [cp.sum(x) == 1.0, 0 <= x]
The solution worked most of time, satisfying both constrains. But sometimes the solution only satisfied the…

zhihao_li
- 183
- 10
1
vote
1 answer
Cubic and non convex optimisation problems in portfolio optimisation
I have the following cost function for portfolio allocation, which considers also the skweness,
w are the weights to be found, mu is the return vector, Sigma is the covariance matrix, K is the co-skewness matrix, gamma is the risk aversion (let's…

Luigi87
- 265
- 4
- 13