comparison between two optimisation algorithms
29 views (last 30 days)
Show older comments
good morning,
I want to find an optimal value that minimises my single-variable function. I have used the genetic algorithm (single objective).
In order to validate my results I used the PSO algorithm for a comparison, I found the same results.
Is my choice for PSO correct, or is PSO used for a function with several variables?
this is my function:
f = @(x) 1.002 - ((1 - exp(- 0.00003*x))./(0.00003*(x + 1.5) + (0.00063*(1 - exp(- 0.00003*x)))));
x=[24,720]
xmin = 315.7286
fmin = 0.0120
1 Comment
Answers (1)
John D'Errico
on 12 Jun 2025 at 14:46
Edited: John D'Errico
on 12 Jun 2025 at 14:50
There are very, very many ways to solve a computing problem. You have chosen one of them, and it worked for you.
Is the choice you made inadequate? Does it take too long to run? Does it give the correct result? If there are no problems, then why should you care?
NEVER spend the time to solve a problem that does not exist. Use your mental energy and time to solve the next problem.
Along the eway, you will surely learn some of the characteristics of different algorithms, and why on a larger, more difficult problem, one may be preferable over another. (A multi-variable solver can always solve a single variable problem, but the reverse is not true.) You would probably learn when to recognize that a solver has failed, and how it may fail, and how to identify such failures, etc. All that goes way beyond a simple answer of course. It is better found in a complete course on numerical methods, even one on the theory of optimization, perhaps where you would learn the subtle and not so subtle differences between various methods.
In this case, on this specific problem, the method you will choose is pretty much irrelevant. I'd probably have suggested you use fminbnd, the method in MATLAB targeted to solve single variable minimization problems. As also suggested, fminsearchbnd will work. As you found of course, other methods will work too. But if you are worrying about finding the perfect method, don't bother. There is no perfect method, perfectly correct for all problems. Computing should be about solving your problem, and then moving on to the next one.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!