PySwarms - Open Source Software Contribution

To learn more about collaborative development with version control systems as well as contributing to open source projects on GitHub, I made two contributions to the PySwarms project. PySwarms is a Python module for particle swarm optimization research.

Tools Used

  • Python
  • Jupyter Notebooks
  • Unit Testing with PyTest
  • Git & GitHub

My Contributions

I made the following contributions to the project:

Improved The Plotter Module

View Pull Request on GitHub.

Bug fix: Added ‘z-axis’ to formatters/Designer attribute ‘labels’ to prevent index out of range error when plotting in 3D. Also added a third dimension to ‘limits’ for the same reason.

New feature: I added a colormaps property to the Designer class in formatters.py to allow the user to choose whichever one they want. It uses the same style as other properties of the class, and the module imports matplotlib.cm to validate both types of colormaps in matplotlib. I edited plotters/plot_countour to initialize a Designer object with a default colormap if none is provided. I’ve tested with every category of colormap as well as custom colormaps and verified that it is working as intended.

Default parameter change: Mesher.delta from 0.001 to 0.1. This makes it safe to run many of the functions on an average computer. With 0.001, the mesher object grows very quickly.

Added Objective Functions

View Objective Function Commit on GitHub.

View Pull Request on GitHub.

Download a demo notebook.

I cleaned up and fixed existing functions with TODO tags and implemented Cross-in-Tray, Easom, Eggholder, Himmelblau’s, Holder Table, and Three Hump Camel functions. The file was getting long so I also alphabetized the functions and made a simple table of contents. I also added unit tests for the new objective functions.

Cross-in-Tray Function

Eggholder Function

Easom Function

Himmelblau Function

Holder Table Function

Three Hump Camel Function