-
Notifications
You must be signed in to change notification settings - Fork 586
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 COBYLA optimizer gives unexpected output #182
Comments
I can confirm the behaviour:
Would you be able to provide a little context about the problem you're trying to solve? Your function and constraint function both seem to just be doing some number juggling, so having a grasp of the maths might potentially help. |
After further testing, you seem to have found a magic value for the starting point, namely: startpoint = np.array([6.69338188e-01, -3.43007266e-16, 3.30661812e-01,
7.25335154e+00,
-1.57398018e+01, 1.03509155e+01, 5.38888629e+00]) (reformatting mine) If I repeat the process with various rounded (using For your input array Although I can't comment on why your magic input leads to this "misbehaving" solution... |
So, in your given case, the result code is I noticed that you set, for both I decided to disable the
Given that you have some of your variables of the order |
Furthermore, if I comment out both the
It is my strong suspicion that this is the minimum you're really looking for. For now, all I can suggest @wesselvaneeghen is that you read the section in the documentation on the function and parameter tolerances: https://nlopt.readthedocs.io/en/latest/NLopt_Introduction/#function-value-and-parameter-tolerances On the other hand, I'm still ignorant as to why setting these absolute tolerances causes "solution" values which violate the constraint... |
@aphirst I had actually given up on the cobyla solver a few weeks ago, but I may revise this with your contribution. I had decided to go with the nlopt SLSQP solver, which works great for me. In fact, for some reason nlopt's slsqp seems to be producing more stable output than slsqp as implemented by scipy, which I was using before. Scipy's slsqp sometimes produces an error 'Positive directional derivative for linesearch', where nlopt's slsqp seems to be able to optimize further. Anyway, mainly wanted to say thanks :) |
Hi all,
I am using several optimizers from nlopt in Python. I sometimes encounter an unexpected result when using the COBYLA optimizer.
I am trying to minimize a function subject to a non-linear constraint. I give the optimizer a startpoint that satisfies the constraint. COBYLA however returns output that does not satisfy the constraint, while reporting that the optimization finished successfully. This is not what I expect to happen and I cannot use the result.
Can someone please enlighten me on this issue? I added the code below. Thanks!
example_code_cobyla.txt
The text was updated successfully, but these errors were encountered: