From: ametama Date: Thu, 15 Jan 2026 11:10:31 +0000 (+0100) Subject: fix(de): convergence counter reassignment X-Git-Url: https://git.wafflesoft.org/?a=commitdiff_plain;h=cf8fcff146f61582bb0de7d1728b90ab096c9296;p=cgo.git fix(de): convergence counter reassignment --- diff --git a/src/de.c b/src/de.c index 8377787..441312b 100644 --- a/src/de.c +++ b/src/de.c @@ -25,7 +25,10 @@ void de_optimize(de_parameters *par, double *res) { if (i == r || rands() < par->cr) y[i] = picks[1][i] + par->dw * (picks[2][i] - picks[3][i]); else y[i] = x[i]; } - if (par->f(y) <= par->f(x)) vec_copy(par->dim, y, x); + if (par->f(y) < par->f(x)) { + vec_copy(par->dim, y, x); + conv = 0; + } else conv++; } }