The optimal points (x^*) for each equivalent non-negative least squares can be different for an underdetermined system of equations. Is CVX producing an error or is this a product of how gurobi solves the optimization? Then my question is why?

Consider the two equivalent non-negative least squares

MIN ||Ax-b||_2

and

MIN 1/2*||Ax-b||_2^2

Underdetermined system of equations have infinite number of solutions, but because the least squares finds the smallest magnitude (x) w.r.t. 2-norm that satisfies Ax=b, I figured the two cvx codes should yield the same solution, but sometimes they do not.

Thanks in advance

Chandler

Neither of those formulations guarantee minimum norm(x) solution. All they guarantee is finding the lowest objective value (for which the second should be the square of the first) within solver tolerance. CVX and the solver are only obliged to provide an optimal solution, and it can be “whatever they fell like” Even for the exact same problem, different solvers can produce different optimal x. And in the case of randomization within the solver, as might be used for integer problems, the same solver might even produce different results,unless the seed is the same, and even then might not if subject to the vagaries of parallel processing.

If you want the minimum norm(x) solution, use `pinv(A)*b`

, which does not use CVX.