A L1 regression problem is given as:
$\min\limits_{a,b} \sum\limits_{i=1}^n |y_i - ax_i - b|$
It has an equivalent LP model:
$\min \sum\limits_{i = 1}^n z_i$
$|y_i - ax_i - b| \leq z_i$
where $z_i$ are the auxiliary variables
Can someone explain how can MATLAB's linprog
solve this problem when $(a,b)$ is not in the objective function?
For example, let's say we are given two data points, currently I have the objective function as
f = [1 1]; %i.e. objective z_1 + z_2
A = [-1 -x_1 -1; -1 -x_2 -2]; %i.e. constrains [z_1 a b; z_2 a b]
b = [-1 1]; %i.e. [z_1 a b; z_2 a b] = [y_1 y_2]
linprog(f,A,b)
When I type this into MATLAB I receive:
Error using linprog (line 233) The number of columns in A must be the same as the number of elements of f.
Obviously because I have not worked $(a,b)$ pair into the objective function but I have them in the constrain equation
How do I let linprog
find both the $z_i$'s, $a$ and $b$?