Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (9.3%) to scientific vocabulary
Repository
Scipy Interface to NLOPT
Basic Info
- Host: GitHub
- Owner: mvds314
- License: bsd-2-clause
- Language: Python
- Default Branch: main
- Size: 21.5 KB
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 3
Metadata Files
README.md
SpiNopt: a Scipy optimization interface to NLOPT
For optimization, everyone starts out with the Scipy optimization library, but, at some point, you might want to try something else. NLOPT is a great library, but can be quite a hassle rewrite your code to use it.
This package provides a Scipy interface to the NLOPT optimization library. It's aim is not to provide a complete ecosystem which different solvers are available, but merely a way to quickly connect the NLOPT solvers, once you already have something set up with Scipy, or are familiar with how to set something up with Scipy.
Basic example
```python import numpy as np from spinopt import NLOptimizer
dim = 3
Define objective in this way
def myeasyfunc(x, grad): if grad.size > 0: grad[:] = 2 * (x - np.arange(len(x))) x = x - np.arange(len(x)) return x.dot(x)
Define constraints Scipy style
A = np.ones((1, dim)) b = np.ones((1, 1)) constraints = [{"type": "eq", "jac": lambda w: A, "fun": lambda w: A.dot(w) - b.squeeze()}]
Initialize optimizer
x0=np.zeros(dim) opt = NLOptimizer(myeasyfunc, x0, constraints=constraints)
Optimize
res = opt.minimize() assert res.success assert np.allclose(res.x, np.arange(dim), atol=1e-5) ```
Installation
To install from PyPI:
bash
pip install spinopt
To install the latest development version from github:
bash
pip install git+https://github.com/mvds314/spinopt.git
Development
For development purposes, clone the repo:
bash
git clone https://github.com/mvds314/spinopt.git
Then navigate to the folder containing setup.py and run
bash
pip install -e .
to install the package in edit mode.
Run unittests with pytest.
Related software
Owner
- Login: mvds314
- Kind: user
- Repositories: 1
- Profile: https://github.com/mvds314
Citation (CITATION.cff)
cff-version: 1.2.0 message: "If you use this software, please cite it as below." authors: - family-names: "van der Schans" given-names: "Martin" title: "SpiNopt: A Scipy interface to NLOPT" version: 24.7.2 date-released: 2024-05-16 url: "https://github.com/mvds314/spinopt"
GitHub Events
Total
- Release event: 2
- Push event: 4
- Create event: 2
Last Year
- Release event: 2
- Push event: 4
- Create event: 2
Packages
- Total packages: 1
-
Total downloads:
- pypi 52 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 4
- Total maintainers: 1
pypi.org: spinopt
Scipy interface to NLOPT
- Documentation: https://spinopt.readthedocs.io/
- License: bsd-2-clause
-
Latest release: 24.7.2
published 7 months ago
Rankings
Maintainers (1)
Dependencies
- actions/checkout v3 composite
- actions/setup-python v3 composite
- nlopt *