semvec/pypi-packages huggingface dataset:
ego-optimizer 1.0.0
Entropy-Guided Optimization (EGO): An Adaptive Evolutionary Algorithm
Requires Python: >=3.7

# 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.