Welcome to ampgo’s documentation!¶
Adaptive memory programming is a powerful optimization algorithm for low-dimensional global optimization problems. Its core is a stochastic algorithm which executes repeated local minimizations from heuristically chosen startpoints.
This package implements the same API as scipy’s global optimizers. All local minimizers from SciPy and from NLopt (requires simplenlopt) can be employed for the local searches.
Installation¶
pip install ampgo
Example: Minimizing the six-hump camelback function in ampgo¶
import ampgo
def obj(x):
"""Six-hump camelback function"""
x1 = x[0]
x2 = x[1]
f = (4 - 2.1*(x1*x1) + (x1*x1*x1*x1)/3.0)*(x1*x1) + x1*x2 + (-4 + 4*(x2*x2))*(x2*x2)
return f
bounds = [(-5, 5), (-5, 5)]
res = ampgo.ampgo(obj, bounds)
print(res.x)
print(res.fun)
Documentation¶
Contents: