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

COBYLA freezes (though maxeval and maxtime are given) #370

Open
tueda opened this issue Dec 2, 2020 · 2 comments
Open

COBYLA freezes (though maxeval and maxtime are given) #370

tueda opened this issue Dec 2, 2020 · 2 comments

Comments

@tueda
Copy link

tueda commented Dec 2, 2020

I guess setting maxeval or maxtime must guarantee that optimization algorithms finish anyway (or possibly raise an exception). With the following settings, opt.optimize() never returns (though I can make a workaround, for example, by changing the algorithm or putting other stopping criteria).

import nlopt
import numpy as np

def f(x, _grad):
    return (2 - np.cos(x[0])   x[1] ** 2) ** 2

opt = nlopt.opt(nlopt.LN_COBYLA, 2)
opt.set_min_objective(f)
opt.set_maxeval(668)  # doesn't seems to work
opt.set_maxtime(1.0)  # doesn't seems to work
opt.optimize([0, 0])  # never returns

If I use opt.set_maxeval(667) in the above code, then somehow it returns with the correct answer [0, 0].

Just in case, I am testing with the following versions (on Google Colab):

Python: 3.6.9
nlopt: 2.6.1

(I'm not sure why pip doesn't pick up 2.6.2).

@jehelset
Copy link

jehelset commented Dec 14, 2020

i also have stalling problem with COBYLA. in my case it seems to get stuck in the trstlp-function (https://github.com/stevengj/nlopt/blob/master/src/algs/cobyla/cobyla.c#L1247-L1250). this function does not take the stop-criteria into account. have problem both on 2.4.2 and master.

reproducer of it stalling is here:

https://github.com/jehelset/nlopt/blob/cobyla_trstlp_stalling/test/cobyla_trstlp_stalling.cpp

@sanketdiwale
Copy link

sanketdiwale commented Jan 11, 2024

@jehelset @stevengj This problem seems to be happening quite often in problems I am trying to solve using cobyla. Is there a simple workaround to the infinite looping that happens in the trustlp routine? I am not too familiar with the algorithm so don't want to break it with my changes, some advice on what can be done safely would be much appreciated.

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

3 participants