dschmitz89 / simplenlopt

SciPy style API for NLopt
https://simplenlopt.readthedocs.io/en/latest/
Other
2 stars 0 forks source link
augmented-lagrangian-method constrained-optimization global-optimization nlopt nonlinear-optimization nonlinear-regression optimization python

Documentation Status

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:

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)