Solving for x by minimizing $\|Ax-b\|_{\infty}$ in matlab

707 Views Asked by At

I found the following matlab code that minimizes the infinity. Can somebody help me understand what is going on here? Why are $f$, $Ane$ and $bne$ like that?

A = randn(m,n);
b = randn(m,1);

% infinity norm
f    = [ zeros(n,1);  1          ];
Ane  = [ +A,          -ones(m,1) ; ...
             -A,          -ones(m,1) ];
bne  = [ +b;          -b         ];
xt   = linprog(f,Ane,bne);
x_lp = xt(1:n,:);
1

There are 1 best solutions below

0
On

The problem $$ \min_x\|Ax-b\|_\infty $$ is equivalent to $$\tag{*} \min_{x,t} t \quad \text{subject to} \quad -t\boldsymbol{1}\leq Ax-b\leq t\boldsymbol{1}. $$ To see this note that the inequality constraint in (*) says that $\|Ax-b\|_\infty\leq t$.

Now your Matlab code is nothing but translating (*) to a form digestible by a standard linear programming solver.