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.0.tar.gz (22.6 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.0-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: relax_gen-0.4.0.tar.gz
  • Upload date:
  • Size: 22.6 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.0.tar.gz
Algorithm Hash digest
SHA256 3da9e7eb469c8c09ee343b0daf8bbf1fc015c9dc273354f46aee376b1cb0c6cb
MD5 7919d0f1b45352c4b3c6980f183b9003
BLAKE2b-256 e49f58f675eb27c5cae29a6d05f94bb1a33b08454926dff3313d2bcaaeb03373

See more details on using hashes here.

File details

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

File metadata

  • Download URL: relax_gen-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 16.8 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4e955ebe64021e0add9c9ab1cb6754888e925520736a31727315e92b4ef48eda
MD5 c8c2bd6ef9025a07fe9d20c82f73fc85
BLAKE2b-256 8b746a9bb0ef42c3aaf44b427d80f0390bd35de5080debb787a756e9bbccb530

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