Name | pyhms JSON |
Version |
0.1.0
JSON |
| download |
home_page | https://github.com/maciejsmolka/pyhms |
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. |
upload_time | 2024-05-06 16:45:38 |
maintainer | None |
docs_url | None |
author | Maciej Smołka |
requires_python | <4.0,>=3.10 |
license | MIT |
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)
[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
`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/c8/51/459b9d61aa98df617d4789e4b96928799a119742b4c83e85486532818919/pyhms-0.1.0.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)\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\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.0",
"project_urls": {
"Homepage": "https://github.com/maciejsmolka/pyhms",
"Repository": "https://github.com/maciejsmolka/pyhms"
},
"split_keywords": [
"optimization",
" hms"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c98da29e977119bc417f2c2e2f1ce0f571e2fad5e623e06428a0a7dc5b5f7280",
"md5": "2540e21d809db04020a7ab9741c46706",
"sha256": "b541787b5b672f6ee846c53cf587fad278155de6f39a359e67b16bb45673f486"
},
"downloads": -1,
"filename": "pyhms-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2540e21d809db04020a7ab9741c46706",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 40144,
"upload_time": "2024-05-06T16:45:35",
"upload_time_iso_8601": "2024-05-06T16:45:35.062508Z",
"url": "https://files.pythonhosted.org/packages/c9/8d/a29e977119bc417f2c2e2f1ce0f571e2fad5e623e06428a0a7dc5b5f7280/pyhms-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c851459b9d61aa98df617d4789e4b96928799a119742b4c83e85486532818919",
"md5": "9304b0ef52eddb65cc93900d295a2f1f",
"sha256": "3a3999273747f2b0ed4baa9ef8969dba0f2d850658d0b58cfc369a1332b63540"
},
"downloads": -1,
"filename": "pyhms-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "9304b0ef52eddb65cc93900d295a2f1f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 28651,
"upload_time": "2024-05-06T16:45:38",
"upload_time_iso_8601": "2024-05-06T16:45:38.183002Z",
"url": "https://files.pythonhosted.org/packages/c8/51/459b9d61aa98df617d4789e4b96928799a119742b4c83e85486532818919/pyhms-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-06 16:45:38",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "maciejsmolka",
"github_project": "pyhms",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pyhms"
}