CVXPY is a Python-embedded modeling language for convex optimization problems inspired by the MATLAB package CVX.
Questions tagged [cvxpy]
609 questions
0
votes
1 answer
Retrieving mosek error code from solver in cvxpy
Using mosek in cvxpy, I'm getting the error that the solver failed. Is there a way to recover the error code from Mosek? Cvxpy doesn't seem to provide it.

pythonic metaphor
- 10,296
- 18
- 68
- 110
0
votes
1 answer
Different versions of CVXPY generates different results.
Due to the lack of knowledge of CVXPY, I have a problem with reconciling a simple optimization problem's results when using different versions of it.
When I use CVXPY with version 0.4.5 I wrote my problem as:
import numpy as np
from cvxpy import *…

user45668
- 31
- 5
0
votes
1 answer
cvxpy mixed integer programming returns "inf"
I am trying to solve a MIP problem with cvxpy as follows :
the problem:
subject to:
and the code (without the data):
# declaring variables
x_ijk = {}
for i in stores:
for j in models:
for k in sizes.index:
x_ijk[(i,j,k)] =…

afek
- 21
- 3
0
votes
1 answer
Optimizing a cost function subject to second order cone constraints using cvxpy
I have a problem of the form:
Where X^_JW:
and delta_R_LV:
Where:
-All uppercase deltas and epsilon are constants
-R_WV is a 3,3 rotation matrix with 1000 samples
-R^_LV is a 3,3 constant rotation matrix
-I is a 3,3 rotation matrix…

Ian Campbell Moore
- 301
- 3
- 18
0
votes
1 answer
Infinity objective value given by CVXPY on a convex program
I am solving a convex problem using cvxpy. The constraints are rather simple, there are 3 variables, but we could eliminate one. The objective is convex and involves the entropy and logarithm. The solution is correct, in the sense that the…
0
votes
1 answer
CVXPY: possible bug in sum_squares when handling nested sums?
As part of a larger project, I end up with convex expressions like ((x_0 + x_1)^2 + x_2^2:
from cvxpy import Variable, sum_squares, sum
target = Variable(3, nonneg=True, name='Target')
sum(target)
sum_squares(target)
combo = [sum([target[0],…

rhaskett
- 1,864
- 3
- 29
- 48
0
votes
1 answer
quad_form() from cvxpy is throwing IndexError
I am trying to run this code from Python Robotics github repository. But I am getting following error.
model_predictive_speed_and_steer_control.py
start!!
Traceback (most recent call last):
File "model_predictive_speed_and_steer_control.py",…

rsvar67
- 77
- 8
0
votes
0 answers
Defining a soft constraint in cvxpy
I am using cvxpy to do a simple portfolio optimization.
I implemented the following dummy code
from cvxpy import *
import numpy as np
np.random.seed(1)
n = 10
Sigma = np.random.randn(n, n)
Sigma = Sigma.T.dot(Sigma)
orig_weight =…

ThatQuantDude
- 759
- 1
- 9
- 26
0
votes
0 answers
cvxpy solve attribute returns none
I have written the following code
import cvxpy
import numpy as np
def missingMat(A, mask):##true and false for known and missing entries
M=np.array(A)
for i in range(0, mask.shape[0]):
for j in range(0, mask.shape[1]):
…

Manish Bhanu
- 53
- 10
0
votes
1 answer
'sum_entries / axis' related error
I am new to cvxpy and would be grateful for your help with the following issue. I wrote the following simple optimization code:
import cvxpy as cvx
import numpy as np
m = 4
n = 3
c = np.array([[2, 3, 0], [4, 0, 5], [2, 3, 4], [5, 0, 3]])
s =…

yavigol
- 1
- 1
0
votes
0 answers
Why Visual Studio 2017 returns error while installing cvxpy 0.4.11?
I have installed Microsoft Visual Studio 2017 online with python enabled. under Python Environments > Packages I search for cvxpy and it suggest installing "pip install cvxpy" from PyPI. but when I click on it, process returns an error saying:…

MJay
- 987
- 1
- 13
- 36
0
votes
0 answers
matlab CVX problems to python cvxpy
This is my Matlab CVX
linkpair=[link_1 -link_2];
unlinkpair=[unlink_1 -unlink_2];
m=size(linkpair,2);
n=size(linkpair,1);
%%%%%%%%%%%%%%%%%%%%%%%%%%%parametres%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
C=100;
B=10;
d=10;
W=[];
delta=[];
for…

李来龙
- 1
0
votes
1 answer
How to minimize this equation by using cvxpy in python?
i am new to CVXPY and would like to do some optimization,
this is my code:
from numpy.linalg import pinv
AA=pinv(A) #m*n
AAT=AA.T #n*m
i1=np.transpose(np.matrix([1,0])) #m*1
i2=np.transpose(np.matrix([0,1])) #m*1
from cvxpy import *
import…

Stanley
- 11
- 2
0
votes
0 answers
Minimum jerk trajectory with CVXPY
I am trying to numerically solve the problem of generating a 1D minimum jerk trajectory using cvxpy (version 0.4.9). Here is the basic statement of the problem,
'x' is the vector of position as a function of time. 'D' is the matrix for calculating…

siva82kb
- 1,910
- 4
- 19
- 28
0
votes
0 answers
Solving CVXPY Matrix Optimization Linear Programming
I'm trying to solve for the ideal matrix X in the following linear program setup:
X = N by T matrix which is our variable. For simplicity, let's set N to 4 and T to 3.
X_column_sum = 1 by T matrix where each column value is the sum of all values of…

Willy
- 322
- 1
- 17