Link Search Close Search Menu Expand Document

Particle Swarm Optimization on Non-Convex Function

In the previous example we saw the details of Particle Swarm Optimization (PSO) and how it performs on a convex function.

Particle swarm can be used to efficiently find the global minima of non-convex functions.

In this example, we will use a non-convex function which has local minima and global minima and see how particle swarm performs on it.

This non-convex function is defined as: $$ (1 - x/2 + x^5 + y^3) * e^{(-x^2 - y^2)} $$ Where $ x, y \in (-3, 3) $

This function has a local minima at (0.11, -1.46, -0.25) and a global minima at (-1.69, 0, -0.69)

We can see the visualization of this function below:

Figure 1: Non-convex function having a global and a local minima

Below animation shows how PSO performs on this function:

Figure 2: Particle swarm optimization on non-convex 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 Non-Convex Function



Back to top

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