Uploaded image for project: 'Commons Math'
  1. Commons Math
  2. MATH-397

Inconsistencies between "optimization.univariate" and "optimization.general"

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 2.1
    • 3.0
    • 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

          Activity

            People

              erans Gilles Sadowski
              erans Gilles Sadowski
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: