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!