How to use both pswplotbestf and pswplotranges for particleswarm?
显示 更早的评论
I've noticed that having both 'pswplotranges' as 'OutputFcn' and 'pswplotbestf' as 'PlotFcn' in the particleswarm option enabled does not work. It appears that it's only possible to get either one of the plots from an optimization. Is there a way to get both? Thank you.
1 个评论
Ashutosh
2023-8-16
The use of "pswplotranges” as the "OutputFcn” and "pswplotbestf” as the "PlotFcn" in the "particleswarm" options does not work is due to way the Particle Swarm Optimization algorithm handles the plotting.
The issue arises when using both options of "pswplotranges" as the "OutputFcn" and " pswplotbestf " as the "PlotFcn". These two functions are designed to generate different types of plots. "pswplotranges" generates a range plot that shows the range of particle positions at each iteration, while "pswplotbestf" generates a plot showing the best function value over iterations.
Since both functions are intended to generate plots, there is a conflict in how they are called and handled by the "particleSwarm" algorithm. The algorithm is designed to handle either an "OutputFcn" or a "PlotFcn", but not both simultaneously. As a result, when both functions are specified, it leads to errors or unexpected behavior.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Optimization Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

