Open jcb-entrnce opened 3 years ago
@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.
@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?
When
tot
atCobyla.cs:962
is very small, this line evaluates totemp = 0.0
. This causes line 963 to divide by zero, evaluating toalpha = NaN
. This eventually causes both step and stepful to both beNaN
, which causesCobyla.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.