cuatro


Namecuatro JSON
Version 0.1.3 PyPI version JSON
download
home_pageNone
SummaryConvex qUAdratic Trust Region Optimizer.
upload_time2024-04-29 21:20:49
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseNone
keywords black-box optimization high-dimensional constraint satisfaction
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # CUATRO
As a quadratic model-based derivative-free optimization solver, [CUATRO](https://www.sciencedirect.com/science/article/pii/S0009250921007004) (short for Convex qUAdratic Trust-Region Optimizer) is similar to COBYQA and Py-BOBYQA, but with specialized routines for black-box optimization problems that frequently arise within chemical engineering applications: explicit constraint handling, noisy evaluations, high-dimensional decision spaces, safe constraint satisfaction, and sample-efficient trust region exploration.

## Installation

The latest release is available on PyPI via 
```pip install cuatro```

<!-- ## Tests
Run `python -m unittest` to check if the dependencies are correctly installed -->

## Examples of use
The folder `CUATRO/demos` contains examples of how to use CUATRO. `CUATRO_PLS.py` for instance compares various high-dimensional DFO routines for CUATRO.

Let's walk through another example where we want to use CUATRO to solve a constrained Rosenbrock implementation:

CUATRO only accepts simulations which take the vector of decision-variables as input, and output a tuple of the objective evaluation and a list of the constraint evaluations such that each constraint evaluation should be below 0: 
```
def f(x)
  return obj(x), [g1(x), g2(x)]
```

Let's start by defining our black-box:
```
def sim(x):
    g1 = lambda x: (x[0] - 1)**3 - x[1] + 1
    g2 = lambda x: x[0] + x[1] - 1.8
    f = lambda x: (1 - x[0])**2 + 100*(x[1] - x[0]**2)**2
    return f(x), [g1(x), g2(x)]
```


the list should remain empty if the black-box evaluations are unconstrained. We then call the CUATRO optimizer as follows:

```
import numpy as np
from cuatro import CUATRO

x0 = np.array([-2., 2.])
bounds = np.array([(-5., 5.) for _ in range(len(x0))])
budget = 100

solver_instance = CUATRO(
                    init_radius = 0.1, # how much radius should the initial area cover 
                    beta_red = 0.001**(2/budget), # trust region radius reduction heuristic
                    rescale_radius=True, # scale radii to unit box
                    method = 'local',
                    N_min_samples = 6, # 
                    constr_handling = 'Discrimination', # or 'Regression'
                    sampling = 'base', # maximize closest distance in trust region exploration
                    explore = 'feasible_sampling', 
                    # reject exploration samples that are predicted to violate constraints
                )
 
res = solver_instance.run_optimiser(sim=sim, x0=x0, bounds=bounds, max_f_eval=budget, )
print(res['f_best_so_far'], res['x_best_so_far'])

```

We define the initial guess `x0` as a numpy array of size d, and the box bounds `bounds` as a list of d tuples containing the upper and lower bound on the decision variables.

The solver instance is then run and we print the best objective evaluation and decision variables found in the budget of 100 evaluations. Other interesting arguments include 'constr_violation', 'radius_list', 'f_eval_list', 'x_eval_list'.

The documentation of `CUATRO/optimizer/CUATRO_optimizer_use.py` contains more information on possible solver configurations.

### Citing

If this repository is used in published work, please cite as:

```
@article{VANDEBERG2022117135,
title = {Data-driven optimization for process systems engineering applications},
journal = {Chemical Engineering Science},
volume = {248},
pages = {117135},
year = {2022},
issn = {0009-2509},
doi = {https://doi.org/10.1016/j.ces.2021.117135},
url = {https://www.sciencedirect.com/science/article/pii/S0009250921007004},
author = {Damien {van de Berg} and Thomas Savage and Panagiotis Petsagkourakis and Dongda Zhang and Nilay Shah and Ehecatl Antonio {del Rio-Chanona}},
}
```




            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "cuatro",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "black-box optimization, high-dimensional, constraint satisfaction",
    "author": null,
    "author_email": "Damien van de Berg <dv516@ic.ac.uk>",
    "download_url": "https://files.pythonhosted.org/packages/ef/99/33b7c489e20c638003b5faafab2e38a2d1aca985c300a54bf58f499b330a/cuatro-0.1.3.tar.gz",
    "platform": null,
    "description": "# CUATRO\r\nAs a quadratic model-based derivative-free optimization solver, [CUATRO](https://www.sciencedirect.com/science/article/pii/S0009250921007004) (short for Convex qUAdratic Trust-Region Optimizer) is similar to COBYQA and Py-BOBYQA, but with specialized routines for black-box optimization problems that frequently arise within chemical engineering applications: explicit constraint handling, noisy evaluations, high-dimensional decision spaces, safe constraint satisfaction, and sample-efficient trust region exploration.\r\n\r\n## Installation\r\n\r\nThe latest release is available on PyPI via \r\n```pip install cuatro```\r\n\r\n<!-- ## Tests\r\nRun `python -m unittest` to check if the dependencies are correctly installed -->\r\n\r\n## Examples of use\r\nThe folder `CUATRO/demos` contains examples of how to use CUATRO. `CUATRO_PLS.py` for instance compares various high-dimensional DFO routines for CUATRO.\r\n\r\nLet's walk through another example where we want to use CUATRO to solve a constrained Rosenbrock implementation:\r\n\r\nCUATRO only accepts simulations which take the vector of decision-variables as input, and output a tuple of the objective evaluation and a list of the constraint evaluations such that each constraint evaluation should be below 0: \r\n```\r\ndef f(x)\r\n  return obj(x), [g1(x), g2(x)]\r\n```\r\n\r\nLet's start by defining our black-box:\r\n```\r\ndef sim(x):\r\n    g1 = lambda x: (x[0] - 1)**3 - x[1] + 1\r\n    g2 = lambda x: x[0] + x[1] - 1.8\r\n    f = lambda x: (1 - x[0])**2 + 100*(x[1] - x[0]**2)**2\r\n    return f(x), [g1(x), g2(x)]\r\n```\r\n\r\n\r\nthe list should remain empty if the black-box evaluations are unconstrained. We then call the CUATRO optimizer as follows:\r\n\r\n```\r\nimport numpy as np\r\nfrom cuatro import CUATRO\r\n\r\nx0 = np.array([-2., 2.])\r\nbounds = np.array([(-5., 5.) for _ in range(len(x0))])\r\nbudget = 100\r\n\r\nsolver_instance = CUATRO(\r\n                    init_radius = 0.1, # how much radius should the initial area cover \r\n                    beta_red = 0.001**(2/budget), # trust region radius reduction heuristic\r\n                    rescale_radius=True, # scale radii to unit box\r\n                    method = 'local',\r\n                    N_min_samples = 6, # \r\n                    constr_handling = 'Discrimination', # or 'Regression'\r\n                    sampling = 'base', # maximize closest distance in trust region exploration\r\n                    explore = 'feasible_sampling', \r\n                    # reject exploration samples that are predicted to violate constraints\r\n                )\r\n \r\nres = solver_instance.run_optimiser(sim=sim, x0=x0, bounds=bounds, max_f_eval=budget, )\r\nprint(res['f_best_so_far'], res['x_best_so_far'])\r\n\r\n```\r\n\r\nWe define the initial guess `x0` as a numpy array of size d, and the box bounds `bounds` as a list of d tuples containing the upper and lower bound on the decision variables.\r\n\r\nThe solver instance is then run and we print the best objective evaluation and decision variables found in the budget of 100 evaluations. Other interesting arguments include 'constr_violation', 'radius_list', 'f_eval_list', 'x_eval_list'.\r\n\r\nThe documentation of `CUATRO/optimizer/CUATRO_optimizer_use.py` contains more information on possible solver configurations.\r\n\r\n### Citing\r\n\r\nIf this repository is used in published work, please cite as:\r\n\r\n```\r\n@article{VANDEBERG2022117135,\r\ntitle = {Data-driven optimization for process systems engineering applications},\r\njournal = {Chemical Engineering Science},\r\nvolume = {248},\r\npages = {117135},\r\nyear = {2022},\r\nissn = {0009-2509},\r\ndoi = {https://doi.org/10.1016/j.ces.2021.117135},\r\nurl = {https://www.sciencedirect.com/science/article/pii/S0009250921007004},\r\nauthor = {Damien {van de Berg} and Thomas Savage and Panagiotis Petsagkourakis and Dongda Zhang and Nilay Shah and Ehecatl Antonio {del Rio-Chanona}},\r\n}\r\n```\r\n\r\n\r\n\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Convex qUAdratic Trust Region Optimizer.",
    "version": "0.1.3",
    "project_urls": {
        "Repository": "https://github.com/OptiMaL-PSE-Lab/cuatro"
    },
    "split_keywords": [
        "black-box optimization",
        " high-dimensional",
        " constraint satisfaction"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e1682880f131f6a02ab3ea72bd11939488b4649cae76e719dfe60934585c6895",
                "md5": "434d2c1ecd6f798d76abf929e20bbeca",
                "sha256": "7fa33cad42a74f49a97edab5a161f5fb4342691845c21a3b12833650ce0396cb"
            },
            "downloads": -1,
            "filename": "cuatro-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "434d2c1ecd6f798d76abf929e20bbeca",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 75624,
            "upload_time": "2024-04-29T21:20:47",
            "upload_time_iso_8601": "2024-04-29T21:20:47.468920Z",
            "url": "https://files.pythonhosted.org/packages/e1/68/2880f131f6a02ab3ea72bd11939488b4649cae76e719dfe60934585c6895/cuatro-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ef9933b7c489e20c638003b5faafab2e38a2d1aca985c300a54bf58f499b330a",
                "md5": "3f753c1818dc4a109b3df112856b491b",
                "sha256": "06370b2c48af65522ee5f7f7c3063eb03900855ba975be6534d81bf7ec79203f"
            },
            "downloads": -1,
            "filename": "cuatro-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "3f753c1818dc4a109b3df112856b491b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 43553,
            "upload_time": "2024-04-29T21:20:49",
            "upload_time_iso_8601": "2024-04-29T21:20:49.470338Z",
            "url": "https://files.pythonhosted.org/packages/ef/99/33b7c489e20c638003b5faafab2e38a2d1aca985c300a54bf58f499b330a/cuatro-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-29 21:20:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "OptiMaL-PSE-Lab",
    "github_project": "cuatro",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "cuatro"
}
        
Elapsed time: 0.24665s