Questions tagged [cvx]

CVX is a Matlab-based modeling system for convex optimization. CVX turns Matlab into a modeling language, allowing constraints and objectives to be specified using standard Matlab expression syntax.

CVX is a Matlab-based modeling system for convex optimization. CVX turns Matlab into a modeling language, allowing constraints and objectives to be specified using standard Matlab expression syntax.

88 questions
9
votes
1 answer

Least-squares minimization within threshold in MATLAB

The cvx suite for MATLAB can solve the (seemingly innocent) optimization problem below, but it is rather slow for the large, full matrices I'm working with. I'm hoping this is because using cvx is overkill, and that the problem actually has an…
Geoff
  • 1,132
  • 9
  • 18
9
votes
1 answer

From CVX to CVXPY or CVXOPT

I've been trying to pass some code from Matlab to Python. I have the same convex optimization problem working on Matlab but I'm having problems passing it to either CVXPY or CVXOPT. n = 1000; i = 20; y = rand(n,1); A = rand(n,i); cvx_begin variable…
silgon
  • 5,517
  • 4
  • 36
  • 62
5
votes
1 answer

Fast nonnegative quantile and Huber regression in R

I am looking for a fast way to do nonnegative quantile and Huber regression in R (i.e. with the constraint that all coefficients are >0). I tried using the CVXR package for quantile & Huber regression and the quantreg package for quantile…
Tom Wenseleers
  • 6,574
  • 5
  • 46
  • 98
2
votes
2 answers

CVXR using Mosek for a quadratic minimization problem

I'm trying to solve a Quadratic optimization problem with linear constrains using the R package CVXR. Although the default solver is able to solve the optimization, Mosek solver is not. The reason I'm looking to use Mosek is because I need to solve…
Alejandro Andrade
  • 1,959
  • 12
  • 36
2
votes
0 answers

What does that CVX warning mean?

When I run the following CVX code, I get a warning I don't understand. I just have the warning, then the code returns a solution. And if I rerun the code, I don't have the warning anymore. The warning is Warning: A non-empty cvx problem already…
Ccile
  • 207
  • 1
  • 2
  • 12
2
votes
0 answers

Efficient quadratic optimization with simple linear constraint MatLab using CVX

(Sorry about formatting, I will try my best) I want to solve: x = argmin_x (Ax - p)'(Ax - p) s.t. x >= b where A is a NxH logical matrix (roughly half zeros, half ones), b is a Hx1 constant vector where every entry is the same (e.g., b =…
2
votes
1 answer

How do I square a norm in CVX?

In the CVX package for Matlab, I want to minimize a function like $|Ax-b|_2^2$ . Meaning the square of a 2-norm. How do I code that in CVX? I tried both: minimize (norm(A*x-b,2)^2); and minimize (norm(A*x-b,2)*norm(A*x-b,2)); but both threw…
Leo 254
  • 151
  • 1
  • 8
2
votes
0 answers

trace in CVX package

I am using trace in my CVX (MATLAB) code. Sometimes it is working fine, but sometimes it is showing some errors. Error message is as follows- "trace" previously appeared to be used as a function or command, conflicting with its use here as the name…
Rajat
  • 239
  • 1
  • 8
2
votes
1 answer

Matlab cvx error with cvx_begin

cvx don't work out of the box for me for some reason. I use windows x64, cvx x64 and Matlab x64 R2012a But when I run even just simple example(\cvx\examples\quickstart.m) it give me an error: >> quickstart has_quadprog = exist( 'quadprog'…
mrgloom
  • 15,245
  • 23
  • 126
  • 226
2
votes
1 answer

How to set SDP constraints?

Z is a matrix variable that results from a CVX SDP code using Matlab; how can I include a constraint that the values of the elements of matrix Z should be either zero or one? There is the "banded" option but it doesn't work for matrices.
Amira Akra
  • 163
  • 10
1
vote
1 answer

Absolute value function not recognized as Disciplined Convex Program (CVXPY)

I am trying to run the following optimization using CVXPY: import cvxpy as cp import numpy as np weights_vec = cp.Variable(10) er_vec = cp.Parameter(10, value=np.random.randn(10)) prev_h_vec = cp.Parameter(10, value=np.ones(10)) tcost_vec =…
1
vote
0 answers

Issue when installing CVX in MATLAB 2021a with cvx_setup on MacOS, cvx/sedumi/.travis.yml is missing

I've just downloaded CVX 2.2 on my MacOS (10.14.5), unzipped CVX, started MATLAB 2021a, changed the directory to the CVX unpacked folder and ran the cvx_setup file for the installation. Installation seems successful, but I get this warning…
Barbab
  • 80
  • 8
1
vote
0 answers

Problem inefficiency for loop problem Matlab CVX

I am trying to solve a convex optimization problem with the CVX MATLAB package implemented by Stephen Boyd's group at Stanford University. The code is the following: k = 500; d = 2; theta=ones(d,1); X = rand(d,k); X(:,1) = ones(d,1); Y = X(:,1) -…
Apprentice
  • 121
  • 4
1
vote
0 answers

How to write inverse in CVX (Matlab)?

My attempt of cvx (Matlab) for n = 2: A = diag([3 2]); cvx_begin variable X(2,2) symmetric minimize (trace(A*inv(X)*A*X')) subject to X>0; cvx_end I have the following error: From my understanding, inverse cannot be used in cvx, is there any…
Lee
  • 113
  • 4
1
vote
0 answers

How can I solve this optimization problem using MATLAB CVX?

I used the following code to solve this problem %System parameters: N = 2; K = 8; M = 4; C_l=4; H = [0.1185 0.2811; 0.3550 0.8224; 0.3260 0.9644; 0.5333 0.6083; 0.6871 0.2298; 0.2594 0.8361; 0.1309 0.2454; 0.4715 0.2111]; %(K,N) matrix A = [-1 1; 1…
1
2 3 4 5 6