Skip to main content

eeea-py

Python Version License: GPL v3


Overview

eeea-py is a Python package that implements Explicit Exploration strategies with the Estimation of Multivariate Normal Algorithm (EMNA) and other metaheuristics for continuous optimization. It is the Python port of the EEEA package originally developed for R.

The library introduces an explicit exploration mechanism that systematically diversifies the population across the search space, addressing the premature convergence problems common in standard evolutionary approaches.


Why eeea-py?

Standard metaheuristics rely on implicit exploration driven solely by stochastic operators. This can lead to premature convergence to suboptimal solutions, especially in multimodal landscapes where diversity in the initial population is critical.

eeea-py addresses this through a dedicated explicit exploration phase (EES) that systematically samples the search space until its distribution stabilizes, providing a statistically representative starting population. This initialization can then be paired with EDAs or other metaheuristics to improve convergence quality.


Key Features

  • Explicit Exploration Strategy (EES): Population initialization based on distributional stability of fitness values across deciles, independent of the main optimization loop.
  • Configurable initialization: All metaheuristic algorithms (EMNA, GWO, PSO) support both standard random initialization and EES via a method parameter.
  • Multivariate normal modeling (EMNA): Learns the structure of the selected population at each generation using a multivariate Gaussian distribution with truncation selection.
  • Adaptive exploration in GWO: The a parameter decay supports linear, exponential, and adaptive schedules.
  • Unified result format: All algorithms return a consistent dictionary with best_individual, best_fitness, last_population, last_fitness, and history.
  • Reproducibility: All algorithms accept a seed parameter for deterministic runs.
  • Vectorized implementations: Built on NumPy for computational efficiency.

Installation

From Source

git clone https://github.com/rogelio-sg/eeea-py.git
cd eeea-py
pip install -e .

Requirements

  • Python 3.9+
  • NumPy 2.2.6

Implemented Algorithms

Explicit Exploration Strategy (EES)

Population initialization method that generates a representative initial population by iteratively sampling the search space until the distribution of fitness values stabilizes.

from eeea_py.algorithms.EES import explicit_exploration

S = explicit_exploration(
    fitness_fun=my_function,
    dim=10,
    lb=[-5] * 10,
    ub=[5] * 10,
    n=100,
    tol=0.01,
    K=5,
    maxiter=300
)

Estimation of Multivariate Normal Algorithm (EMNA)

EDA that models selected individuals using a multivariate normal distribution. Supports random initialization or EES.

from eeea_py.algorithms.EMNA import emna

# Random initialization
result = emna(my_function, dim=10, lb=[-5]*10, ub=[5]*10, n=100, g=100)

# With explicit exploration
result = emna(my_function, dim=10, lb=[-5]*10, ub=[5]*10, n=100, g=100,
              method='ees', tol=0.01, k=5, maxiter=300)

Grey Wolf Optimizer (GWO)

Population-based metaheuristic that simulates the leadership hierarchy and hunting strategy of grey wolves.

from eeea_py import gwo

result = gwo(my_function, dim=10, lb=[-5]*10, ub=[5]*10, n=30, g=500,
             a_decay='linear')  # also: 'exponential', 'adaptive'

Particle Swarm Optimization (PSO)

Classic swarm intelligence algorithm. Supports random initialization or EES.

from eeea_py import pso

result = pso(my_function, dim=10, lb=[-5]*10, ub=[5]*10, n=30, g=500,
             w=0.729, c1=1.494, c2=1.494)

Result Format

All algorithms return a dictionary with the following keys:

Key Description
best_individual Best solution found (numpy.ndarray)
best_fitness Fitness value of the best solution (float)
last_population Final population (numpy.ndarray)
last_fitness Fitness of the final population (numpy.ndarray)
history Best fitness per generation (numpy.ndarray), when available

Project Structure

eeea-py/
├── src/eeea_py/
│   ├── algorithms/
│   │   ├── EES.py                   # Explicit Exploration Strategy
│   │   ├── EMNA.py                  # Estimation of Multivariate Normal Algorithm
│   │   ├── GWO.py                   # Grey Wolf Optimizer
│   │   └── PSO.py                   # Particle Swarm Optimization
│   ├── benchmarks/
│   │   ├── unimodal.py              # Sphere, Rosenbrock, Schwefel 1.2, Trid
│   │   └── multimodal.py            # Ackley
│   ├── utils/
│   │   ├── population_configuration.py
│   │   ├── ranges_verification.py
│   │   └── results_management.py
│   └── __init__.py
├── examples/
├── tests/
│   ├── edge_cases/
│   ├── integration/
│   ├── robustness/
│   └── unit/
├── docs/
├── README.md
├── pyproject.toml
├── requirements.txt
└── requirements-dev.txt

Benchmark Functions

All benchmark functions accept a numpy.ndarray and return a float. They can be imported as follows:

from eeea_py.benchmarks.unimodal import sphere_function, rosenbrock_function
from eeea_py.benchmarks.multimodal import ackley_function

# Or using the registry
from eeea_py.benchmarks import get_benchmark

sphere = get_benchmark("sphere")
Function Type Search Space Global Optimum
sphere_function Unimodal [-600, 600] F(0) = 0
rosenbrock_function Unimodal [-10, 10] F(1,...,1) = 0
schwefel_1_2_function Unimodal [-40, 60] F(0) = 0
trid_function Unimodal [-d², d²] F(x) = -d(d+4)(d-1)/6
ackley_function Multimodal [-10, 10] F(0) = 0

Contributing

Contributions are welcome. Please follow these guidelines:

  • Code style: PEP 8
  • All changes must include unit tests under tests/
  • Document public methods with NumPy-style docstrings

Citation

If you use eeea-py in your research, please cite:

@software{rogelio2026eeeapy,
  title ={eeea-py: Explicit Exploration and Evolutionary Algorithms in Python},
  author = {Salinas Guti\'errez, Rogelio and G\'omez Linares, Enrique  Ana\'el and Galvan Delgadillo, Victoria and Mart{\'\i}nez Medina, Jessica Victoria and Rivas Hern{\'\a}ndez, Juan de Dios and Montoya Calzada, Pedro Abraham and L{\'\o}pez Hern{\'\a}ndez, Carlos Alberto and Saldivar Olvera, Ilse Daniela},
  year={2026},
  url={https://github.com/rogelio-sg/eeea-py},
  note={Software library}
}

The theoretical foundations of the explicit exploration strategy are described in the original R package:

@Manual{,
    title = {EEEA: Explicit Exploration Strategy for Evolutionary Algorithms},
    author = {Rogelio {Salinas Gutiérrez} and Pedro Abraham {Montoya Calzada} and Angel Eduardo {Muñoz Zavala} and Alejandro Fausto {Cortés Salinas} and Ilse Daniela {Saldivar Olvera}},
    year = {2025},
    note = {R package version 1.0.1},
    url = {https://CRAN.R-project.org/package=EEEA},
    doi = {10.32614/CRAN.package.EEEA},
  }

License

This project is licensed under the GNU General Public License v3.0. See the LICENSE file for details.


Support

For bug reports and feature requests, open an issue on GitHub.


Acknowledgments

  • R EEEA package for the original algorithmic framework that motivates this implementation
  • NumPy community for the numerical computing foundations
  • Contributors and collaborators at Universidad Autónoma de Aguascalientes

Version: 1.0.4 Authors: Salinas Gutiérrez R., Gómez Linares E. A., Galvan Delgadillo V., Martínez Medina J. V., Rivas Hernández J. de D., Montoya Calzada P. A., López Hernández C. A., & Saldivar Olvera I. D. — GitHub

Metadata

Release files for eeea-py 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for eeea-py 1.0.4
File Size Uploaded
eeea_py-1.0.4.tar.gz 30.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for eeea-py 1.0.4
File Interpreter ABI Platform
eeea_py-1.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 60.6 kB

Release files / eeea_py-1.0.4.tar.gz

Download URL eeea_py-1.0.4.tar.gz
Size 30.1 kB
Tags Source
SHA-256 checksum
How to use checksums
632134a28c5d75744c6e2e014b3abedd8ef8614569c5a9357937315786d17d78
BLAKE2b-256 checksum
How to use checksums
780884c6e6fe2823225870571b27ebfd3e938fe34adfe62ebbc6cb56e901b150
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / eeea_py-1.0.4-py3-none-any.whl

Download URL eeea_py-1.0.4-py3-none-any.whl
Size 30.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
67f37046b2992547cf7c7e2cf8f20413b95dd0f99647349757c09457e7db2786
BLAKE2b-256 checksum
How to use checksums
93882fe1e9343511826b3d7e00bc9892543207c7fac0bf0ae7f21fa34e9ff6c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files

1.0.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page