Skip to main content

Black Widow Optimization

Project description

Black Widow Optimization

gh-actions-ci GitHub license PyPI pyversions PyPi Version

From the abstract: ...a novel meta-heuristic algorithm suitable for continuous nonlinear optimization problems. The proposed method, Black Widow Optimization Algorithm (BWO), is inspired by the unique mating behavior of black widow spiders. This method includes an exclusive stage, namely, cannibalism. Due to this stage, species with inappropriate fitness are omitted from the circle, thus leading to early convergence. BWO algorithm is evaluated on 51 various benchmark functions to verify its efficiency in obtaining the optimal solutions for the problems. The obtained results indicate that the proposed algorithm has numerous advantages in different aspects such as early convergence and achieving optimized fitness value compared to other algorithms.

Installation

pip install bwo

or

pip install git+https://github.com/nathanrooy/bwo

Usage

As a simple example, let's find the minimum of the single objective sphere function availabel in the Landscapes Python package.

pip install landscapes

Next, let's import everything we need.

from bwo import minimize
from landscapes.single_objective import sphere

Now, we just need to call the minimize function. For this particular example, let's optimize across 5 degrees of freedom.

fbest, xbest = minimize(sphere, dof=5)

Where fbest is the best function value achieved during optimization, and xbest is the function input which yielded fbest.

You can also minimize a function given boundry constraints, represented by a list of tuples. Each tuple must follow the (min, max) format.

bounds = [(-1,1),(-2,2), (-3,3), (-4,4), (-5,5)]
fbest, xbest = minimize(sphere, bounds=bounds, disp=False)

Options

minimize(func, x0=None, dof=None, bounds=None, pp=0.6, cr=0.44, pm=0.4, npop=10, disp=False, maxiter=50)

  • func (callable) : The objective function to be minimized.
  • x0 (list) : Initial guess (optional).
  • dof (int) : degrees of freedom (optional)
  • bounds(list of tuples) : boundary constraints as specified as a list of (xi_min, xi_max) tuples.
  • pp (float) : procreating percentage [0, 1].
  • cr (float) : cannibalism rate [0, 1].
  • pm (float) : mutation rate [0, 1].
  • maxiter (int) : maximum number of iterations.
  • disp (bool) : output intermediate results at each iteration.

References

@article{article,
author = {Hayyolalam, Vahideh and Pourhaji Kazem, Ali Asghar},
year = {2019},
month = {10},
pages = {103249},
title = {Black Widow Optimization Algorithm: A novel meta-heuristic approach for solving engineering optimization problems ✩},
volume = {87},
journal = {Engineering Applications of Artificial Intelligence},
doi = {10.1016/j.engappai.2019.103249}
}

Project details


Download files

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

Source Distribution

bwo-0.1.2.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

bwo-0.1.2-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file bwo-0.1.2.tar.gz.

File metadata

  • Download URL: bwo-0.1.2.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

File hashes

Hashes for bwo-0.1.2.tar.gz
Algorithm Hash digest
SHA256 0cd085a02cfde5f48c728c7a55d89b287210742f2d7739e6424891607b31d281
MD5 ca666dcfc83dd52b34b40769c0ee2381
BLAKE2b-256 cfdd177660a3a2d58622a15a2c8908fc1a85d39bede2ede6c9d7f6c123b75377

See more details on using hashes here.

File details

Details for the file bwo-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: bwo-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

File hashes

Hashes for bwo-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7da03c61de8e5c69cecbd01da102a25c469d5c20c7fb3be5248e2617c836660d
MD5 6eb15cf330368800fbbde950e29be8a7
BLAKE2b-256 5523f9c590de80716925dd72a807897d48d4e4e7dc62c3da98c28a1a986a36f9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page