Java Code Examples for org.apache.commons.math3.exception.util.LocalizedFormats#UNABLE_TO_BRACKET_OPTIMUM_IN_LINE_SEARCH

The following examples show how to use org.apache.commons.math3.exception.util.LocalizedFormats#UNABLE_TO_BRACKET_OPTIMUM_IN_LINE_SEARCH . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Math_6_NonLinearConjugateGradientOptimizer_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Finds the upper bound b ensuring bracketing of a root between a and b.
 *
 * @param f function whose root must be bracketed.
 * @param a lower bound of the interval.
 * @param h initial step to try.
 * @return b such that f(a) and f(b) have opposite signs.
 * @throws MathIllegalStateException if no bracket can be found.
 */
private double findUpperBound(final UnivariateFunction f,
                              final double a, final double h) {
    final double yA = f.value(a);
    double yB = yA;
    for (double step = h; step < Double.MAX_VALUE; step *= FastMath.max(2, yA / yB)) {
        final double b = a + step;
        yB = f.value(b);
        if (yA * yB <= 0) {
            return b;
        }
    }
    throw new MathIllegalStateException(LocalizedFormats.UNABLE_TO_BRACKET_OPTIMUM_IN_LINE_SEARCH);
}
 
Example 2
Source File: Math_6_NonLinearConjugateGradientOptimizer_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Finds the upper bound b ensuring bracketing of a root between a and b.
 *
 * @param f function whose root must be bracketed.
 * @param a lower bound of the interval.
 * @param h initial step to try.
 * @return b such that f(a) and f(b) have opposite signs.
 * @throws MathIllegalStateException if no bracket can be found.
 */
private double findUpperBound(final UnivariateFunction f,
                              final double a, final double h) {
    final double yA = f.value(a);
    double yB = yA;
    for (double step = h; step < Double.MAX_VALUE; step *= FastMath.max(2, yA / yB)) {
        final double b = a + step;
        yB = f.value(b);
        if (yA * yB <= 0) {
            return b;
        }
    }
    throw new MathIllegalStateException(LocalizedFormats.UNABLE_TO_BRACKET_OPTIMUM_IN_LINE_SEARCH);
}
 
Example 3
Source File: NonLinearConjugateGradientOptimizer.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Find the upper bound b ensuring bracketing of a root between a and b.
 *
 * @param f function whose root must be bracketed.
 * @param a lower bound of the interval.
 * @param h initial step to try.
 * @return b such that f(a) and f(b) have opposite signs.
 * @throws MathIllegalStateException if no bracket can be found.
 */
private double findUpperBound(final UnivariateFunction f,
                              final double a, final double h) {
    final double yA = f.value(a);
    double yB = yA;
    for (double step = h; step < Double.MAX_VALUE; step *= FastMath.max(2, yA / yB)) {
        final double b = a + step;
        yB = f.value(b);
        if (yA * yB <= 0) {
            return b;
        }
    }
    throw new MathIllegalStateException(LocalizedFormats.UNABLE_TO_BRACKET_OPTIMUM_IN_LINE_SEARCH);
}
 
Example 4
Source File: NonLinearConjugateGradientOptimizer.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Find the upper bound b ensuring bracketing of a root between a and b.
 *
 * @param f function whose root must be bracketed.
 * @param a lower bound of the interval.
 * @param h initial step to try.
 * @return b such that f(a) and f(b) have opposite signs.
 * @throws MathIllegalStateException if no bracket can be found.
 */
private double findUpperBound(final UnivariateFunction f,
                              final double a, final double h) {
    final double yA = f.value(a);
    double yB = yA;
    for (double step = h; step < Double.MAX_VALUE; step *= FastMath.max(2, yA / yB)) {
        final double b = a + step;
        yB = f.value(b);
        if (yA * yB <= 0) {
            return b;
        }
    }
    throw new MathIllegalStateException(LocalizedFormats.UNABLE_TO_BRACKET_OPTIMUM_IN_LINE_SEARCH);
}
 
Example 5
Source File: NonLinearConjugateGradientOptimizer.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Find the upper bound b ensuring bracketing of a root between a and b.
 *
 * @param f function whose root must be bracketed.
 * @param a lower bound of the interval.
 * @param h initial step to try.
 * @return b such that f(a) and f(b) have opposite signs.
 * @throws MathIllegalStateException if no bracket can be found.
 */
private double findUpperBound(final UnivariateFunction f,
                              final double a, final double h) {
    final double yA = f.value(a);
    double yB = yA;
    for (double step = h; step < Double.MAX_VALUE; step *= FastMath.max(2, yA / yB)) {
        final double b = a + step;
        yB = f.value(b);
        if (yA * yB <= 0) {
            return b;
        }
    }
    throw new MathIllegalStateException(LocalizedFormats.UNABLE_TO_BRACKET_OPTIMUM_IN_LINE_SEARCH);
}
 
Example 6
Source File: NonLinearConjugateGradientOptimizer.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Find the upper bound b ensuring bracketing of a root between a and b.
 *
 * @param f function whose root must be bracketed.
 * @param a lower bound of the interval.
 * @param h initial step to try.
 * @return b such that f(a) and f(b) have opposite signs.
 * @throws MathIllegalStateException if no bracket can be found.
 */
private double findUpperBound(final UnivariateFunction f,
                              final double a, final double h) {
    final double yA = f.value(a);
    double yB = yA;
    for (double step = h; step < Double.MAX_VALUE; step *= FastMath.max(2, yA / yB)) {
        final double b = a + step;
        yB = f.value(b);
        if (yA * yB <= 0) {
            return b;
        }
    }
    throw new MathIllegalStateException(LocalizedFormats.UNABLE_TO_BRACKET_OPTIMUM_IN_LINE_SEARCH);
}
 
Example 7
Source File: NonLinearConjugateGradientOptimizer.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Finds the upper bound b ensuring bracketing of a root between a and b.
 *
 * @param f function whose root must be bracketed.
 * @param a lower bound of the interval.
 * @param h initial step to try.
 * @return b such that f(a) and f(b) have opposite signs.
 * @throws MathIllegalStateException if no bracket can be found.
 */
private double findUpperBound(final UnivariateFunction f,
                              final double a, final double h) {
    final double yA = f.value(a);
    double yB = yA;
    for (double step = h; step < Double.MAX_VALUE; step *= FastMath.max(2, yA / yB)) {
        final double b = a + step;
        yB = f.value(b);
        if (yA * yB <= 0) {
            return b;
        }
    }
    throw new MathIllegalStateException(LocalizedFormats.UNABLE_TO_BRACKET_OPTIMUM_IN_LINE_SEARCH);
}
 
Example 8
Source File: NonLinearConjugateGradientOptimizer.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Find the upper bound b ensuring bracketing of a root between a and b.
 *
 * @param f function whose root must be bracketed.
 * @param a lower bound of the interval.
 * @param h initial step to try.
 * @return b such that f(a) and f(b) have opposite signs.
 * @throws MathIllegalStateException if no bracket can be found.
 */
private double findUpperBound(final UnivariateFunction f,
                              final double a, final double h) {
    final double yA = f.value(a);
    double yB = yA;
    for (double step = h; step < Double.MAX_VALUE; step *= FastMath.max(2, yA / yB)) {
        final double b = a + step;
        yB = f.value(b);
        if (yA * yB <= 0) {
            return b;
        }
    }
    throw new MathIllegalStateException(LocalizedFormats.UNABLE_TO_BRACKET_OPTIMUM_IN_LINE_SEARCH);
}
 
Example 9
Source File: NonLinearConjugateGradientOptimizer.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Find the upper bound b ensuring bracketing of a root between a and b.
 *
 * @param f function whose root must be bracketed.
 * @param a lower bound of the interval.
 * @param h initial step to try.
 * @return b such that f(a) and f(b) have opposite signs.
 * @throws MathIllegalStateException if no bracket can be found.
 */
private double findUpperBound(final UnivariateFunction f,
                              final double a, final double h) {
    final double yA = f.value(a);
    double yB = yA;
    for (double step = h; step < Double.MAX_VALUE; step *= FastMath.max(2, yA / yB)) {
        final double b = a + step;
        yB = f.value(b);
        if (yA * yB <= 0) {
            return b;
        }
    }
    throw new MathIllegalStateException(LocalizedFormats.UNABLE_TO_BRACKET_OPTIMUM_IN_LINE_SEARCH);
}
 
Example 10
Source File: NonLinearConjugateGradientOptimizer.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Finds the upper bound b ensuring bracketing of a root between a and b.
 *
 * @param f function whose root must be bracketed.
 * @param a lower bound of the interval.
 * @param h initial step to try.
 * @return b such that f(a) and f(b) have opposite signs.
 * @throws MathIllegalStateException if no bracket can be found.
 */
private double findUpperBound(final UnivariateFunction f,
                              final double a, final double h) {
    final double yA = f.value(a);
    double yB = yA;
    for (double step = h; step < Double.MAX_VALUE; step *= FastMath.max(2, yA / yB)) {
        final double b = a + step;
        yB = f.value(b);
        if (yA * yB <= 0) {
            return b;
        }
    }
    throw new MathIllegalStateException(LocalizedFormats.UNABLE_TO_BRACKET_OPTIMUM_IN_LINE_SEARCH);
}
 
Example 11
Source File: NonLinearConjugateGradientOptimizer.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Find the upper bound b ensuring bracketing of a root between a and b.
 *
 * @param f function whose root must be bracketed.
 * @param a lower bound of the interval.
 * @param h initial step to try.
 * @return b such that f(a) and f(b) have opposite signs.
 * @throws MathIllegalStateException if no bracket can be found.
 */
private double findUpperBound(final UnivariateFunction f,
                              final double a, final double h) {
    final double yA = f.value(a);
    double yB = yA;
    for (double step = h; step < Double.MAX_VALUE; step *= FastMath.max(2, yA / yB)) {
        final double b = a + step;
        yB = f.value(b);
        if (yA * yB <= 0) {
            return b;
        }
    }
    throw new MathIllegalStateException(LocalizedFormats.UNABLE_TO_BRACKET_OPTIMUM_IN_LINE_SEARCH);
}
 
Example 12
Source File: NonLinearConjugateGradientOptimizer.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Finds the upper bound b ensuring bracketing of a root between a and b.
 *
 * @param f function whose root must be bracketed.
 * @param a lower bound of the interval.
 * @param h initial step to try.
 * @return b such that f(a) and f(b) have opposite signs.
 * @throws MathIllegalStateException if no bracket can be found.
 */
private double findUpperBound(final UnivariateFunction f,
                              final double a, final double h) {
    final double yA = f.value(a);
    double yB = yA;
    for (double step = h; step < Double.MAX_VALUE; step *= FastMath.max(2, yA / yB)) {
        final double b = a + step;
        yB = f.value(b);
        if (yA * yB <= 0) {
            return b;
        }
    }
    throw new MathIllegalStateException(LocalizedFormats.UNABLE_TO_BRACKET_OPTIMUM_IN_LINE_SEARCH);
}
 
Example 13
Source File: NonLinearConjugateGradientOptimizer.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Find the upper bound b ensuring bracketing of a root between a and b.
 *
 * @param f function whose root must be bracketed.
 * @param a lower bound of the interval.
 * @param h initial step to try.
 * @return b such that f(a) and f(b) have opposite signs.
 * @throws MathIllegalStateException if no bracket can be found.
 */
private double findUpperBound(final UnivariateFunction f,
                              final double a, final double h) {
    final double yA = f.value(a);
    double yB = yA;
    for (double step = h; step < Double.MAX_VALUE; step *= FastMath.max(2, yA / yB)) {
        final double b = a + step;
        yB = f.value(b);
        if (yA * yB <= 0) {
            return b;
        }
    }
    throw new MathIllegalStateException(LocalizedFormats.UNABLE_TO_BRACKET_OPTIMUM_IN_LINE_SEARCH);
}