Skip to main content

Python micro framework for building nature-inspired algorithms.

Project description

Unix Build Status Windows Build status PyPI Version PyPI - Python Version PyPI - Status PyPI - Downloads GitHub Release Date Anaconda-Server Badge Documentation Status GitHub license

Scrutinizer Code Quality Coverage Status GitHub commit activity Updates Average time to resolve an issue Percentage of issues still open GitHub contributors



Nature-inspired algorithms are a very popular tool for solving optimization problems. Numerous variants of nature-inspired algorithms have been developed since the beginning of their era. To prove their versatility, those were tested in various domains on various applications, especially when they are hybridized, modified or adapted. However, implementation of nature-inspired algorithms is sometimes a difficult, complex and tedious task. In order to break this wall, NiaPy is intended for simple and quick use, without spending time for implementing algorithms from scratch.


Our mission is to build a collection of nature-inspired algorithms and create a simple interface for managing the optimization process.
NiaPy will offer:
  • numerous benchmark functions implementations,
  • use of various nature-inspired algorithms without struggle and effort with a simple interface,
  • easy comparison between nature-inspired algorithms and
  • export of results in various formats (LaTeX, JSON, Excel).


Python micro framework for building nature-inspired algorithms. Official documentation is available here.

The micro framework features following algorithms:

  • basic:
    • Artificial bee colony algorithm
    • Bat algorithm
    • Camel algorithm
    • Cuckoo search
    • Differential evolution algorithm
    • Evolution Strategy
    • Firefly algorithm
    • Fireworks algorithm
    • Flower pollination algorithm
    • Forest optimization algorithm
    • Genetic algorithm
    • Glowworm swarm optimization
    • Grey wolf optimizer
    • Monarch butterfly optimization
    • Moth flame optimizer
    • Harmony Search algorithm
    • Krill herd algorithm
    • Monkey king evolution
    • Multiple trajectory search
    • Particle swarm optimization
    • Sine cosine algorithm
  • modified:
    • Hybrid bat algorithm
    • Self-adaptive differential evolution algorithm
    • Dynamic population size self-adaptive differential evolution algorithm
  • other:
    • Anarchic society optimization algorithm
    • Hill climbing algorithm
    • Multiple trajectory search
    • Nelder mead method or downhill simplex method or amoeba method
    • Simulated annealing algorithm

The following benchmark functions are included in NiaPy:

  • Ackley
  • Alpine
    • Alpine1
    • Alpine2
  • Bent Cigar
  • Chung Reynolds
  • Csendes
  • Discus
  • Dixon-Price
  • Elliptic
  • Griewank
  • Happy cat
  • HGBat
  • Katsuura
  • Levy
  • Michalewicz
  • Perm
  • Pintér
  • Powell
  • Qing
  • Quintic
  • Rastrigin
  • Ridge
  • Rosenbrock
  • Salomon
  • Schumer Steiglitz
  • Schwefel
    • Schwefel 2.21
    • Schwefel 2.22
  • Sphere
    • Sphere2 -> Sphere with different powers
    • Sphere3 -> Rotated hyper-ellipsoid
  • Step
    • Step2
    • Step3
  • Stepint
  • Styblinski-Tang
  • Sum Squares
  • Trid
  • Weierstrass
  • Whitley
  • Zakharov



  • Python 3.6.x or 3.7.x (backward compatibility with 2.7.x)
  • Pip


  • numpy >= 1.16.2
  • scipy >= 1.2.1
  • enum34 >= 1.1.6 (if using python version < 3.4)
  • xlsxwriter >= 1.1.6
  • matplotlib >= 2.2.4

List of development dependencies and requirements can be found in the installation section of NiaPy documentation.


Install NiaPy with pip:

$ pip install NiaPy

Install NiaPy with conda:

$ conda install -c niaorg niapy

Or directly from the source code:

$ git clone
$ cd NiaPy
$ python install


After installation, the package can imported:

$ python
>>> import NiaPy
>>> NiaPy.__version__

For more usage examples please look at examples folder.


Open Source Helpers

We encourage you to contribute to NiaPy! Please check out the Contributing to NiaPy guide for guidelines about how to proceed.

Everyone interacting in NiaPy’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the NiaPy code of conduct.


This package is distributed under the MIT License. This license can be found online at


This framework is provided as-is, and there are no guarantees that it fits your purposes or that it is bug-free. Use it at your own risk!

Revision History

## 2.0.0rc5 (May 6, 2019)

  • fixes and improvements of algorithm interface
  • various algorithm implementation fixes
  • add support for Python 3.7
  • documentation fixes
  • introduced maximization
  • added algorithms: - Fish School Search - Coral Reefs Optimization - Cuckoo Search - Forest Optimization Algorithm - Monarch Butterfly Optimization
  • update runner utility
  • update examples
  • various bugfixes

2.0.0rc4 (Nov 30, 2018)

  • fix dependecies versions

2.0.0rc3 (Nov 30, 2018)

  • added moth flame optimizer
  • added new examples
  • documentation updates
  • PSO and BBFWA algorithms fixes
  • stopping conditions fixes
  • added new test cases
  • added multiple seed option
  • various bugfixes

2.0.0rc2 (Aug 30, 2018)

  • fix PyPI build

2.0.0rc1 (Aug 30, 2018)

Changes included in release:

  • Added algorithms:
    • basic:
      • Camel algorithm
      • Evolution Strategy
      • Fireworks algorithm
      • Glowworm swarm optimization
      • Harmony search algorithm
      • Krill Herd Algorithm
      • Monkey King Evolution
      • Multiple trajectory search
      • Sine Cosine Algorithm
    • modified:
      • Dynamic population size self-adaptive differential evolution algorithm
    • other:
      • Anarchic society optimization algorithm
      • Hill climbing algorithm
      • Multiple trajectory search
      • Nelder mead method or downhill simplex method or amoeba method
      • Simulated annealing algorithm
  • Added benchmarks functions:
    • Discus
    • Dixon-Price
    • Elliptic
    • HGBat
    • Katsuura
    • Levy
    • Michalewicz
    • Perm
    • Powell
    • Sphere2 -> Sphere with different powers
    • Sphere3 -> Rotated hyper-ellipsoid
    • Trid
    • Weierstrass
    • Zakharov
  • breaking changes in algorithms structure
  • various bugfixes

1.0.2 (Oct 24, 2018)

  • fix Bat and Hybrid Bat algorithms

1.0.1 (Mar 21, 2018)

This release reflects the changes from Journal of Open Source Software (JOSS) review: - Better API Documentation - Clarification of set-up requirements in README - Improved paper

1.0.0 (Feb 28, 2018)

  • stable release 1.0.0

1.0.0rc2 (Feb 28, 2018)

  • fix PyPI build

1.0.0rc1 (Feb 28, 2018)

  • version 1.0.0 release candidate 1
  • added 10 algorithms
  • added 26 benchmark functions
  • added Runner utility with export functionality

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for NiaPy, version 2.0.0rc5
Filename, size File type Python version Upload date Hashes
Filename, size NiaPy-2.0.0rc5-py3-none-any.whl (188.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size NiaPy-2.0.0rc5.tar.gz (121.5 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page