Skip to main content

A Python Package problem optimization.

Project description

https://pypi.org/project/pymetagen-datalabupo/

Metagen

Introduction

Metagen is a simple python library for solving optimization problems by metaheuristics algorithms. The project provides a set of already defined metaheristics and provide the basic tools to allow the user redefine/build its own algorithms in a simple way.

This project is currently maintained by David Gutierrez Áviles and Manuel Jesús Jiménez Navarro.

https://datalab.upo.es/

Link to the original paper: Metagen

Instalation

Metagen only requires python (>=3.10) as the library has been built completely on python.

For the instalation, the easiest way is to use pip:

pip install pymetagen-datalabupo

Tutorial

In orfer to work metagen we first need to import the Domain definition and an available metaheuristic.

from metagen.framework import Domain, Solution
from metagen.metaheuristics import RandomSearch

Every problem in metagen is defined by two elements: a domain and a fitness.

The domain of the problem is constructed by using the Domain imported previously . In this case we defined a simple domain with one integer variable in range [-10, 10].

domain: Domain = Domain()
domain.define_integer("x", -10, 10)

The fitness is a callable which receives a Solution as parameter and returns a float value.

def p1_fitness(solution: Solution) -> float:
    x = solution["x"] # The variable represents a potential solution instance which can be used as an map returning the builtin value.
    return x + 5

Finally, we only need to instantiate our metaherustic (in this case a simple random search) indicating the domain and fitness and run it returning the best solution.

random_search: RandomSearch = RandomSearch(domain, fitness)
solution: Solution = random_search.run()

Development

New contributors from all experience levels are welcomed. To contribute, you can open an issue or sending a pull request.

For testing the repository you just need to execute the following command:

pytest test

API reference

The official documentation is available in: https://pymetagen.readthedocs.io.

References

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

pymetagen-datalabupo-0.1.1.tar.gz (47.4 kB view details)

Uploaded Source

Built Distribution

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

pymetagen_datalabupo-0.1.1-py3-none-any.whl (56.3 kB view details)

Uploaded Python 3

File details

Details for the file pymetagen-datalabupo-0.1.1.tar.gz.

File metadata

  • Download URL: pymetagen-datalabupo-0.1.1.tar.gz
  • Upload date:
  • Size: 47.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for pymetagen-datalabupo-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8b2ff380c443c89562459bc20b6b6565c7ea4ae3c52e50c278e95384b8be34d8
MD5 e4474ef94f0b6ac0e9e914b6925a9b1f
BLAKE2b-256 c8a16de43ec68883dec6f2f836eaca17fac6fa13d80f54f9f327df6516b26203

See more details on using hashes here.

File details

Details for the file pymetagen_datalabupo-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pymetagen_datalabupo-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6aad5b553b75571b95ec8a57f1b4ff47b078db6ba104de9467b9c5b2698201ac
MD5 334f8955239d4501dd66e3aede398f51
BLAKE2b-256 67dc9e1aac934725e40f4b6dbc4ffdb58c8f4da02f6992bdf33453c842b261db

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