L1 Minimizaton variation


(Ryan Howe) #1

I have a L1 minimization problem. I was trying to do it using CVX. In Matlab I have
function [ev,x] = L1minimizationV3( A, b, gamma )
% Computes x such that it minimizes the quantity norm(Ax-b,1).
% Uses slack variables

[m,n]=size(A);
lb=[zeros(n,1);zeros(n,1); zeros(2*m,1)];

I = eye(m);
Aeq = [A,-A,-I,I];
f=[ones(2n,1);gammaones(2m,1)];
options = optimoptions(‘linprog’,‘Algorithm’,‘dual-simplex’,‘OptimalityTolerance’,1e-10);
xps = linprog(f,[],[],Aeq,b,lb,[],options);
x=xps(1:2
n);
ev=xps(1:n)-xps(n+1:2*n);
end

I was going to attempt this as
function L1minizationV4(A, b, gamma)
%
%
[m,n]=size(A);
lb=[zeros(n,1);zeros(n,1); zeros(2*m,1)];

I = eye(m);
Aeq = [A,-A,-I,I];
f=[ones(2n,1);gammaones(2*m,1)];

cvx_begin
variable x(n)
dual variable y;
minimize ( f’*x);
subject to y: A * x == b

cvx_end

I am not sure about the rest of the constraints.


(Michael C. Grant) #2

Why are you doing all the hard work of constructing f, A, b? Why not use CVX in the way it is intended? For instance, you do know that CVX can do things like norm(x,1) and norm(A*x-b,2), I hope.


(Michael C. Grant) #3

Indeed, this is not the correct forum to help you formulate models. That is to say, constructing A, b, and f is outside the scope of this forum. Our focus is on what you’ve done between cvx_begin and cvx_end, and everything there looks just fine.