- Ensure that your objective function always returns finite real values, by carefully debugging it, OR
- Pass an initial swarm where every point returns a real finite value. See the InitialSwarmMatrix option in particleswarm options.
What is the correction of error: Failure in initial user-supplied objective function evaluation. PARTICLESWARM cannot continue?
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MOSAB YOUSIF
am 24 Apr. 2018
Kommentiert: sks2
am 18 Apr. 2020
I'm trying to solve an optimization problem using PARTICLESWARM function in MATLAB2014b. with aid of Open Source ECG Toolbox, version 1.0, November 2006 Released under the GNU General Public License.
The main objective of the code is to find the optimal parameters of the ECG model to achieve the minimum model error.
I have used PSO as optimizer to find these optimal parameters.
ends up with error:
Failure in initial user-supplied objective function evaluation. PARTICLESWARM cannot continue
0 Kommentare
Akzeptierte Antwort
Alan Weiss
am 24 Apr. 2018
Without reading your code, I can tell you that your initial swarm contained at least one point that led to a NaN or Inf or complex objective function value. To avoid this error,
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
4 Kommentare
sks2
am 18 Apr. 2020
This has perplexed me for a few weeks now.
The answer is to make sure your objective function can return a vector that is sized M x 1.
Vectorized particleswarm
If your objective function can evaluate all the particles at once, you can usually save time by setting the UseVectorized option to true. Your objective function should accept an M-by-N matrix, where each row represents one particle, and return an M-by-1 vector of objective function values. This option works the same way as the patternsearch and ga UseVectorized options. For patternsearch details, see Vectorize the Objective and Constraint Functions.
Reference this link: https://www.mathworks.com/help/gads/particle-swarm-options.html#bued1yt-1
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Get Started with Optimization Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!