root = forward ? bracketing.solve(maxIterationCount, f, ta, tb, AllowedSolution.RIGHT_SIDE) : bracketing.solve(maxIterationCount, f, tb, ta, AllowedSolution.LEFT_SIDE); } else { final double baseRoot = forward ? solver.solve(maxIterationCount, f, ta, tb) : solver.solve(maxIterationCount, f, tb, ta); final int remainingEval = maxIterationCount - solver.getEvaluations(); BracketedUnivariateSolver<UnivariateFunction> bracketing = new PegasusSolver(solver.getRelativeAccuracy(), solver.getAbsoluteAccuracy()); root = forward ? UnivariateSolverUtils.forceSide(remainingEval, f, bracketing,
/** * @param updateFormula formula to use for updating the β parameter, * must be one of {@link Formula#FLETCHER_REEVES} or * {@link Formula#POLAK_RIBIERE}. * @param checker Convergence checker. * @param lineSearchSolver Solver to use during line search. * @param preconditioner Preconditioner. * @deprecated as of 3.3. Please use * {@link #NonLinearConjugateGradientOptimizer(Formula,ConvergenceChecker,double,double,double,Preconditioner)} instead. */ @Deprecated public NonLinearConjugateGradientOptimizer(final Formula updateFormula, ConvergenceChecker<PointValuePair> checker, final UnivariateSolver lineSearchSolver, final Preconditioner preconditioner) { this(updateFormula, checker, lineSearchSolver.getRelativeAccuracy(), lineSearchSolver.getAbsoluteAccuracy(), lineSearchSolver.getAbsoluteAccuracy(), preconditioner); }
/** * Convenience method to find a zero of a univariate real function. A default * solver is used. * * @param function Function. * @param x0 Lower bound for the interval. * @param x1 Upper bound for the interval. * @param absoluteAccuracy Accuracy to be used by the solver. * @return a value where the function is zero. * @throws NoBracketingException if the function has the same sign at the * endpoints. * @throws NullArgumentException if {@code function} is {@code null}. */ public static double solve(UnivariateFunction function, double x0, double x1, double absoluteAccuracy) throws NullArgumentException, NoBracketingException { if (function == null) { throw new NullArgumentException(LocalizedFormats.FUNCTION); } final UnivariateSolver solver = new BrentSolver(absoluteAccuracy); return solver.solve(Integer.MAX_VALUE, function, x0, x1); }
final double step = solver.solve(maxEval, lsf, 0, uB, 1e-15); maxEval -= solver.getEvaluations(); // Subtract used up evaluations.
final double epsilon = FastMath.max(solver.getAbsoluteAccuracy(), FastMath.abs(solver.getRelativeAccuracy() * t0)); final double tStart = t0 + 0.5 * epsilon; interpolator.setInterpolatedTime(tStart);
/** * Convenience method to find a zero of a univariate real function. A default * solver is used. * * @param function Function. * @param x0 Lower bound for the interval. * @param x1 Upper bound for the interval. * @return a value where the function is zero. * @throws NoBracketingException if the function has the same sign at the * endpoints. * @throws NullArgumentException if {@code function} is {@code null}. */ public static double solve(UnivariateFunction function, double x0, double x1) throws NullArgumentException, NoBracketingException { if (function == null) { throw new NullArgumentException(LocalizedFormats.FUNCTION); } final UnivariateSolver solver = new BrentSolver(); return solver.solve(Integer.MAX_VALUE, function, x0, x1); }
final double step = solver.solve(maxEval, lsf, 0, uB, 1e-15); maxEval -= solver.getEvaluations(); // Subtract used up evaluations.
} else { final double baseRoot = forward ? solver.solve(maxIterationCount, f, ta, tb) : solver.solve(maxIterationCount, f, tb, ta); final int remainingEval = maxIterationCount - solver.getEvaluations(); BracketedUnivariateSolver<UnivariateFunction> bracketing = new PegasusSolver(solver.getRelativeAccuracy(), solver.getAbsoluteAccuracy()); root = forward ? UnivariateSolverUtils.forceSide(remainingEval, f, bracketing,
/** * @param updateFormula formula to use for updating the β parameter, * must be one of {@link Formula#FLETCHER_REEVES} or * {@link Formula#POLAK_RIBIERE}. * @param checker Convergence checker. * @param lineSearchSolver Solver to use during line search. * @param preconditioner Preconditioner. * @deprecated as of 3.3. Please use * {@link #NonLinearConjugateGradientOptimizer(Formula,ConvergenceChecker,double,double,double,Preconditioner)} instead. */ @Deprecated public NonLinearConjugateGradientOptimizer(final Formula updateFormula, ConvergenceChecker<PointValuePair> checker, final UnivariateSolver lineSearchSolver, final Preconditioner preconditioner) { this(updateFormula, checker, lineSearchSolver.getRelativeAccuracy(), lineSearchSolver.getAbsoluteAccuracy(), lineSearchSolver.getAbsoluteAccuracy(), preconditioner); }
public double idf(final double p){ UnivariateFunction f = new UnivariateFunction() { @Override public double value(double x) { double v = p-cdf(x); return v; } }; return solver.solve(5000, f, quadPoints[0], quadPoints[nPoints-1]); }
root = forward ? bracketing.solve(maxIterationCount, f, ta, tb, AllowedSolution.RIGHT_SIDE) : bracketing.solve(maxIterationCount, f, tb, ta, AllowedSolution.LEFT_SIDE); } else { final double baseRoot = forward ? solver.solve(maxIterationCount, f, ta, tb) : solver.solve(maxIterationCount, f, tb, ta); final int remainingEval = maxIterationCount - solver.getEvaluations(); BracketedUnivariateSolver<UnivariateFunction> bracketing = new PegasusSolver(solver.getRelativeAccuracy(), solver.getAbsoluteAccuracy()); root = forward ? UnivariateSolverUtils.forceSide(remainingEval, f, bracketing,
/** * @param updateFormula formula to use for updating the β parameter, * must be one of {@link Formula#FLETCHER_REEVES} or * {@link Formula#POLAK_RIBIERE}. * @param checker Convergence checker. * @param lineSearchSolver Solver to use during line search. * @param preconditioner Preconditioner. * @deprecated as of 3.3. Please use * {@link #NonLinearConjugateGradientOptimizer(Formula,ConvergenceChecker,double,double,double,Preconditioner)} instead. */ @Deprecated public NonLinearConjugateGradientOptimizer(final Formula updateFormula, ConvergenceChecker<PointValuePair> checker, final UnivariateSolver lineSearchSolver, final Preconditioner preconditioner) { this(updateFormula, checker, lineSearchSolver.getRelativeAccuracy(), lineSearchSolver.getAbsoluteAccuracy(), lineSearchSolver.getAbsoluteAccuracy(), preconditioner); }
/** * Convenience method to find a zero of a univariate real function. A default * solver is used. * * @param function Function. * @param x0 Lower bound for the interval. * @param x1 Upper bound for the interval. * @return a value where the function is zero. * @throws NoBracketingException if the function has the same sign at the * endpoints. * @throws NullArgumentException if {@code function} is {@code null}. */ public static double solve(UnivariateFunction function, double x0, double x1) throws NullArgumentException, NoBracketingException { if (function == null) { throw new NullArgumentException(LocalizedFormats.FUNCTION); } final UnivariateSolver solver = new BrentSolver(); return solver.solve(Integer.MAX_VALUE, function, x0, x1); }
final double epsilon = Math.max(solver.getAbsoluteAccuracy(), Math.abs(solver.getRelativeAccuracy() * t0)); final double tStart = t0 + 0.5 * epsilon; interpolator.setInterpolatedTime(tStart);
/** * Convenience method to find a zero of a univariate real function. A default * solver is used. * * @param function Function. * @param x0 Lower bound for the interval. * @param x1 Upper bound for the interval. * @return a value where the function is zero. * @throws NoBracketingException if the function has the same sign at the * endpoints. * @throws NullArgumentException if {@code function} is {@code null}. */ public static double solve(UnivariateFunction function, double x0, double x1) throws NullArgumentException, NoBracketingException { if (function == null) { throw new NullArgumentException(LocalizedFormats.FUNCTION); } final UnivariateSolver solver = new BrentSolver(); return solver.solve(Integer.MAX_VALUE, function, x0, x1); }
final double epsilon = FastMath.max(solver.getAbsoluteAccuracy(), FastMath.abs(solver.getRelativeAccuracy() * t0)); final double tStart = t0 + 0.5 * epsilon; interpolator.setInterpolatedTime(tStart);
/** * Convenience method to find a zero of a univariate real function. A default * solver is used. * * @param function Function. * @param x0 Lower bound for the interval. * @param x1 Upper bound for the interval. * @param absoluteAccuracy Accuracy to be used by the solver. * @return a value where the function is zero. * @throws NoBracketingException if the function has the same sign at the * endpoints. * @throws NullArgumentException if {@code function} is {@code null}. */ public static double solve(UnivariateFunction function, double x0, double x1, double absoluteAccuracy) throws NullArgumentException, NoBracketingException { if (function == null) { throw new NullArgumentException(LocalizedFormats.FUNCTION); } final UnivariateSolver solver = new BrentSolver(absoluteAccuracy); return solver.solve(Integer.MAX_VALUE, function, x0, x1); }
/** * Convenience method to find a zero of a univariate real function. A default * solver is used. * * @param function Function. * @param x0 Lower bound for the interval. * @param x1 Upper bound for the interval. * @param absoluteAccuracy Accuracy to be used by the solver. * @return a value where the function is zero. * @throws NoBracketingException if the function has the same sign at the * endpoints. * @throws NullArgumentException if {@code function} is {@code null}. */ public static double solve(UnivariateFunction function, double x0, double x1, double absoluteAccuracy) throws NullArgumentException, NoBracketingException { if (function == null) { throw new NullArgumentException(LocalizedFormats.FUNCTION); } final UnivariateSolver solver = new BrentSolver(absoluteAccuracy); return solver.solve(Integer.MAX_VALUE, function, x0, x1); }
double location = solver.solve(maxiter, func, min, max); unsortedMap.put(id, location);