Particle Swarm Optimization (PSO) for Python
Project description
PySwarm
Particle Swarm Optimization (PSO) for Python
pyswarm is a gradient-free, evolutionary optimization library for Python that implements Particle Swarm Optimization (PSO) with built-in support for constraints. It is lightweight, easy to use, and suitable for a wide range of optimization problems where gradient information is unavailable or impractical to compute.
Quick example
import numpy as np
from pyswarm import pso
def objective(x):
x1, x2 = x
return x1**4 - 2 * x2 * x1**2 + x2**2 + x1**2 - 2 * x1 + 5
lb = [-3, -1]
ub = [2, 6]
xopt, fopt = pso(objective, lb, ub)
print("Optimal solution:", xopt)
print("Function value:", fopt)
Installation
pip install pyswarm
Requires Python 3.10+. No external runtime dependencies. See the full installation guide for uv, poetry, and source builds.
Documentation
- Theory — mathematical background, hierarchical basis, algorithms
- Quickstart — runnable examples
- API Reference — class and function signatures
- References — literature citations
License
BSD-3-Clause — see LICENSE.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyswarm-0.8.0.tar.gz.
File metadata
- Download URL: pyswarm-0.8.0.tar.gz
- Upload date:
- Size: 100.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c61e9a7cb5c37746893885f05fdb17cd66140d0a4269e7aee8a75388f684fc91
|
|
| MD5 |
43db3e99314046e58d74a8387f010b66
|
|
| BLAKE2b-256 |
65437df739763e5cad18671f7db6d8401d6fad74fcb6ef3fedf4d189f2b0357a
|
Provenance
The following attestation bundles were made for pyswarm-0.8.0.tar.gz:
Publisher:
publish_dist.yml on eggzec/pyswarm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyswarm-0.8.0.tar.gz -
Subject digest:
c61e9a7cb5c37746893885f05fdb17cd66140d0a4269e7aee8a75388f684fc91 - Sigstore transparency entry: 1338833845
- Sigstore integration time:
-
Permalink:
eggzec/pyswarm@a5be41a124c510cb6ea8516015a60f8181dfb8a0 -
Branch / Tag:
refs/tags/v0.8.0 - Owner: https://github.com/eggzec
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_dist.yml@a5be41a124c510cb6ea8516015a60f8181dfb8a0 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pyswarm-0.8.0-py3-none-any.whl.
File metadata
- Download URL: pyswarm-0.8.0-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd23ec7fc4a7c1f5ed99b01ac06f3012cc201a6e4f9cd7a9651590d7bd0c51f5
|
|
| MD5 |
4ec753a50e9b16d4bd31c5eed56b309c
|
|
| BLAKE2b-256 |
c0ddb617da5adb6a1c42224b9eedd7e00843dcc2e286cda50f20b0835b79d2c8
|
Provenance
The following attestation bundles were made for pyswarm-0.8.0-py3-none-any.whl:
Publisher:
publish_dist.yml on eggzec/pyswarm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyswarm-0.8.0-py3-none-any.whl -
Subject digest:
fd23ec7fc4a7c1f5ed99b01ac06f3012cc201a6e4f9cd7a9651590d7bd0c51f5 - Sigstore transparency entry: 1338833848
- Sigstore integration time:
-
Permalink:
eggzec/pyswarm@a5be41a124c510cb6ea8516015a60f8181dfb8a0 -
Branch / Tag:
refs/tags/v0.8.0 - Owner: https://github.com/eggzec
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_dist.yml@a5be41a124c510cb6ea8516015a60f8181dfb8a0 -
Trigger Event:
release
-
Statement type: