Enforce condition in lsqnoneg
Show older comments
I working on inverse problem which is rank deficient and for that i am using tikhonov regularization , for minization i am using lsqnoneg to resolve it which is giving me good result but now i have to enforce a condition in each iteration of minimzation of lsqnoneg, however lsqnoneg oterations are automatic i cant control it manually althohg i used fmincon but it is not giving me the same results can some one help what algorithm should i use so that i can enforce my conditon during optimization iterations and it gives results like lsqnoneg,
Tikh_Output.IA_recovered_line_1 = lsqnonneg(Combined_Coeff_Matrix,Combined_projection_line_1);
Tikh_Output.IA_recovered_line_2 = lsqnonneg(Combined_Coeff_Matrix,Combined_projection_line_2);
here is my code
18 Comments
sanjay
on 5 Jul 2024
Torsten
on 5 Jul 2024
Shouldn't this be equivalent to imposing the 1600 conditions
x(1) >= x(1601)
x(2) >= x(1601)
...
x(1600) >= x(1601)
?
sanjay
on 5 Jul 2024
John D'Errico
on 5 Jul 2024
If the problem is singular though, the solution is not unique. So that fmincon does not give the same results as lsqnonneg is meaningless, because that is fully expected.
sanjay
on 5 Jul 2024
sanjay
on 5 Jul 2024
Torsten
on 5 Jul 2024
Your matrix A is incorrect ; the conditions you set would be
x(1) <= x(1601)
x(2) <= x(1601)
...
x(1600) <= x(1601)
sanjay
on 5 Jul 2024
A = [-eye(1600), ones(1600,1)];
sanjay
on 5 Jul 2024
At least the solution should satisfy the constraints. It is the case for all optimization algorithms that constraints can be violated during the computational process (except for bound constraints, I guess). You should at least supply an initial guess x0 that satisfies the constraints if this is that important for you.
What do you mean by "This not giving me specific reuslts" ? Do you mean "satisfactory results" ?
sanjay
on 6 Jul 2024
I know what "satisfactory results" mean, but you wrote "specific reuslts" that I couldn't understand.
Including the contraint A*x <= b should produce a solution that satisfies x(1) >= x(1601),...,x(1600) >= x(1601). Usually the way how you arrive at this solution (directly or by checking in each iteration) is irrelevant. But for some reason that I don't understand this doesn't seem to be the case here.
There is no optimization tool in which you can directly change optimization variables depending on some conditions during the optimization process. You can only change constraints or the objective function. If you want to do this, you have to use "fmincon" - the problem description for "lsqlin" is fixed right from the beginning and cannot be altered during the computational process.
sanjay
on 6 Jul 2024
As I said: You can't change solution variables during the optimization process in MATLAB optimizers. The changes must be initiated by your definition of the objective function or by the definition of your constraints. So neither "lsqlin" or "fmincon" can help you in this respect.
But if you want the optimal solution that satisfies x(1) >= x(1601), ... , x(1600) >= x(1601), then the constraint-based solution with "lsqlin" should be correct in my opinion (althogh the result you get might not be as expected).
Do you get the same results with lsqnonneg and lsqlin if you work without the A*x <= b constraint and only set the lower bounds vector lb to zeros(1601,1) ?
sanjay
on 6 Jul 2024
Accepted Answer
More Answers (0)
Categories
Find more on Linear Least Squares in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!