Class AbstractUnivariateRealOptimizer

    • Field Detail

      • resultComputed

        protected boolean resultComputed
        Indicates where a root has been computed.
      • result

        protected double result
        The last computed root.
      • functionValue

        protected double functionValue
        Value of the function at the last computed result.
    • Constructor Detail

      • AbstractUnivariateRealOptimizer

        @Deprecated
        protected AbstractUnivariateRealOptimizer​(int defaultMaximalIterationCount,
                                                  double defaultAbsoluteAccuracy)
        Deprecated.
        in 2.2. Please use the "setter" methods to assign meaningful values to the maximum numbers of iterations and evaluations, and to the absolute and relative accuracy thresholds.
        Construct a solver with given iteration count and accuracy.
        Parameters:
        defaultAbsoluteAccuracy - maximum absolute error
        defaultMaximalIterationCount - maximum number of iterations
        Throws:
        java.lang.IllegalArgumentException - if f is null or the defaultAbsoluteAccuracy is not valid
      • AbstractUnivariateRealOptimizer

        protected AbstractUnivariateRealOptimizer()
        Default constructor. To be removed once the single non-default one has been removed.
    • Method Detail

      • checkResultComputed

        @Deprecated
        protected void checkResultComputed()
        Deprecated.
        in 2.2 (no alternative).
        Check whether a result has been computed.
        Throws:
        NoDataException - if no result has been computed
      • getResult

        public double getResult()
        Get the result of the last run of the optimizer.
        Specified by:
        getResult in interface UnivariateRealOptimizer
        Returns:
        the optimum.
      • setResult

        @Deprecated
        protected final void setResult​(double x,
                                       double fx,
                                       int iterationCount)
        Deprecated.
        in 2.2 (no alternative).
        Convenience function for implementations.
        Parameters:
        x - the result to set
        fx - the result to set
        iterationCount - the iteration count to set
      • clearResult

        @Deprecated
        protected final void clearResult()
        Deprecated.
        in 2.2 (no alternative).
        Convenience function for implementations.
      • setMaxEvaluations

        public void setMaxEvaluations​(int maxEvaluations)
        Set the maximal number of functions evaluations.
        Specified by:
        setMaxEvaluations in interface UnivariateRealOptimizer
        Parameters:
        maxEvaluations - maximal number of function evaluations
      • getMaxEvaluations

        public int getMaxEvaluations()
        Get the maximal number of functions evaluations.
        Specified by:
        getMaxEvaluations in interface UnivariateRealOptimizer
        Returns:
        the maximal number of functions evaluations.
      • getEvaluations

        public int getEvaluations()
        Get the number of evaluations of the objective function.

        The number of evaluations corresponds to the last call to the optimize method. It is 0 if the method has not been called yet.

        Specified by:
        getEvaluations in interface UnivariateRealOptimizer
        Returns:
        the number of evaluations of the objective function.
      • getGoalType

        public GoalType getGoalType()
        Returns:
        the optimization type.
      • getMin

        public double getMin()
        Returns:
        the lower of the search interval.
      • getMax

        public double getMax()
        Returns:
        the higher of the search interval.
      • getStartValue

        public double getStartValue()
        Returns:
        the initial guess.
      • computeObjectiveValue

        @Deprecated
        protected double computeObjectiveValue​(UnivariateRealFunction f,
                                               double point)
                                        throws FunctionEvaluationException
        Deprecated.
        in 2.2. Use this replacement instead.
        Compute the objective function value.
        Parameters:
        f - objective function
        point - point at which the objective function must be evaluated
        Returns:
        objective function value at specified point
        Throws:
        FunctionEvaluationException - if the function cannot be evaluated or the maximal number of iterations is exceeded
      • computeObjectiveValue

        protected double computeObjectiveValue​(double point)
                                        throws FunctionEvaluationException
        Compute the objective function value.
        Parameters:
        point - Point at which the objective function must be evaluated.
        Returns:
        the objective function value at specified point.
        Throws:
        FunctionEvaluationException - if the function cannot be evaluated or the maximal number of iterations is exceeded.
      • setFunctionValue

        protected void setFunctionValue​(double functionValue)
        Set the value at the optimum.
        Parameters:
        functionValue - Value of the objective function at the optimum.