A scipy.optimize like API for nlopt
Project description
Overview
A simple, SciPy like interface for the excellent nonlinear optimization library NLopt to make switching between SciPy and NLopt a piece of cake. SimpleNLopt's functions can act as a drop-in replacement for SciPy functions. Major differences compared to plain NLopt:
- SciPy like minimize(method='NLopt algorithm') API for NLopt's local optimizers
- Automatic numerical approximation of the gradient if analytical gradient is not available
- Automatic handling of constraints via the augmented lagrangian method without boilerplate code
- Scipy like interfaces to NLopt's global optimizers with hard stopping criteria
- SciPy like curve fitting using NLopt's algorithms
Documentation
Refer to the online documentation for detailed description of the API and examples
Installation
pip install simplenlopt
Example: Minimizing the Rosenbrock function in simplenlopt and scipy
import simplenlopt
from scipy.optimize import rosen, rosen_der
import scipy
import numpy as np
x0 = np.array([0.5, 1.8])
res = simplenlopt.minimize(rosen, x0, jac = rosen_der)
print("Found optimum: ", res.x)
res_scipy = scipy.optimize.minimize(rosen, x0, jac = rosen_der)
print("Found optimum: ", res_scipy.x)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
simplenlopt-1.1-py3-none-any.whl
(24.0 kB
view details)
File details
Details for the file simplenlopt-1.1-py3-none-any.whl
.
File metadata
- Download URL: simplenlopt-1.1-py3-none-any.whl
- Upload date:
- Size: 24.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.6.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eaa100a48d0c22d4f2808e7dc365ecf0924ee4eb9641e79339cfb1766cb8f06f |
|
MD5 | 1217ad7528212dec09e323fcdc952ebb |
|
BLAKE2b-256 | 5c49f5a0ab1e09eded33e63065879cd470e2cd3264c276e86cb31c762062eb14 |