Genetic algorithm optimisation toolbox

4 ビュー (過去 30 日間)
Balaji L
Balaji L 2019 年 3 月 21 日
コメント済み: Walter Roberson 2019 年 6 月 26 日
I have set of 50 equations like z1=a1(x1)+b1(x2)+c1(x3)+d1(x4) to z50=a50(x1)+b50(x2)+c50(x3)+d50(x4) . I need to optimise the weights of variables x1,x2,x3,x4 which should be bound to [1 to 5]. The value z1 to z50 varies between 140 to 180. Coefficient (a1 ,b1 ,c1,d1) to (a50,b50,c50,d50) also varies between 1 to 10. How to get solution using ga in optimisation toolbox or any other methods?
  10 件のコメント
Walter Roberson
Walter Roberson 2019 年 3 月 21 日
I do not understand what the 0.2419 correlation is measuring or how Y fits into all of this??
Balaji L
Balaji L 2019 年 3 月 21 日
0.2419 is correlation betweeen Z(H2:H11) and Y(I2:I11). Value Z is arrived through equation (Ax1+Bx2+Cx3+Dx4+Ex5+Fx6+Gx7=Z), The Values of Y(I2:I11) should not be changed. Need to get optimal solution for (x1,x2,..x7) such that correlation between Z and Y is to be a maximum one.

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

採用された回答

Walter Roberson
Walter Roberson 2019 年 3 月 21 日
編集済み: Walter Roberson 2019 年 3 月 21 日
nvar = 7;
T = readtable('Attachment.xls');
W = T{:,1:nvar};
Y = T.Y;
obj = @(x) -corr(W*x.', Y);
A = []; b = [];
Aeq = []; beq = [];
lb = ones(1,nvar); ub = 5*ones(1,nvar);
x0 = 2*lb;
[x_fmincon, fval_fmincon] = fmincon(obj, x0, A, b, Aeq, beq, lb, ub);
corr_reached_fmincon = -fval_fmincon;
[x_ga, fval_ga] = ga(obj, nvar, A, b, Aeq, beq, lb, ub);
corr_reached_ga = -fval_ga;
If you try the ga several times you might be able to get a result marginally better than what fmincon achieves, but only barely so. However, the weights might be quite different especially for the 2nd and 3rd variable.
  5 件のコメント
Balaji L
Balaji L 2019 年 6 月 24 日
Untitled.jpg
Walter Roberson
Walter Roberson 2019 年 6 月 26 日
Do not name your file fmincon.m . Doing that makes it impossible for the script to call MATLAB's fmincon.m

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGenetic Algorithm についてさらに検索

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by