Optimization - find a max on a complicated function

3 ビュー (過去 30 日間)
Dan Ilan BEN DAVID
Dan Ilan BEN DAVID 2022 年 7 月 23 日
コメント済み: Dan Ilan BEN DAVID 2022 年 7 月 23 日
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?

回答 (1 件)

John D'Errico
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.
  1 件のコメント
Dan Ilan BEN DAVID
Dan Ilan BEN DAVID 2022 年 7 月 23 日
fminsearchbnd was more suitable to what i was testing.
  1. define the complicated function
  2. input the pointer to the function, with starting point and limits
  3. got a loss of less then 10^-5
thx you very mush :)

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeNonlinear Optimization についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by