CVXPY is a Python-embedded modeling language for convex optimization problems inspired by the MATLAB package CVX.
Questions tagged [cvxpy]
609 questions
-1
votes
1 answer
Why am I getting a "disciplined convex programming" error when using cvxpy?
import cvxpy as cp
import numpy as np
n = 3
PP = cp.Variable((n,n),"PP")
KK = [[2,1,3],[1,2,1],[3,1,2]]
s = np.array([[.1, .4, .5]]).T
t = np.array([[.4, .2, .4]]).T
e = np.ones((n,1))
x = PP.T@e - s
y = PP@e - t
for b in range(1,21):
obj =…

Kashif
- 3,063
- 6
- 29
- 45
-1
votes
1 answer
Linear Programming with cvxpy
I would like to ask you regarding on the Linear Program for optimization.
I have an objective function, and constraint functions as below,
variables(x1, x2, x3, x4, x5, x6) are quantities of the products, and the quantities of products have to be…

Jay Kim
- 7
- 1
-1
votes
1 answer
CVXPY - ImportError: No module named fastcache
I am trying to generate a python(.egg) file of cvxpy and import it. Used the below to generate the .egg file for https://github.com/cvxgrp/cvxpy:
python setup.py bdist_egg
While trying to import cvxpy I am getting the below error,
…

Shadow_returns
- 1
- 1
- 2
-1
votes
1 answer
How to setup a constraint that depends on interim minimized function?
I am trying to setup a constraint which depends on the minimized function value.
The problem I have is of the following nature:
fmin = minimize (d1x1 +d2x2 ... +d5x5)
Where I want to optmize with following constraints:
x1+X2+x3+x4+x5 = 1
0.003

DrBug
- 2,004
- 2
- 20
- 21
-2
votes
1 answer
Can I buy the full (non-community) version of CVXPY somewhere?
CVXPY is a package that enables convex optimization, but the community version of CPLEX only supports 1000 variables and constraints (https://www.cvxpy.org/api_reference/cvxpy.problems.html#id3).
I need to optimize a portfolio larger than 1000, but…

Aj LaPanta
- 11
- 1
- 5
-2
votes
1 answer
"Problem does not follow DCP rules" when I use "ceil" and"sign" function , how to avoid this?
I am trying to solve a job assign problem , The goal is to assign the same job to the same person as much as possible, within the constraints of satisfying the ability limits
import cvxpy as cp
import numpy as np
c=np.array([[0,1,1],
…

dashongda0
- 1
- 1
-2
votes
1 answer
How to specify constraint for columns with not all-zero values to equal each other in cvxpy
How would I specify a constraint so that the boolean 2-dimensional decision variable matrix has the following criteria:
all the non-zero columns have to be identical
If the matrix was a numpy array, we would be able to use np.all, but I don't see…

matsuo_basho
- 2,833
- 8
- 26
- 47
-2
votes
1 answer
Is there a wrapper library for solving optimisation problems by declaring known and unknown variables?
cvxpy has a very neat way to write out the optimisation form without worrying too much about converting it into a "standard" matrix form as this is done internally somehow. Best to explain with an example:
def cvxpy_implementation():
var1 =…

evan54
- 3,585
- 5
- 34
- 61
-3
votes
1 answer
1/x violates DCP rules in CVXPY
I want to solve a non-linear optimization problem using cvxpy. I get a DCP Error when introducing 1/x in the constraints, where x is a variable.
For instance such a code leads to a DCP Error
import cvxpy
x = cvxpy.Variable(1)
obj =…

Xb19
- 130
- 2
- 10