Questions tagged [cvxpy]

CVXPY is a Python-embedded modeling language for convex optimization problems inspired by the MATLAB package CVX.

609 questions
1
vote
0 answers

Maximizing a Ratio/Percent

I'm using cvxpy to model a problem. Inside a very large and complex LP, I create two continuous, affine (unconstrained) expressions:x and y. Due to how they are created, I know that 0 < x < y <= U. Obviously: x/y < 1. In my LP objective, how do I…
Adi Shavit
  • 16,743
  • 5
  • 67
  • 137
1
vote
0 answers

CVXPY library to optimise utility function

I am trying to maximise the utility function with two constraints. But I am not sure where I need to fix the Code. I have tried making the dimensions of the matrices same and specified in the code I have defined the global parameters I have…
Prachi
  • 15
  • 3
1
vote
0 answers

Unable to install PyPortfolioOpt

When trying to install PyPortfolioOpt using pip it errors out with the following message, ERROR: Failed building wheel for cvxpy ERROR: Could not build wheels for cvxpy which use PEP 517 and cannot be installed directly However, i do have cvxpy…
sarvotham
  • 11
  • 2
  • 3
1
vote
1 answer

Solving KKT equations in SymPy

I am trying to solve KKT equations using sympy. All of the equations are symbolic and contain constants that are not given as numbers but as symbols. Alongside with the equations, there are also inequality constraints. Is it possible to do this in…
Light
  • 31
  • 3
1
vote
0 answers

Is there a way to implement a constraint: Rank(X) == 1 in CVXPY

I got some code from a friend which reads like this: import numpy as np import cvxpy as cp def tomoSolve(m, P,prin=True): # get d from projector length d = int(np.sqrt(P.shape[1])) # n.b. due to cvxpy's implementation of variable…
Markus
  • 37
  • 6
1
vote
0 answers

Is there a GLPK parameter that affects convergence?

I'm using GLPK_MI to solve a Mixed Integer Linear Program via cvxpy. Whenever my problem grows beyond about 2000 constraints, the solver does not converge and just keeps on running. When I removed some redundant constraints to stay below 2000…
1
vote
1 answer

Write Dirichlet Log Likelihood with DCP ruleset

I would like to write the log likelihood of the Dirichlet density as a disciplined convex programming (DCP) optimization problem with respect to the parameters of the Dirichlet distribution alpha. However, the log likelihood def…
Jon Deaton
  • 3,943
  • 6
  • 28
  • 41
1
vote
1 answer

No strict inequalities in cvxpy problem but still get the error "Strict inequalities are not allowed"

I was using the CVXPY library in Python, trying to solve a particular optimization problem. import cvxpy as cp import numpy as np from scipy.stats import norm (...) a = cp.Variable([10, 1]) obj = cp.Maximize(sum(norm.logcdf(A @ a,…
JackAu
  • 11
  • 1
  • 2
1
vote
0 answers

Segmentation fault (core dumped) while using CVXPY library

I am trying to solve an optimization problem using CVXPY library. My code runs properly on a dummy dataset but crashes when I key in the actual dataset. The error I got is Segmentation fault (core dumped) I tried to search for the solution on…
Upendra01
  • 344
  • 3
  • 5
  • 15
1
vote
2 answers

Automatic unwanted terminal outputs while solving cvxpy optimization problem

While trying to solve a logistic regression problem using cvxpy I got a bunch of terminal outputs when calling the solve() function even though no print-outs were programmed. Furthermore, no information about the problem was printed to the terminal…
Manumerous
  • 455
  • 6
  • 21
1
vote
0 answers

Euclidean distance in convex constraint & optimization

Beginner style, general question regarding convex optimization. As part of the learning cvxpy specifically, and convex optimization in general, was trying a basic (imaginary) geometry (hopefully convex) optimization problem. Given two points in 2D…
1
vote
1 answer

CVXPY to minimize difference between 2 arrays

I have 2 arrays of n elements each. The first is a percentage (ranging from 0% to 100%) where the sum of all elements yields 100%. The second is constituted of integers ranging from -3 to 3 (inclusive). The objective of my script is to vary the…
1
vote
1 answer

Python non convex optimization

I use the package cvxpy form Python to solve a non convex optimization problem which is given as follows: import numpy as np import cvxpy as cp def kl(a,b): if a==b: return 0.000001 if b==0: return 1000000 if a==0: …
1
vote
0 answers

Is there an alternative to scipy.optimize.lsq_linear for solving a non-square matrix equation by minimizing the L1 norm instead?

I wrote a python code that imports some data which I then manipulate to get a nonsquare matrix A. I then used the following code to solve the matrix equation. from scipy.optimize import lsq_linear X = lsq_linear(A_normalized, Y, bounds=(0, np.inf),…
YKZ
  • 11
  • 3
1
vote
1 answer

Is there a way to get the final system of equations sent by cvxpy to the solver?

If I understand correctly, cvxpy converts our high-level problem description to the standard canonical form before it is sent to a solver. By the standard form I mean the form that can be used for the descent algorithms, so, for instance, it would…
t-arsin
  • 13
  • 2