Skip to main content

EGO: Entropy-Guided Optimization

EGO is a novel evolutionary algorithm that uses Shannon Entropy to adaptively balance exploration and exploitation.

Unlike standard Differential Evolution (DE) or Particle Swarm Optimization (PSO), EGO does not require manual tuning of mutation factors. It analyzes the population's diversity in real-time and "shifts gears" automatically—exploring aggressively when needed and converging with high precision when close to the optimum.

Key Features

  • Adaptive Mechanism: Uses entropy to scale mutation (F) and crossover (CR) rates dynamically.
  • No Tuning Required: Works out-of-the-box on 30D, 50D, and 100D problems.
  • High Precision: Achieves near-zero error on unimodal functions (Sphere, Step).
  • Robust: Ranked #1 (tied with DE) against GA and PSO in standard benchmarks.

Installation

You can install EGO directly via pip:

pip install ego-optimizer

Usage

EGO is designed to be a drop-in replacement for other optimizers.

from ego_optimizer import entropy_guided_optimization
import numpy as np

# 1. Define your objective function (e.g., Sphere Function)
def sphere(x):
    return np.sum(x**2)

# 2. Run the optimizer
best_x, best_y, history = entropy_guided_optimization(
    func=sphere,
    dim=30,
    pop_size=50,
    max_iter=1500,
    lb=-100,
    ub=100
)

print(f"Optimization Complete!")
print(f"Best Fitness: {best_y:.6e}")
print(f"Best Solution: {best_x}")

Benchmarks (30D)

EGO was tested against standard implementations of DE, PSO, and GA. Rank #1 (Lower is better).

Algorithm Rank Sphere (Error) Step (Error)
EGO 1.80 8.07e-05 1.25
DE 1.78 0.15 1,330.0
PSO 3.80 3.24e-04 274,000.0
GA 2.63 92.0 88,400.0

Citation

If you use EGO in your research, please cite:

Adham, A. (2025). EGO: An Adaptive Entropy-Guided Evolutionary Algorithm for Global Optimization.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for ego-optimizer 1.0.0

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

Source distribution (sdist)

Source distribution for ego-optimizer 1.0.0
File Size Uploaded Provenance Actions
ego_optimizer-1.0.0.tar.gz 4.6 kB Without provenance Details for ego_optimizer-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ego-optimizer 1.0.0
File Interpreter ABI Platform Actions
ego_optimizer-1.0.0-py3-none-any.whl Python 3 none any Details for ego_optimizer-1.0.0-py3-none-any.whl

Total release size: 9.6 kB

Release files / ego_optimizer-1.0.0.tar.gz

Download URL ego_optimizer-1.0.0.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
cf5c91faac35fc71eb60e88a83c9227649e6312e0e0e95ad63730e6313614922
BLAKE2b-256 checksum
How to use checksums
3269b0a769c3519c959d6e7a2bd514c53281f8c70b539eee92538af90ef29e85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.9

Release files / ego_optimizer-1.0.0-py3-none-any.whl

Download URL ego_optimizer-1.0.0-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aef80c9de0fde836164aa22bcff1a809cadd98fb2ba8b0720fdf0a00366eec39
BLAKE2b-256 checksum
How to use checksums
aaa1969e8efc94b0c7592e50b0f1c03d849af20308fcbf1bd4802a1c8f53fca7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.9

Security for ego-optimizer 1.0.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

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