pyHMS
pyHMS is a Python implementation of Hierarchic Memetic Strategy (HMS).
The Hierarchic Memetic Strategy is a stochastic global optimizer designed to tackle highly multimodal problems. It is a composite global optimization strategy consisting of a multi-population evolutionary strategy and some auxiliary methods. The HMS makes use of a dynamically-evolving data structure that provides an organization among the component populations. It is a tree with a fixed maximal height and variable internal node degree. Each component population is governed by a particular optimization engine. This package provides a simple python implementation.
Installation
Installation can be done using pypi:
pip install pyhms
It's also possible to install the current main branch:
pip install git+https://github.com/agh-a2s/pyhms.git@main
Quick Start
from pyhms import minimize
import numpy as np
fun = lambda x: sum(x**2)
bounds = np.array([(-20, 20), (-20, 20)])
solution = minimize(
fun=fun,
bounds=bounds,
maxfun=10000,
log_level="debug",
seed=42
)
pyhms provides an interface similar to scipy.optimize.minimize. This is the simplest way to run HMS with default parameters.
import numpy as np
from pyhms import (
EALevelConfig,
hms,
get_NBC_sprout,
DontStop,
MetaepochLimit,
SEA,
Problem,
)
square_bounds = np.array([(-20, 20), (-20, 20)])
square_problem = Problem(lambda x: sum(x**2), maximize=False, bounds=square_bounds)
config = [
EALevelConfig(
ea_class=SEA,
generations=2,
problem=square_problem,
pop_size=20,
mutation_std=1.0,
lsc=DontStop(),
),
EALevelConfig(
ea_class=SEA,
generations=4,
problem=square_problem,
pop_size=10,
mutation_std=0.25,
sample_std_dev=1.0,
lsc=DontStop(),
),
]
global_stop_condition = MetaepochLimit(limit=10)
sprout_condition = get_NBC_sprout(level_limit=4)
hms_tree = hms(config, global_stop_condition, sprout_condition)
print(hms_tree.summary())
Relevant literature
- J. Sawicki, M. Łoś, M. Smołka, R. Schaefer. Understanding measure-driven algorithms solving irreversibly ill-conditioned problems. Natural Computing 21:289-315, 2022. doi: 10.1007/s11047-020-09836-w
- J. Sawicki, M. Łoś, M. Smołka, J. Alvarez-Aramberri. Using Covariance Matrix Adaptation Evolutionary Strategy to boost the search accuracy in hierarchic memetic computations. Journal of computational science, 34, 48-54, 2019. doi: 10.1016/j.jocs.2019.04.005
Metadata
Release files for pyhms 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pyhms-1.0.0.tar.gz | 42.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyhms-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 104.0 kB
Release files / pyhms-1.0.0.tar.gz
| Download URL | pyhms-1.0.0.tar.gz |
|---|---|
| Size | 42.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
891ebf66d9ef1faeebdbce277eb7d104107e67ec36116d8f8ea9676a37c20bd7
|
|
BLAKE2b-256 checksum How to use checksums |
4ff87b37127f94bfb835a05f35295d3adf1a4e752afb4ff035927ff701730f80
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.1 CPython/3.10.7 Darwin/24.3.0
|
Release files / pyhms-1.0.0-py3-none-any.whl
| Download URL | pyhms-1.0.0-py3-none-any.whl |
|---|---|
| Size | 61.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fd6ebb245fe303f3832dfb5c6820a945589d58135a93c89786af9413d6daf04e
|
|
BLAKE2b-256 checksum How to use checksums |
51d92df8da2e000ce5ad3378ba2cbbf4701be9f3b730a203d6be1783e8db3c78
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.1 CPython/3.10.7 Darwin/24.3.0
|
Security for pyhms 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.