chiark / gitweb /
AUGLAG: Fix arithmetic exception (#242)
authorJulien Schueller <schueller@phimeca.com>
Fri, 14 Dec 2018 04:15:45 +0000 (05:15 +0100)
committerSteven G. Johnson <stevenj@mit.edu>
Fri, 14 Dec 2018 04:15:45 +0000 (23:15 -0500)
src/algs/auglag/auglag.c

index 384194afc99ab11f452c81cdf04baf14d6dd0800..18e5e664fc126b63cbf8172cab454e73762cdc7c 100644 (file)
@@ -174,7 +174,7 @@ nlopt_result auglag_minimize(int n, nlopt_func f, void *f_data,
          *minf = fcur;
          minf_penalty = penalty;
          minf_feasible = feasible;
-         d.rho = MAX(1e-6, MIN(10, 2 * fabs(*minf) / con2));
+         d.rho = (con2 > 0) ? MAX(1e-6, MIN(10, 2 * fabs(*minf) / con2)) : 10;
      }
      else
          d.rho = 1; /* whatever, doesn't matter */