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 turns into infinite loop and never finishes #8

Open
jcb-entrnce opened this issue Jan 21, 2021 · 2 comments
Open

Cobyla turns into infinite loop and never finishes #8

jcb-entrnce opened this issue Jan 21, 2021 · 2 comments

Comments

@jcb-entrnce
Copy link

When tot at Cobyla.cs:962 is very small, this line evaluates to temp = 0.0. This causes line 963 to divide by zero, evaluating to alpha = NaN. This eventually causes both step and stepful to both be NaN, which causes Cobyla.cs:1292 to always evaluate to false (because (NaN == NaN) == false), looping forever.

This is annoying since it makes the algorithm unusable for production purposes.

@dsanalytics
Copy link

dsanalytics commented May 18, 2021

@jcb-entrnce could you please provide the objective function and the constraints used, in the unit test code form hopefully, so that we could try to reproduce the problem? Also, any extra info on top of that would be appreciated - thanks in advance.

@anders9ustafsson
Copy link
Contributor

anders9ustafsson commented Nov 18, 2022

@jcb-entrnce Sorry for this extremely late response.
Looking at the code, my initial estimate would be that the following code in lines 963-964 would resolve your issue:

var alpha = temp != 0 ? sp / temp : Math.Sign(sp);
var beta = temp != 0 ? tot / temp : Math.Sign(tot);

(potentially checking a small epsilon rather than 0). Do you agree?

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