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 Distribution
simplenlopt-1.0.1.tar.gz
(22.5 kB
view details)
File details
Details for the file simplenlopt-1.0.1.tar.gz
.
File metadata
- Download URL: simplenlopt-1.0.1.tar.gz
- Upload date:
- Size: 22.5 kB
- Tags: Source
- 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 | 9e44f2db5650c970620924a056ee189e86c78af643e4957dc9ed6edea54239fe |
|
MD5 | 9f5a18f7f7772a49b19bb0d913efeefb |
|
BLAKE2b-256 | 7d5598dd42c0c5519d5219027bfc2facd254a284ca5fa299c3bb6cdc6f1779c4 |