Enforce condition in lsqnoneg

133 次查看(过去 30 天)
sanjay
sanjay 2024-7-5,8:20
编辑: Matt J 2024-7-7,20:29
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 个评论
Torsten
Torsten 2024-7-6,9:30
编辑:Torsten 2024-7-6,9:33
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
sanjay 2024-7-6,9:44
Yes i tried without constraint then the reconstruction results are coming same in lsqin and lsqnoneg,

请先登录,再进行评论。

采纳的回答

Matt J
Matt J 2024-7-6,11:32
编辑:Matt J 2024-7-6,11:35
Suppose your original problem is,
Rewrite the problem by making the change of variables x=Q*z where z>=0 and
Q=eye(1601); Q(:,end)=1;
Then the problem becomes,
which you can solve with lsqnonneg. After solving for z, you can retrieve x with x=Q*z.
  22 个评论
Torsten
Torsten 2024-7-7,20:13
编辑:Torsten 2024-7-7,20:20
Both approaches (using lsqlin with lb = 0 and A*x <= b or using lsqnonneg for optimization in z where x is determined after the optimization as x = Q*z) are correct and should give the same result (at least ||C*x-d|| and ||C*Q*z-d|| should be the same)). Test it.
If you don't trust in the appoach with the coordinate transformation
z(i) = x(i) - x(1601) (1 <= i <= 1600)
z(1601) = x(1601)
or explicitly rewritten in x
x(i) = z(i) + z(1601) (1 < = i <= 1600)
x(1601) = z(1601)
or rewritten in matrix form
x = Q*z
use the approach in x.
I don't know what you mean by "recover my X and then apply this condition".
Matt J
Matt J 2024-7-7,20:24
编辑:Matt J 2024-7-7,20:29
i am enforcing the condition which X(1)>=X(1601),X(2)>=X(1601),,,,,,,,X(1600)>=X(1601) where this condition is satisfied using Q and z approach?
Yes. Torsten already said it, but just for emphasis, the condition X(1)>=X(1601),X(2)>=X(1601),,,,,,,,X(1600)>=X(1601) means the very same thing as the condition z>=0. Therefore, if you have optimized over z subject to z>=0, you have done the very same thing as when you optimize over X subject to the constraints X(1)>=X(1601),X(2)>=X(1601),,,,,,,,X(1600)>=X(1601).

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Linear Least Squares 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by