scipy-quadopt


Namescipy-quadopt JSON
Version 0.2.0 PyPI version JSON
download
home_pagehttp://github.com/ulf1/scipy-quadopt
SummaryWrapper and utility functions to apply scipy's SLSQP algorithm to quadratic optimization problems with resource constraints and upper boundaries.
upload_time2023-07-10 15:40:41
maintainer
docs_urlNone
authorUlf Hamster
requires_python>=3.6
licenseApache License 2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![PyPI version](https://badge.fury.io/py/scipy-quadopt.svg)](https://badge.fury.io/py/scipy-quadopt)
[![PyPi downloads](https://img.shields.io/pypi/dm/scipy-quadopt)](https://img.shields.io/pypi/dm/scipy-quadopt)
[![DOI](https://zenodo.org/badge/355471428.svg)](https://zenodo.org/badge/latestdoi/355471428)

# scipy-quadopt: Quadratic optimization with constraints and upper boundaries
Wrapper and utility functions to apply scipy's SLSQP algorithm to quadratic optimization problems with resource constraints and upper boundaries.

## Usage

```py
import numpy as np
import scipy_quadopt as sqp

# goodness scores
good = np.array([.51, .53, .55, .57])

# similarity matrices
simi_1 = np.array([
    [1, .9, .8, .7],
    [.9, 1, .6, .5],
    [.8, .6, 1, .4],
    [.7, .5, .4, 1],
])

simi_2 = np.array([
    [1, .7, .8, .3],
    [.7, 1, .4, .2],
    [.8, .4, 1, .6],
    [.3, .2, .6, 1],
])

# preference parameters
lam = 0.4
beta_1 = 0.25
beta_2 = 0.75

# compute weights
simi = sqp.aggregate_matrices(simi_1, beta_1, simi_2, beta_2)
weights, _ = sqp.get_weights(good, simi, lam)
```

## Appendix

### Installation
The `scipy-quadopt` [git repo](http://github.com/ulf1/scipy-quadopt) is available as [PyPi package](https://pypi.org/project/scipy-quadopt)

```
pip install scipy-quadopt
pip install git+ssh://git@github.com/ulf1/scipy-quadopt.git
```

### Install a virtual environment

```
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt --no-cache-dir
pip install -r requirements-dev.txt --no-cache-dir
```

(If your git repo is stored in a folder with whitespaces, then don't use the subfolder `.venv`. Use an absolute path without whitespaces.)

### Python commands

* Jupyter for the examples: `jupyter lab`
* Check syntax: `flake8 --ignore=F401 --exclude=$(grep -v '^#' .gitignore | xargs | sed -e 's/ /,/g')`
* Run Unit Tests: `PYTHONPATH=. pytest`

Publish

```sh
python setup.py sdist 
twine upload -r pypi dist/*
```

### Clean up 

```
find . -type f -name "*.pyc" | xargs rm
find . -type d -name "__pycache__" | xargs rm -r
rm -r .pytest_cache
rm -r .venv
```


### Support
Please [open an issue](https://github.com/ulf1/scipy-quadopt/issues/new) for support.


### Contributing
Please contribute using [Github Flow](https://guides.github.com/introduction/flow/). Create a branch, add commits, and [open a pull request](https://github.com/ulf1/scipy-quadopt/compare/).


### Acknowledgements
The "Evidence" project was funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) - [433249742](https://gepris.dfg.de/gepris/projekt/433249742) (GU 798/27-1; GE 1119/11-1).

### Maintenance
- till 31.Aug.2023 (v0.1.2) the code repository was maintained within the DFG project [433249742](https://gepris.dfg.de/gepris/projekt/433249742)
- since 01.Sep.2023 (v0.2.0) the code repository is maintained by Ulf Hamster.



            

Raw data

            {
    "_id": null,
    "home_page": "http://github.com/ulf1/scipy-quadopt",
    "name": "scipy-quadopt",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "",
    "author": "Ulf Hamster",
    "author_email": "554c46@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/8a/35/34382ec83b14a2e7c3f75e5d8a8eeb0e1e54192ac9c60969371e85eccb73/scipy-quadopt-0.2.0.tar.gz",
    "platform": null,
    "description": "[![PyPI version](https://badge.fury.io/py/scipy-quadopt.svg)](https://badge.fury.io/py/scipy-quadopt)\n[![PyPi downloads](https://img.shields.io/pypi/dm/scipy-quadopt)](https://img.shields.io/pypi/dm/scipy-quadopt)\n[![DOI](https://zenodo.org/badge/355471428.svg)](https://zenodo.org/badge/latestdoi/355471428)\n\n# scipy-quadopt: Quadratic optimization with constraints and upper boundaries\nWrapper and utility functions to apply scipy's SLSQP algorithm to quadratic optimization problems with resource constraints and upper boundaries.\n\n## Usage\n\n```py\nimport numpy as np\nimport scipy_quadopt as sqp\n\n# goodness scores\ngood = np.array([.51, .53, .55, .57])\n\n# similarity matrices\nsimi_1 = np.array([\n    [1, .9, .8, .7],\n    [.9, 1, .6, .5],\n    [.8, .6, 1, .4],\n    [.7, .5, .4, 1],\n])\n\nsimi_2 = np.array([\n    [1, .7, .8, .3],\n    [.7, 1, .4, .2],\n    [.8, .4, 1, .6],\n    [.3, .2, .6, 1],\n])\n\n# preference parameters\nlam = 0.4\nbeta_1 = 0.25\nbeta_2 = 0.75\n\n# compute weights\nsimi = sqp.aggregate_matrices(simi_1, beta_1, simi_2, beta_2)\nweights, _ = sqp.get_weights(good, simi, lam)\n```\n\n## Appendix\n\n### Installation\nThe `scipy-quadopt` [git repo](http://github.com/ulf1/scipy-quadopt) is available as [PyPi package](https://pypi.org/project/scipy-quadopt)\n\n```\npip install scipy-quadopt\npip install git+ssh://git@github.com/ulf1/scipy-quadopt.git\n```\n\n### Install a virtual environment\n\n```\npython3 -m venv .venv\nsource .venv/bin/activate\npip install --upgrade pip\npip install -r requirements.txt --no-cache-dir\npip install -r requirements-dev.txt --no-cache-dir\n```\n\n(If your git repo is stored in a folder with whitespaces, then don't use the subfolder `.venv`. Use an absolute path without whitespaces.)\n\n### Python commands\n\n* Jupyter for the examples: `jupyter lab`\n* Check syntax: `flake8 --ignore=F401 --exclude=$(grep -v '^#' .gitignore | xargs | sed -e 's/ /,/g')`\n* Run Unit Tests: `PYTHONPATH=. pytest`\n\nPublish\n\n```sh\npython setup.py sdist \ntwine upload -r pypi dist/*\n```\n\n### Clean up \n\n```\nfind . -type f -name \"*.pyc\" | xargs rm\nfind . -type d -name \"__pycache__\" | xargs rm -r\nrm -r .pytest_cache\nrm -r .venv\n```\n\n\n### Support\nPlease [open an issue](https://github.com/ulf1/scipy-quadopt/issues/new) for support.\n\n\n### Contributing\nPlease contribute using [Github Flow](https://guides.github.com/introduction/flow/). Create a branch, add commits, and [open a pull request](https://github.com/ulf1/scipy-quadopt/compare/).\n\n\n### Acknowledgements\nThe \"Evidence\" project was funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) - [433249742](https://gepris.dfg.de/gepris/projekt/433249742) (GU 798/27-1; GE 1119/11-1).\n\n### Maintenance\n- till 31.Aug.2023 (v0.1.2) the code repository was maintained within the DFG project [433249742](https://gepris.dfg.de/gepris/projekt/433249742)\n- since 01.Sep.2023 (v0.2.0) the code repository is maintained by Ulf Hamster.\n\n\n",
    "bugtrack_url": null,
    "license": "Apache License 2.0",
    "summary": "Wrapper and utility functions to apply scipy's SLSQP algorithm to quadratic optimization problems with resource constraints and upper boundaries.",
    "version": "0.2.0",
    "project_urls": {
        "Homepage": "http://github.com/ulf1/scipy-quadopt"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8a3534382ec83b14a2e7c3f75e5d8a8eeb0e1e54192ac9c60969371e85eccb73",
                "md5": "d12c03a13f1f025a4d9f4ebcab30b5f9",
                "sha256": "0f83502d7ba8b5018c2af2e0ee0869ddf2f6b0ce41a79d152752d535cf3e3647"
            },
            "downloads": -1,
            "filename": "scipy-quadopt-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "d12c03a13f1f025a4d9f4ebcab30b5f9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 8523,
            "upload_time": "2023-07-10T15:40:41",
            "upload_time_iso_8601": "2023-07-10T15:40:41.735522Z",
            "url": "https://files.pythonhosted.org/packages/8a/35/34382ec83b14a2e7c3f75e5d8a8eeb0e1e54192ac9c60969371e85eccb73/scipy-quadopt-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-10 15:40:41",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ulf1",
    "github_project": "scipy-quadopt",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "scipy-quadopt"
}
        
Elapsed time: 0.13298s