Link Search Close Search Menu Expand Document

Particle Swarm Optimization on Non-Convex Function

We saw how particle swarm optimization(PSO) works on convex function and a non-convex function
In this example, we will see how PSO performs on another non-convex function called Six-Hump Camel Back Function

This function is defined as: $$ (4 - 2.1 * x^2 + x^4 / 3) * x^2 + x * y + (-4 + 4 * y^2) * y^2 $$

Where $ x \in (-3, 3), y \in (-2, 2) $

The function has six local minima, two of which are global. Two equi-valued global minima are at (0.09, -0.71, -1.03) and (-0.09, 0.71, -1.03).
We can see that the global minima value is -1.03 for x and y values of (0.09, -0.71) and (-0.09, 0.71).

Visualization of Six-Hump Camel Back Function is below:

Figure 1: Six-hump camel back function

If we run PSO on this function, it will converge at either of the two global minima. We can see PSO in action in the below animation:

Figure 2: Particle swarm optimization on six-hump camelback function


Below program uses pyswarms library to find the minima of this non-convex function. To install this library we can follow the steps at Installation

Implementation of Particle Swarm Optimization on Six-Hump Camel Back Function



Back to top

Copyright © 2020-2021 Gajanan Bhat. All rights reserved.