Getting error while plotting best fitness, so how do I solve this issue or is there any alternative way to plot it (I am using Genetic Algorithm from Optimization Toolbox)?
1 回表示 (過去 30 日間)
古いコメントを表示
I have used Genetic Algorithm for finding gains of PI controllers. For that purpose Optimization toolbox is used and GA is used as solver.
The optimization and everything seems to run well, but when I try to plot Best Fitness Function while running iterations, it throws following error :
-----------------------------------------------------------------------------------------------
Optimization Running.
Warning: Imaginary parts of complex X and/or Y arguments ignored
Errorrunning optimization.
Complex values are not supported.
-----------------------------------------------------------------------------------------------
And when Best Fitness function plot is not selected, the algorithm runs smoothly without any problem.
For my project I need Best Fitness function plot ? So how do I resolve this error or plot them alternatively.
Screenshot for both the cases is attached...
Any Help is Appreciated...
Thanks & Regards
Sanjeev Gupta
0 件のコメント
回答 (1 件)
Star Strider
2021 年 3 月 8 日
That plots the output of your fitness function, and I find it interesting that complex results even work in that context.
I have no idea what your fitness function does, however if it is calculating the square root of a negative number or taking the logarithm of a negative number, or something similar, it would likely be best to constrain the parameters (or do whatever else may be necessary) to avoid those, to be certain that it is not generating complex results.
The algorithm may run smoothly, however it may not be doing what you want it to do.
0 件のコメント
参考
カテゴリ
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!