How to code this quadratic minimization problem subject to a linear constraint?
1 回表示 (過去 30 日間)
古いコメントを表示
After having performed Factor Analysis (FA), I am now trying to implement the following rotation strategy (Swanson 2017 - details of rotation strategy in appenix A) to interpret the three factors structurally and economically. The strategy is in 3 steps but I will report just the first one as the other steps will follow suit:
1) Quadratic minimization problem subject to a linear constraint:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/278666/image.png)
s.t. ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/278667/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/278667/image.png)
where
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/278668/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/278669/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/278670/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/278668/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/278669/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/278668/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/278674/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/278675/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/278676/image.png)
Can you help me code the first minimization problem?
1 件のコメント
Bianca Piccirillo
2022 年 6 月 30 日
Hi!! I need to do the exact same computation for a project, did you solve it by any chance?
Thank you very much!
回答 (1 件)
David Goodmanson
2022 年 7 月 1 日
Hi Armando/Bianca
Suppose lambda is a 1x3 row vector. The code below is based on the fact that the solution abc (which is the column vector [a b c]' ) must meet two conditions:
lambda*abc = 0
[0 0 1]*abc = 1 % forces c=1
There is a vector n that is perpendicular to both lambda and [0 0 1] and you can have an aribitrary amount x*n of that without affecting the two conditions. So x can be optimized to minimize the quadratic quantity.
F = Fpre;
lam = lambda_1'; % row vector
z = [0 0 1];
n = null([lam;z])';
G = [n; lam; z];
invG = inv(G);
c = [1 0 0]*invG'*F'*F*invG;
x0 = -c(3)/c(1);
abc0 = invG*[x0 0 1]' % the result
S0 = abc0'*F'*F*abc0 % the quantity that is minimized
lam*abc0 % check, should be zero
abc0 =
0.0140
-0.6621
1.0000
S0 = 35.5975
ans = -4.6838e-17
To check for a minimum you can change both a and b such that the two conditions are still satisfied. Note that for da = +-005, S-S0 has the same positive value in both cases, the right result for the bottom of a quatratic well.
da = .005;
db = -lam(1)*da/lam(2); % db s.t. lam*abc is still 0
abc = abc0 + [da db 0]';
S = abc'*F'*F*abc;
S-S0 % should be positive
lam*abc % check, should be 0
ans = 0.0667
ans = -6.0715e-17
da = -.005;
db = -lam(1)*da/lam(2); % db s.t. lam*abc is still 0
abc = abc0 + [da db 0]';
S = abc'*F'*F*abc;
S-S0 % should be positive
lam*abc % check, should be 0
ans = 0.0667
ans = -3.2960e-17
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Quadratic Programming and Cone Programming についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!