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)?

조회 수: 2 (최근 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

답변 (1개)

Star Strider
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.

카테고리

Help CenterFile Exchange에서 Genetic Algorithm에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by