CVXPY is a Python-embedded modeling language for convex optimization problems inspired by the MATLAB package CVX.
Questions tagged [cvxpy]
609 questions
2
votes
1 answer
Convex programming with CVXOPT or CVXPY
I need to solve an optimization problem with CVXOPT or CVXPY in Python and I have run into difficulties. The objective function is
Minimize Sum(a*x^2+b/x)
subject to the following constraints
5 <= x < 40;
sum(v/d)<=T
where vector x is the…

Vitor Lemos
- 21
- 1
- 3
2
votes
1 answer
Kernel Matching Pursuit on CVXPY
I am writing code for Kernel Matching pursuit.In that, I have used to cvxpy for convex optimization.I have to minimize following objective which is based on this paper:http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=6815769
and code is as…

Gunjan naik
- 501
- 1
- 7
- 18
2
votes
1 answer
installed cvxpy, i can import but doesn't autocomplete in ipython
so I installed cvxpy following the instructions https://github.com/cvxgrp/cvxpy and it works but it doesn't autocomplete in ipython ie.
import cvxpy as cvx
works just fine but
import cv
only gives me the cvxopt completion...
Any ideas how to…

evan54
- 3,585
- 5
- 34
- 61
1
vote
1 answer
Minimizing 1/x such that x>=1 and x<=10 using CVXPY
I am trying to solve the following problem using CVXPY:
# Define the variable
x = cp.Variable()
# Define the objective function
objective = cp.Minimize(1/x)
# Define the constraints
constraints = [x >= 1, x <= 10]
# Formulate the problem
problem…

Saim Masood
- 15
- 4
1
vote
0 answers
segmenation fault when running cvxpy in modelica buildings python module
I am not sure if this is a CVXPy, modelica, python, or maybe even a C problem (I believe CVXPy and/or the SCS solver calls functions written in C). I am simulating a microgrid using openmodelica that has a python module that calls a CVXPy function…

Luis Enriquez-Contreras
- 367
- 2
- 11
1
vote
0 answers
How do I avoid NaNs from CVXPY when optimizing L1 norm of entries of a 100x100 matrix?
I am trying to run an optimization using CVXPY for a large problem. I'm trying to optimize the L1 norm of some of the entries of a $100\times 100$ matrix, under constraints that restrict the set of feasible matrices to a $100(99)/2=4950$ dimensional…

xu_pi
- 11
- 2
1
vote
0 answers
Adding constraint to ensure diagonals of a complex matrix are equal?
I'm trying to solve a convex minimzation problem using the CVXPY module in Python. I want to solve for a complex matrix X of dimension d*d and add the Constraints, that
trace (A * X) = 1 for a given matrix A and
X is positive semdefinite, hermitean…

BB27pscl
- 11
- 1
1
vote
1 answer
Maximum Variance Unfolding with CVXPY
I am trying to reproduce the results from this paper (Weinberger and Saul, 2004, doi/10.5555/1597348.1597471), in which the authors use Maximum Variance Unfolding (MVU) to learn a low dimensional representation of a few distributions. The general…

Saucy Goat
- 1,587
- 1
- 11
- 32
1
vote
1 answer
CVXPY Quadratic Programming - ArpackNoConvergence error and AssertionError
I am trying to use the Python package CVXPY to solve a quadratic problem but I keep getting errors. Could you help me?
Here is my code:
p = lasso.p # This is a number
Sigma_opt = lasso.Sigma_opt # This is a positive semi-definite matrix of shape…

Noomkwah
- 133
- 6
1
vote
0 answers
My cvxpy program for my hobby project (finding cost of renewable energy) is giving spurious results
For a personal hobby project, I'm trying to figure out how much it would cost to switch Cleveland, Ohio, to fully renewable electricity for a single day in July (any July). I'm trying to use cvxpy to do this, because it seems like a minimization…

Ben
- 21
- 3
1
vote
2 answers
Anaconda Python 3.9 (Windows): Why can't CVXPY find qdldl.dll?
I'm running Anaconda Python 3.9 on Windows 10:
Python 3.9.16 (main, Mar 8 2023, 10:39:24) [MSC v.1916 64 bit (AMD64)] on win32
I installed CVXPY in an Anaconda environment using the command:
conda install -c conda-forge cvxpy
I then attempted to…

Ray Beausoleil
- 23
- 4
1
vote
0 answers
Does CVXPY (with the ECOS solver) require to scale the decision variables?
I am new to CVXPY and I am not an optimization expert, so please be patient with me. I am trying to solve a very standard problem, i.e., the (ordinary) least squares problem, in CVXPY using the solver ECOS. I am aware that there are very specialized…

AB8
- 51
- 6
1
vote
1 answer
CVXPY convex but getting DCP error for constraint y^2/x + z <= 1
Crossposted on Mathematics SE
I have a convex objective function and a convex constraint of the form $y^2/x + z \leq 1$ on the domain $x \geq 0$. But I'm not sure how to encode this constraint in a way that cvxpy will accept it. It seems to be…

JEK
- 11
- 3
1
vote
2 answers
How would I go about finding the optimal way to split up an order
I have a problem (that I think I'm over complicating) but for the life of me I can't seem to solve it.
I have 2 dataframes. One containing a list of items with quantities that I want to buy. I have another dataframe with a list of suppliers, unit…

Andrew Knoesen
- 43
- 5
1
vote
1 answer
How to fill a contingency table from the marginal distributions given some optimization constraints?
I need to find the cells of a contingency table given the marginal…

hfs
- 2,433
- 24
- 37