Skip to main content

Optimization algorithms library focused on evolutionary methods

Project description

🧬 RelaxGEN: Genetic & Probabilistic Optimization Library

PyPI Version License GitHub last commit Python Version

💡 What is RelaxGEN?

RelaxGEN is a modern, high-level Python library designed to make it easy to implement and experiment with metaheuristic optimization algorithms.

It provides a clean, unified API for several powerful paradigms:

  1. Classical Genetic Algorithms — Binary encoding with standard operators (crossover, mutation, selection). Very robust when the problem structure is unknown.
  2. Quantum Genetic Algorithms (QGA) — Probabilistic representation using qubits, enabling very fast search with minimal population size.
  3. Estimation of Distribution Algorithms (EDA) — Advanced probabilistic modeling that captures variable dependencies — excellent for complex, epistatic problems.
  4. Genetic Programming (GP) — Evolves executable hierarchical structures (trees), allowing automatic synthesis of mathematical expressions, programs or symbolic models.

The main goal is to offer a flexible, fast and user-friendly tool for function optimization, hyperparameter tuning, and solving complex real-world problems.

🚀 Installation

The easiest way is via pip:

pip install relax-gen

Quick Start Example

import numpy as np
from relax_gen import GEN

# ackley = 20 + e - 20 * exp(-0.2 * sqrt(0.5 * (x^2 + y^2))) - exp(0.5 * (cos(2 * pi * x) + cos(2 * pi * y)))
def ackley(valor, a=20, b=0.2, c=2*np.pi):
    x = valor[:,0]
    y = valor[:,1]

    term1 = -a * np.exp(-b * np.sqrt(0.5 * (x**2 + y**2)))
    term2 = -np.exp(0.5 * (np.cos(c * x) + np.cos(c * y)))
    return term1 + term2 + a + np.e

modelo = GEN(ackley, 
        population=300, 
        i_min=-2, 
        i_max=2,
        num_variables=2
        )

result = modelo.alg_stn_bin()
print("Best result:", result)
Figure_1_Ackley

RelaxGEN lets you easily switch between different optimization models. Parameter names and behavior adapt depending on the selected algorithm.

More information about the different functions can be found on the Wiki: https://github.com/LuisPablo54/relax_gen/wiki

Key Features

  • Unified and intuitive high-level API
  • Support for continuous, discrete and mixed problems
  • Multiple state-of-the-art evolutionary paradigms in one package
  • Designed for rapid prototyping and research experimentation
  • Extensible — easy to add new algorithms or custom operators

🤝 Contributing

Contributions are very welcome! Whether you want to:

  • Add a new optimization algorithm
  • Improve performance
  • Enhance documentation
  • Fix bugs
  • Add new examples or benchmarks

Please follow these steps:

  • Fork the repository
  • Create your feature branch
  • Commit your changes
  • Push to the branch
  • Open a Pull Request

We appreciate every contribution

📄 License

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

Happy optimizing!

Feel free to ⭐ the repository if you find it useful!

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

relax_gen-0.4.1.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

relax_gen-0.4.1-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file relax_gen-0.4.1.tar.gz.

File metadata

  • Download URL: relax_gen-0.4.1.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for relax_gen-0.4.1.tar.gz
Algorithm Hash digest
SHA256 af245018a49bc51490a022fbf9607fd747d00ae07f9f58287935935451c5192c
MD5 bddcf6fe3d1526d130ab5e009855cea7
BLAKE2b-256 0fd6f858403fb21771fdccf83afe5ab76969342c6a34e1b0cf35fcccd068a5fd

See more details on using hashes here.

File details

Details for the file relax_gen-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: relax_gen-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for relax_gen-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6a038d40d6d4e4b1ee4c0f24e4bb464399fea6c5ef8210e0750c69f406c39956
MD5 ab5aeab8910967a4d5cb7ddc33247fe5
BLAKE2b-256 2ac58ce00097da0f1294e9bdf31c13c975bf7dccceb442fadc7d2158db69149a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page