From: stevenj Date: Tue, 29 Mar 2011 22:59:57 +0000 (-0400) Subject: bug fix in cdirect -- typo caused slope to be underestimated in some cases, and will... X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=15d02541aa837c3c51c00d4339ab5207a95ab822;p=nlopt.git bug fix in cdirect -- typo caused slope to be underestimated in some cases, and will miss some potentially optimal rectangles. Thanks to Sinisa Hristov for the bug report darcs-hash:20110329225957-c8de0-96a76c698ce0a934f7f0c2f5334aa259f073b0ef.gz --- diff --git a/cdirect/cdirect.c b/cdirect/cdirect.c index d37e891..b9b909a 100644 --- a/cdirect/cdirect.c +++ b/cdirect/cdirect.c @@ -414,7 +414,7 @@ static nlopt_result divide_good_rects(params *p) if (im >= 0) K1 = (hull[i][1] - hull[im][1]) / (hull[i][0] - hull[im][0]); if (ip < nhull) - K1 = (hull[i][1] - hull[ip][1]) / (hull[i][0] - hull[ip][0]); + K2 = (hull[i][1] - hull[ip][1]) / (hull[i][0] - hull[ip][0]); K = MAX(K1, K2); if (hull[i][1] - K * hull[i][0] <= p->minf - magic_eps * fabs(p->minf) || ip == nhull) {