Enforce condition in lsqnoneg
이전 댓글 표시
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
sanjay
2024년 7월 5일
Torsten
2024년 7월 5일
Shouldn't this be equivalent to imposing the 1600 conditions
x(1) >= x(1601)
x(2) >= x(1601)
...
x(1600) >= x(1601)
?
sanjay
2024년 7월 5일
John D'Errico
2024년 7월 5일
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
2024년 7월 5일
sanjay
2024년 7월 5일
Torsten
2024년 7월 5일
Your matrix A is incorrect ; the conditions you set would be
x(1) <= x(1601)
x(2) <= x(1601)
...
x(1600) <= x(1601)
sanjay
2024년 7월 5일
A = [-eye(1600), ones(1600,1)];
sanjay
2024년 7월 5일
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
2024년 7월 6일
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
2024년 7월 6일
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
2024년 7월 6일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Linear Least Squares에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!