MATLAB: Set “not equal to” constraint for a linear system of equations solver:

optimisationOptimization Toolbox

Hi, I'm looking to set a constraint for the solution to my linear system of equations
Cx=D
such that
x~=0
or
|x|>eps
I'm currently looking at lsqlin() but it seems that I am not able to do this. Would you please let me know how can I do this with lsqlin() or another function, if it is possible?
Thank you.

Best Answer

There is no direct way to do that.
You need to run your solver multiple 2^N times where N is the length of your x vector. Each position in the vector needs to be considered with a lower bound of -inf and an upper bound of -eps(realmin), and then again with a lower bound of +eps(realmin) and an upper bound of +inf . Then out of all of those 2^N solutions, you have to somehow figure out which one is "best".