Positive definite matrix, least square minimization
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
Hi, I am trying to solve a constrained least square minimization problem, which will give me a X_{vec}=(15 x 1) matrix. I will be later converting these 15 elements to a symmetric (5 x 5) matrix called X. Is there any way to constriant the elements of the solution X_{vec} of the constrained LSQ minimization problem such that my X will be a positive definite matrix? Thanks a lot in advance!
댓글 수: 1
I use lsqlin() to solve my constrained least square minimization problem.
채택된 답변
Add the constraints that the five sub-determinants of X have to be positive and use fmincon to solve.
Best wishes
Torsten.
댓글 수: 15
Hi, Torsten, Thank you for your quick response. Kindly please tell me why you suggest fmincon solver instead of lsqlin?
lsqlin can not handle nonlinear constraints which result from the conditions on the submatrices.
Best wishes
Torsten.
my constriants are linear are like, x1>0, x2<0, x3<0, x1+x2+x3>0.
Your constraints are
X_11 > 0
X_11*X_22-X_12*X_21 > 0
etc.
which are nonlinear in the matrix coefficients.
Best wishes
Torsten.
oh sorry, I was mentioning the constriants of my original problem, I missed the new constraints for subdeterminants to be positive which are nonlinear.
Thank you so much. But I guess finding sub determinants for 5 x 5 matrix is tough.
Thank you for your time :)
Not that tough:
det(X(1:1,1:1)) > 0
det(X(1:2,1:2)) > 0
det(X(1:3,1:3)) > 0
det(X(1:4,1:4)) > 0
det(X(1:5,1:5)) > 0
Best wishes
Torsten.
Thank you so much :)
Hi,
I did the following
myfun = @(x) 0.5 * (norm(C*x - d))^2;
%[x,fval]=fmincon(myfun,x0,AA,bb);%without nonlinear constraints
nonlcon=@mynon;
[x,fval]=fmincon(myfun,x0,AA,bb,[],[],[],[],nonlcon);
function [c,ceq]=mynon(x)
c=[-x(1);
-det([x(1) x(2);x(2) x(6)]);
-det([x(1) x(2) x(3);x(2) x(6) x(7);x(3) x(7) x(10)]);
-det([x(1) x(2) x(3) x(4);x(2) x(6) x(7) x(8);x(3) x(7) x(10) x(11);x(4) x(8) x(11) x(13)]);
-det([x(1) x(2) x(3) x(4) x(5);x(2) x(6) x(7) x(8) x(9);x(3) x(7) x(10) x(11) x(12);x(4) x(8) x(11) x(13) x(14);x(5) x(9) x(12) x(14) x(15)]);];
ceq=[];
Where AA and bb related to linear inequality constriants. Aeq=[], beq=[] lb=[],ub=[]. Kindly note that matrix X is a 5 x 5 symmetric matrix and constructed out of elements of vector x which is 15 x 1 (no repeating elements).
Optimization using fmincon is not giving any error. However, the matrix I get is not positive definite :(.
Please help! where did I go wrong!
What are the values for the 5 determinants you get from the final solution ?
Best wishes
Torsten.
Please see the nonpositive definite matrix X that I got as below
X=[ 0.9581 -0.0000 -0.0000 0.0236 -0.3652
-0.0000 0.1237 0.1707 0.1595 0.2443
-0.0000 0.1707 0.3126 0.4316 0.2893
0.0236 0.1595 0.4316 0.0092 0.1186
-0.3652 0.2443 0.2893 0.1186 0.4588
];
oned=det(X(1:1,1:1))
twod=det(X(1:2,1:2))
threed=det(X(1:3,1:3))
fourd= det(X(1:4,1:4))
fived=det(X(1:5,1:5))
eig(X)
oned =
0.9581
twod =
0.1185
threed =
0.0091
fourd =
-0.0071
fived =
0.0013
ans =
-0.3122
-0.0282
0.1499
0.8290
1.2240
Strengthening the variable TolCon might help.
Best wishes
Torsten.
Dear Torsten
Thank you so much for your time. MIne is an iterative process, and so I tried pausing in each iteration. here is what I get
Warning: The default trust-region-reflective algorithm does not solve problems with the constraints you have specified. FMINCON will use the active-set algorithm instead. For information on applicable algorithms, see Choosing the Algorithm in the documentation. > In fmincon at 504 In sir7 at 148 Warning: Your current settings will run a different algorithm (interior-point) in a future release. > In fmincon at 509 In sir7 at 148
Solver stopped prematurely.
fmincon stopped because it exceeded the function evaluation limit, options.MaxFunEvals = 1500 (the default value).
Thanks alot for your time.
I tried changing options using following
options = optimoptions('fmincon','Algorithm','sqp');
options=optimoptions(options,'Tolx',1e-10)
options.MaxFunEvals = 3000;%default=1500
options.TolCon=1.0000e-4;%default=1.0000e-9
but still the matrix output is not positive definite !!!
1. If possible, start with a feasible solution.
2. Strengthening the tolerances means: Choose a smaller value than the default (i.e. options.TolCon < default value)).
Best wishes
Torsten.
Thank you Torsten for your kind suggestions and time :)
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Problem-Based Nonlinear Optimization에 대해 자세히 알아보기
참고 항목
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
