Appendix B

Matlab Programs

The following codes intend to demonstrate how each algorithm works, so they are relatively simple and we do not intend to optimize them. They are not for general-purpose optimization, because there are much better programs out there, both free and commercial, for that task. These codes should work using Matlab.1 For Octave,2 slight modifications may be needed.

B.1 Simulated Annealing

image

image

B.2 Particle Swarm Optimization

image

Get Nature-Inspired Optimization Algorithms now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.