Skip to content

Commit 6b0247c

Browse files
authored
Update Optimization.h
Remove pointless multiplication by (1 + errorTolerance) which sometimes made the optimizer always run the maximum number of iterations.
1 parent 6652b86 commit 6b0247c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

include/LazyMath/Optimization.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ class Minimizer
222222
tmpNorm = norm2(tmpFx);
223223

224224
// Was there enough progress?
225-
if (tmpNorm * (1 + errorTolerance) < _minNorm) {
225+
if (tmpNorm < _minNorm) {
226226
_minX = tmpX;
227227
_minFx = tmpFx;
228228
_minNorm = tmpNorm;
@@ -545,7 +545,7 @@ class ConstrainedMinimizer
545545
tmpNormFxGx += (_mu * (tmpGx[i] * tmpGx[i]) + 2 * tmpGx[i] * _minZ[i] + (_minZ[i] * _minZ[i]) / _mu);
546546

547547
// Was there enough progress?
548-
if (tmpNormFxGx * (1 + errorTolerance) < minNormFxGx) {
548+
if (tmpNormFxGx < minNormFxGx) {
549549
_minX = tmpX;
550550
_minFx = tmpFx;
551551
_minGx = tmpGx;
@@ -618,4 +618,4 @@ class ConstrainedMinimizer
618618

619619
} // namespace LazyMath
620620

621-
#endif // LAZY_OPTIMIZATION_H
621+
#endif // LAZY_OPTIMIZATION_H

0 commit comments

Comments
 (0)