Genetic Algorithm Calculation steps
古いコメントを表示
Dear All,
i am using Genetic Algorithm throught optimization toolbox. my optimization problem is little complicated as a lot of dependent variables are to be calculated, and they are defined on five m.files.
i want to show the calculations steps on detailes that are done on each trail of optimization process. this is important for me to understand how the algorithm think and do what before what and how it transfere from one file to another, so, i can adjust my code. if it possible, how can i do that.
what i want is not the general steps of Genetic Algorithm, i want to show the steps actualy performed by my code after i run it.
thank you a lot.
5 件のコメント
Mario Malic
2020 年 9 月 24 日
編集済み: Mario Malic
2020 年 9 月 24 日
See Input Arguments - Options of ga. Set to 'iter' or diagnose, if that's what you looking for.
Display
Level of display.
'off' | 'iter' | 'diagnose' | {'final'}
If you're looking for more than this output, you can always use disp or fprint or write your own OutputFcn (Edit: somehow I missed to write this) function in your anonymous objective function.
Nourhan Elsayed
2020 年 9 月 27 日
Walter Roberson
2020 年 9 月 27 日
Note that OutputFcn does not show the result of every call to the objective function. It is called every iteration, but there are reasons why iterations might call the objective function multiple times. This is more of an issue for fmincon() and other minimizers that do gradient or hessian estimation -- but even for ga, the first (NVARS+1) calls to the objective function are used to create a simplex for further use and are not counted as being part of the iterations.
Nourhan Elsayed
2020 年 9 月 27 日
Walter Roberson
2020 年 9 月 27 日
At the beginning, in order to create the initial simplex, for continuous variables the code uses something like:
if lower bound is in effect
LB = lowerbound
else
LB = zeros(1, nvars);
end
F = zeros(1,nvars+1);
F(1) = objective(LB);
for K = 1 : nvars
lb = LB;
lb(K) = lb(K) + 0.1;
F(K+1) = objective(lb);
end
This takes an initial point and then evaluates nvars more times, each time varying exactly one of the parameters a small distance away from the initial point.
For discrete variables it would uses the minimum discrete values for LB and modify each in turn to its second valid discrete value.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Genetic Algorithm についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!