why ga does not respect upper bounds ?

1 回表示 (過去 30 日間)
HML
HML 2021 年 5 月 7 日
コメント済み: John D'Errico 2021 年 5 月 7 日
hi,
I'm surprise by the results of my genetic algorithm that I use to find the minimum of my cost function.
fun = @gestion1;
lb = [10 100 1e3 100 300 800 400];
ub = [40 1e6 1e6 1e6 1e4 1e4 9000];
Intcon = [1 2 3 4 5 6 7 8];
eff_pv = 0.2;
A = [-eff_pv*Epv 0 0 0 0 0 0 0];
b = -Echarge;
options = optimoptions('ga','FunctionTolerance',10,'UseParallel',true,'Display','Iter');
[x, fval] = ga(fun,8,A,b,[],[],lb,ub,[],Intcon,options);
and this is my result:
x = [13 3703 31408 12972 349 1038 1027 10212]
As you can see, x(8) is clearly above ub(8).
Can someone explain me why ?
Thank you for your help

採用された回答

John D'Errico
John D'Errico 2021 年 5 月 7 日
編集済み: John D'Errico 2021 年 5 月 7 日
Um,
ub = [40 1e6 1e6 1e6 1e4 1e4 9000];
numel(ub)
ans = 7
I can count, but I let MATLAB do it for me. As you should see, you posed only 7 (SEVEN) bounds on your variables. the 8th variable was left unconstrained. So what should you expect?
ga is very respectful. But you need to tell it what you want. Mindreading is not among its strong points. :)
  2 件のコメント
HML
HML 2021 年 5 月 7 日
編集済み: HML 2021 年 5 月 7 日
Ooups...
Looking it for several minutes and didn't see it.
Thank you
John D'Errico
John D'Errico 2021 年 5 月 7 日
No problem. In one of the papers I wrote many years ago, I made a simple error in the very first formula. It was one of those boilerplate things that you look at and because you know exactly what it should be, your eyes pass right over it. Then I gave it to my colleague to proofread. He also did not see the error, because he knew what it should say, and since we had both seen the same thing so many times, neither of us looked at it, instead, just knowing what it should be.
Sometimes, simple things get past you.

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by