How to output and save x1 and x2 after each run / generation?
2 ビュー (過去 30 日間)
古いコメントを表示
I am using the genetic algorithm with a two variable function. I am running gaoptimeset and ga in a loop of a specified number. I want to get the value of x1 and x2 for each generation that the program is ran in one loop. How do I do this? I want to see how the values of x1 and x2 converge to the solution.
Thanks
0 件のコメント
回答 (1 件)
Alan Weiss
2015 年 6 月 25 日
Use an Output Function. For an example (using different solver and syntax, be careful!), see Output Functions in the Optimization Toolbox documentation.
Alan Weiss
MATLAB mathematical toolbox documentation
2 件のコメント
Alan Weiss
2015 年 6 月 29 日
You can get the population at each generation in the state.Population field. See The State Structure. ga passes the state structure to your output function.
Alan Weiss
MATLAB mathematical toolbox documentation
参考
カテゴリ
Help Center および File Exchange で Genetic Algorithm についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!