pyhms


Namepyhms JSON
Version 0.1.1 PyPI version JSON
download
home_pagehttps://github.com/maciejsmolka/pyhms
SummaryThe HMS (Hierarchic Memetic Strategy) is a composite global optimization strategy consisting of a multi-population evolutionary strategy and some auxiliary methods. The HMS makes use of a tree with a fixed maximal height and variable internal node degree. Each component population is governed by a particular evolutionary engine. This package provides a simple python implementation with examples of using different population engines.
upload_time2024-08-22 15:44:21
maintainerNone
docs_urlNone
authorMaciej Smołka
requires_python<4.0,>=3.10
licenseMIT
keywords optimization hms
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pyhms
![GitHub Test Badge][1] [![codecov][2]](https://codecov.io/gh/agh-a2s/pyhms) [![Documentation Status][3]](https://pyhms.readthedocs.io/en/latest/?badge=latest) [![pypi.org][4]][5] [![versions][6]][7] ![license][8]

[1]: https://github.com/agh-a2s/pyhms/actions/workflows/pytest.yml/badge.svg "GitHub CI Badge"
[2]: https://codecov.io/gh/agh-a2s/pyhms/graph/badge.svg?token=srsivvv2ff
[3]: https://readthedocs.org/projects/pyhms/badge/?version=latest
[4]: https://img.shields.io/pypi/v/pyhms.svg "Pypi Latest Version Badge"
[5]: https://pypi.python.org/pypi/pyhms "Pypi site"
[6]: https://img.shields.io/pypi/pyversions/pyhms.svg
[7]: https://github.com/agh-a2s/pyhms
[8]: https://img.shields.io/github/license/agh-a2s/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

```python
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.

```python
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](https://doi.org/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](https://doi.org/10.1016/j.jocs.2019.04.005)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/maciejsmolka/pyhms",
    "name": "pyhms",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": "optimization, HMS",
    "author": "Maciej Smo\u0142ka",
    "author_email": "smolka@agh.edu.pl",
    "download_url": "https://files.pythonhosted.org/packages/da/47/a877603959b1fee809e80353f4103e44e0006401df9f9b09c1c5748a9847/pyhms-0.1.1.tar.gz",
    "platform": null,
    "description": "# pyhms\n![GitHub Test Badge][1] [![codecov][2]](https://codecov.io/gh/agh-a2s/pyhms) [![Documentation Status][3]](https://pyhms.readthedocs.io/en/latest/?badge=latest) [![pypi.org][4]][5] [![versions][6]][7] ![license][8]\n\n[1]: https://github.com/agh-a2s/pyhms/actions/workflows/pytest.yml/badge.svg \"GitHub CI Badge\"\n[2]: https://codecov.io/gh/agh-a2s/pyhms/graph/badge.svg?token=srsivvv2ff\n[3]: https://readthedocs.org/projects/pyhms/badge/?version=latest\n[4]: https://img.shields.io/pypi/v/pyhms.svg \"Pypi Latest Version Badge\"\n[5]: https://pypi.python.org/pypi/pyhms \"Pypi site\"\n[6]: https://img.shields.io/pypi/pyversions/pyhms.svg\n[7]: https://github.com/agh-a2s/pyhms\n[8]: https://img.shields.io/github/license/agh-a2s/pyhms\n\n`pyhms` is a Python implementation of Hierarchic Memetic Strategy (HMS).\n\nThe 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.\n\n### Installation\nInstallation can be done using `pypi`:\n```\npip install pyhms\n```\nIt's also possible to install the current main branch:\n```\npip install git+https://github.com/agh-a2s/pyhms.git@main\n```\n\n### Quick Start\n\n```python\nfrom pyhms import minimize\nimport numpy as np\n\nfun = lambda x: sum(x**2)\nbounds = np.array([(-20, 20), (-20, 20)])\nsolution = minimize(\n    fun=fun,\n    bounds=bounds,\n    maxfun=10000,\n    log_level=\"debug\",\n    seed=42\n)\n```\n\n`pyhms` provides an interface similar to `scipy.optimize.minimize`. This is the simplest way to run HMS with default parameters.\n\n```python\nimport numpy as np\nfrom pyhms import (\n    EALevelConfig,\n    hms,\n    get_NBC_sprout,\n    DontStop,\n    MetaepochLimit,\n    SEA,\n    Problem,\n)\n\nsquare_bounds = np.array([(-20, 20), (-20, 20)])\nsquare_problem = Problem(lambda x: sum(x**2), maximize=False, bounds=square_bounds)\n\nconfig = [\n    EALevelConfig(\n        ea_class=SEA,\n        generations=2,\n        problem=square_problem,\n        pop_size=20,\n        mutation_std=1.0,\n        lsc=DontStop(),\n    ),\n    EALevelConfig(\n        ea_class=SEA,\n        generations=4,\n        problem=square_problem,\n        pop_size=10,\n        mutation_std=0.25,\n        sample_std_dev=1.0,\n        lsc=DontStop(),\n    ),\n]\nglobal_stop_condition = MetaepochLimit(limit=10)\nsprout_condition = get_NBC_sprout(level_limit=4)\nhms_tree = hms(config, global_stop_condition, sprout_condition)\nprint(hms_tree.summary())\n```\n\n### Relevant literature\n\n- J. Sawicki, M. \u0141o\u015b, M. Smo\u0142ka, R. Schaefer. Understanding measure-driven algorithms solving irreversibly ill-conditioned problems. Natural Computing 21:289-315, 2022. doi: [10.1007/s11047-020-09836-w](https://doi.org/10.1007/s11047-020-09836-w)\n- J. Sawicki, M. \u0141o\u015b, M. Smo\u0142ka, 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](https://doi.org/10.1016/j.jocs.2019.04.005)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "The HMS (Hierarchic Memetic Strategy) is a composite global optimization strategy consisting of a multi-population evolutionary strategy and some auxiliary methods. The HMS makes use of a tree with a fixed maximal height and variable internal node degree. Each component population is governed by a particular evolutionary engine. This package provides a simple python implementation with examples of using different population engines.",
    "version": "0.1.1",
    "project_urls": {
        "Homepage": "https://github.com/maciejsmolka/pyhms",
        "Repository": "https://github.com/maciejsmolka/pyhms"
    },
    "split_keywords": [
        "optimization",
        " hms"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "299e82b01312c51a269d4ba17e23a5991a05bfb1c856762078b1a7170ab89322",
                "md5": "a1ae27ed35de8f7fb5c8c79923349a25",
                "sha256": "d6eccdb4275a44413b711a42897a883624ed0c2ce14c3bb21895b9f69634b9ef"
            },
            "downloads": -1,
            "filename": "pyhms-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a1ae27ed35de8f7fb5c8c79923349a25",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 55422,
            "upload_time": "2024-08-22T15:44:19",
            "upload_time_iso_8601": "2024-08-22T15:44:19.175098Z",
            "url": "https://files.pythonhosted.org/packages/29/9e/82b01312c51a269d4ba17e23a5991a05bfb1c856762078b1a7170ab89322/pyhms-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "da47a877603959b1fee809e80353f4103e44e0006401df9f9b09c1c5748a9847",
                "md5": "1bfff71137f278054d8b9525e2b8e6d8",
                "sha256": "f7e115a042fb729d1d6b473cd5ef3cd321d771fe4c6f3a0e3158b868e26bd06f"
            },
            "downloads": -1,
            "filename": "pyhms-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "1bfff71137f278054d8b9525e2b8e6d8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 39643,
            "upload_time": "2024-08-22T15:44:21",
            "upload_time_iso_8601": "2024-08-22T15:44:21.098674Z",
            "url": "https://files.pythonhosted.org/packages/da/47/a877603959b1fee809e80353f4103e44e0006401df9f9b09c1c5748a9847/pyhms-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-22 15:44:21",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "maciejsmolka",
    "github_project": "pyhms",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pyhms"
}
        
Elapsed time: 0.63776s