is it possible that LSQNONNEG gives multiple answers?

I'm trying to calculate a position by approximating it with lsqnonneg. i'm wondering if it is possible that the solver gives all the different answers(and not just the best). Or maybe if there is another solve that does this.

Answers (3)

At least you should get that |C*x-d|_2 is equal for all the solutions you get from lsqnonneg.
If this is not the case, something is wrong with your problem formulation.
Best wishes
Torsten.
Well, the problem is i only get one answer. The question in case is undetermined( my C matrix is 4x400) and my d is 4x1. I'm interested in all the answers. Not just the best answer(which is not always the correct one in my model).
John D'Errico
John D'Errico on 20 Mar 2015
Edited: John D'Errico on 20 Mar 2015
There are INFINITELY many answers to a singular problem. Which of those infinitely many answers do you want? When should it stop printing all the results? Is your machine large enough to store infinitely many solutions?
Infinity is a BIG place. Do you really want to go there?
You say that in your case, C is 4x400, and d is 4x1 for lsqnonneg. So there is a 396 dimensional subspace of answers. You would not be able to sort through the number of possible solutions. Not just 396 solutions, but a set of them that stretches out to infinity in each of 396 possible dimensions. Now, given the non-negativity constraints, that set will be limited. But even so, we are talking a big set, and still infinite.
Apparently you don't like the solution. What you need to do is to formulate what is the problem, in the form of additional constraints beyond simple non-negativity. Assuming they are linear, then you can use lsqlin to solve the problem. (In the optimization toolbox.) If they are not linear, then you would need to use fmincon. (Also optimization toolbox.)

1 Comment

Hello John,
Thanks for answering my question. I maybe need to clarify myself more, i want to find answers that fit in a certain level of tolerance, and lsqnonneg does not have this option.

Sign in to comment.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!