MetaHeurOpt
Description
MetaHeurOpt is a modular Python library designed for the execution, benchmarking, and statistical analysis of metaheuristic optimization algorithms. It provides a standardized framework to compare diverse algorithms, ranging from classic evolutionary strategies to modern physics-inspired and swarm intelligence models, on complex continuous optimization problems.
Installation
You can install the stable version of MetaHeurOpt directly from PyPI:
pip install metaheuropt
Usage Example
Below is a quick start guide to comparing solvers. For a more detailed walkthrough, including statistical tables and 3D landscape visualization, check out the /examples/example.ipynb notebook.
import numpy as np
from metaheuropt.solvers import GA, PSO
from metaheuropt.core import Optimizer
from metaheuropt.analysis import ResultsAnalyzer
# 1. Define your objective function
def sphere(x):
return np.sum(np.square(x))
# 2. Configure experiment
dims = 10
bounds = (np.array([-5.12] * dims), np.array([5.12] * dims))
num_runs = 5
max_iter = 100
# 3. Select solvers
solvers = [
GA(bounds=bounds, pop_size=50, max_iter=max_iter),
PSO(bounds=bounds, pop_size=50, max_iter=max_iter),
]
# 4. Run optimization
opt = Optimizer(solvers=solvers, obj_func=sphere, num_runs=num_runs)
opt.run(save_results=True, results_folder="demo_results")
# 5. Analyze and visualize
analyzer = ResultsAnalyzer("demo_results")
analyzer.plot_convergence()
analyzer.perform_stats(full=True)
Available Algorithms
The library currently supports the following high-performance metaheuristics:
| Code | Name | Original Reference |
|---|---|---|
| ABC | Artificial Bee Colony | Karaboga (2007) |
| CMA-ES | Covariance Matrix Adaptation Evolution Strategy | Hansen & Ostermeier (2001) |
| DE | Differential Evolution | Storn & Price (1997) |
| GA | Genetic Algorithm | K. F. Man et al. (1976) |
| GSA | Gravitational Search Algorithm | Rashedi et al. (2009) |
| GWO | Grey Wolf Optimizer | Mirjalili et al. (2014) |
| HHO | Harris Hawks Optimization | Heidari et al. (2019) |
| JADE | Adaptive Differential Evolution with Archive | Zhang & Sanderson (2009) |
| MVO | Multi-Verse Optimizer | Mirjalili et al. (2016) |
| NSGA-II | Non-dominated Sorting Genetic Algorithm II | Deb et al. (2002) |
| PSO | Particle Swarm Optimization | Kennedy & Eberhart (1995) |
| SA | Simulated Annealing | Kirkpatrick et al. (1983) |
| TLBO | Teaching-Learning-Based Optimization | Rao et al. (2011) |
| WOA | Whale Optimization Algorithm | Mirjalili & Lewis (2016) |
Metadata
Release files for metaheuropt 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| metaheuropt-0.1.0.tar.gz | 26.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| metaheuropt-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 62.7 kB
Release files / metaheuropt-0.1.0.tar.gz
| Download URL | metaheuropt-0.1.0.tar.gz |
|---|---|
| Size | 26.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8792ef4fdd4bc24489387d40cf6893e35d01e5a469bc99abffd98b252636811c
|
|
BLAKE2b-256 checksum How to use checksums |
afc14bf8ac8279789b06789e856ade5df81e0741e70633619b1c6ee383b97583
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 25, 2026.
Transparency logRelease files / metaheuropt-0.1.0-py3-none-any.whl
| Download URL | metaheuropt-0.1.0-py3-none-any.whl |
|---|---|
| Size | 36.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bd9dabbe03dc8be4639ff63748d0b62773e1a308ae57bf221f6a5eac6ad380c9
|
|
BLAKE2b-256 checksum How to use checksums |
45e13d314e13c94bf00ac0894be693439c2512d0032f5c8218f9353405996939
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 25, 2026.
Transparency log