Optimization - find a max on a complicated function
조회 수: 9 (최근 30일)
이전 댓글 표시
for my optimiztion problem... I'm using the eigenvalue of a simetric matrix as part of my function, so I dont know to use GD to salve this problem.
I'm definving a matrix Lt like so, where L1, L2 are the normalized Laplacian matrix of 2 conection graths (with the same V but different E).
% 0 <= t1 <= 1
Lt_func = @(t1) t1*L1 + (1-t1)*L2;
The prublem is that I want to find t1 that give Lt it the biggest eigenvalue (Find what combination will give me the maximum).
I have plot the problem it, and it seem like a convex problem.
lambda1_Lt = zeros(1,1001);
ii = 1;
for t = 0:1/(size(lambda1_Lt,2)-1):1
[vector,value] = eig(Lt_func(t));
value = value * ones(size(value,1),1);
lambda1_Lt(ii) = value(2);
ii = ii + 1;
end
Is there an optimiztion tool in matlab for a problem like so?
later i need to extend the problem to 3 normalized Laplacian matrixs. so the problem will expand into 2 variables problem Lt_func = @(t1,t2). can the optimiztion tool can be extended into the this problem as well?
댓글 수: 0
답변 (1개)
John D'Errico
2022년 7월 23일
편집: John D'Errico
2022년 7월 23일
You maximize a function using a tool that minimizes it, by finding the minimum of -f(x).
How to do it? Use fminbnd. Set the bounds as [eps,1-eps] to avoid the singularities.
For two variables, you can use zillions of codes. The optimization toolbox fmincon seems the first choice. Again, just set the bounds.
Note that for two or more variables, you treat the problem as a function of a variable that is a VECTOR of length 2. Unpack the vector inside your function into t1 and t2 as you desire.
If you lack the optimization TB, then you can use my fminsearchbnd, as found on the FIle Exchange.
참고 항목
카테고리
Help Center 및 File Exchange에서 Nonlinear Optimization에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!