Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nlopt stogo #284

Open
samuellhong opened this issue Jul 17, 2019 · 1 comment
Open

nlopt stogo #284

samuellhong opened this issue Jul 17, 2019 · 1 comment

Comments

@samuellhong
Copy link

samuellhong commented Jul 17, 2019

I am trying to find the global minimization of the eggholder function:

import nlopt
import numpy as np

def eggholder(x, grad):
    return (-(x[1] + 47) * np.sin(np.sqrt(abs(x[0]/2 + (x[1]  + 47)))) -x[0] * np.sin(np.sqrt(abs(x[0] - (x[1]  + 47)))))

x0 = np.zeros(2)
opt = nlopt.opt(nlopt.GD_STOGO, x0.size)
opt.set_min_objective(eggholder)
opt.set_lower_bounds(-512)
opt.set_upper_bounds(512)
opt.set_xtol_rel(1e-8)
%time opt_x = opt.optimize(x0)
opt_value = opt.last_optimum_value()
opt_result = opt.last_optimize_result()

However, the optimization function keeps running and never finds the global minimum. Does anyone know why the optimize function keeps running?

@jschueller
Copy link
Collaborator

maybe it does not converge, try "opt.set_maxeval(1000)" or set_maxtime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants