Interface UnivariateRealOptimizer

    • Method Detail

      • setMaxEvaluations

        void setMaxEvaluations​(int maxEvaluations)
        Set the maximal number of functions evaluations.
        Parameters:
        maxEvaluations - maximal number of function evaluations
      • getMaxEvaluations

        int getMaxEvaluations()
        Get the maximal number of functions evaluations.
        Returns:
        the maximal number of functions evaluations.
      • getEvaluations

        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.

        Returns:
        the number of evaluations of the objective function.
      • optimize

        double optimize​(UnivariateRealFunction f,
                        GoalType goalType,
                        double min,
                        double max)
                 throws ConvergenceException,
                        FunctionEvaluationException
        Find an optimum in the given interval.

        An optimizer may require that the interval brackets a single optimum.

        Parameters:
        f - the function to optimize.
        goalType - type of optimization goal: either GoalType.MAXIMIZE or GoalType.MINIMIZE.
        min - the lower bound for the interval.
        max - the upper bound for the interval.
        Returns:
        a value where the function is optimum.
        Throws:
        ConvergenceException - if the maximum iteration count is exceeded or the optimizer detects convergence problems otherwise.
        FunctionEvaluationException - if an error occurs evaluating the function.
        java.lang.IllegalArgumentException - if min > max or the endpoints do not satisfy the requirements specified by the optimizer.
      • optimize

        double optimize​(UnivariateRealFunction f,
                        GoalType goalType,
                        double min,
                        double max,
                        double startValue)
                 throws ConvergenceException,
                        FunctionEvaluationException
        Find an optimum in the given interval, start at startValue.

        An optimizer may require that the interval brackets a single optimum.

        Parameters:
        f - the function to optimize.
        goalType - type of optimization goal: either GoalType.MAXIMIZE or GoalType.MINIMIZE.
        min - the lower bound for the interval.
        max - the upper bound for the interval.
        startValue - the start value to use.
        Returns:
        a value where the function is optimum.
        Throws:
        ConvergenceException - if the maximum iteration count is exceeded or the optimizer detects convergence problems otherwise.
        FunctionEvaluationException - if an error occurs evaluating the function.
        java.lang.IllegalArgumentException - if min > max or the arguments do not satisfy the requirements specified by the optimizer.
        java.lang.IllegalStateException - if there are no data.
      • getResult

        double getResult()
        Get the result of the last run of the optimizer.
        Returns:
        the optimum.
        Throws:
        java.lang.IllegalStateException - if there is no result available, either because no result was yet computed or the last attempt failed.
      • getFunctionValue

        double getFunctionValue()
                         throws FunctionEvaluationException
        Get the result of the last run of the optimizer.
        Returns:
        the value of the function at the optimum.
        Throws:
        FunctionEvaluationException - if an error occurs evaluating the function.
        java.lang.IllegalStateException - if there is no result available, either because no result was yet computed or the last attempt failed.