chiark
/
gitweb
/
~ianmdlvl
/
nlopt.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1400d46
)
fixed another nasty bug, where we could accidentally return an "optimum" that is...
author
stevenj
<stevenj@alum.mit.edu>
Wed, 20 Aug 2008 05:35:04 +0000
(
01:35
-0400)
committer
stevenj
<stevenj@alum.mit.edu>
Wed, 20 Aug 2008 05:35:04 +0000
(
01:35
-0400)
darcs-hash:
20080820053504
-c8de0-
4764f25b825f59b6a4f4312d59b75fd2a3c8736c
.gz
mma/mma.c
patch
|
blob
|
history
diff --git
a/mma/mma.c
b/mma/mma.c
index fdf6c9242b25d80e749ca2b719d0f02fa7186f68..19b9f1b73e442beb533406b7712252c876d25710 100644
(file)
--- a/
mma/mma.c
+++ b/
mma/mma.c
@@
-226,18
+226,20
@@
nlopt_result mma_minimize(int n, nlopt_func f, void *f_data,
for (i = 0; i < m; ++i) {
fcval_cur[i] = fc(n, xcur, dfcdx_cur + i*n,
fc_data + fc_datum_size * i);
for (i = 0; i < m; ++i) {
fcval_cur[i] = fc(n, xcur, dfcdx_cur + i*n,
fc_data + fc_datum_size * i);
- feasible_cur = feasible_cur && (fcval[i] <= 0);
+ feasible_cur = feasible_cur && (fcval
_cur
[i] <= 0);
inner_done = inner_done && (dd.gcval[i] >= fcval_cur[i]);
}
/* once we have reached a feasible solution, the
algorithm should never make the solution infeasible
inner_done = inner_done && (dd.gcval[i] >= fcval_cur[i]);
}
/* once we have reached a feasible solution, the
algorithm should never make the solution infeasible
- again
, although the constraints may be violated
- slightly by rounding errors etc. so we must be a
- little careful about checking feasibility */
+ again
(if inner_done), although the constraints may
+ be violated slightly by rounding errors etc. so we
+
must be a
little careful about checking feasibility */
if (feasible_cur) feasible = 1;
if (feasible_cur) feasible = 1;
- if (fcur < *minf) {
+ if (fcur < *minf && (inner_done || feasible_cur || !feasible)) {
+ if (mma_verbose && !feasible_cur)
+ printf("MMA - using infeasible point?\n");
dd.fval = *minf = fcur;
memcpy(fcval, fcval_cur, sizeof(double)*m);
memcpy(x, xcur, sizeof(double)*n);
dd.fval = *minf = fcur;
memcpy(fcval, fcval_cur, sizeof(double)*m);
memcpy(x, xcur, sizeof(double)*n);