Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Duplicate
-
2.1
-
None
-
None
Description
I think that we could make the usage (from the developer's point-of-view) of "optimization.univariate" more similar to what is done in "optimization.general". At first this looked like a small change but then I discovered that "AbstractUnivariateRealOptimizer" competes with "ConvergingAlgorithmImpl" for some functionality, and that everything could be more coherent by enforcing the use of accessors and avoiding "protected" fields.
Moreover the logic inside "AbstractUnivariateRealOptimizer" seems convoluted and one change leading to another...
Currently only "BrentOptimizer" inherits from "AbstractUnivariateRealOptimizer", so I hope that it's OK to revise that class.
In "ConvergingAlgorithmImpl", I propose to add a method:
protected void incrementIterationsCounter() throws ConvergenceException { if (++iterationCount > maximalIterationCount) { throw new ConvergenceException(new MaxIterationsExceededException(maximalIterationCount)); } }
This is still not the best since in "BaseAbstractScalarOptimizer", we have
protected void incrementIterationsCounter() throws OptimizationException { if (++iterations > maxIterations) { throw new OptimizationException(new MaxIterationsExceededException(maxIterations)); } }
(thus: two codes for the same problem, throwing different exceptions).
Then it seems that there is also a functionality overlap between "ConvergingAlgorithm" and "ConvergenceChecker"...
Attachments
Issue Links
- is part of
-
MATH-413 Miscellaneous issues concerning the "optimization" package
- Closed