double initialBracketingRange) { mainOptimizer = optimizer; lineOptimizer = new BrentOptimizer(REL_TOL_UNUSED, ABS_TOL_UNUSED, new SimpleUnivariateValueChecker(relativeTolerance,
final boolean isMinim = getGoalType() == GoalType.MINIMIZE; final double lo = getMin(); final double mid = getStartValue(); final double hi = getMax(); = getConvergenceChecker(); double d = 0; double e = 0; double fx = computeObjectiveValue(x); if (!isMinim) { fx = -fx; double fu = computeObjectiveValue(u); if (!isMinim) { fu = -fu; best = best(best, best(previous, current, isMinim), isMinim); if (checker != null && checker.converged(getIterations(), previous, current)) { return best; return best(best, best(previous, current,
/** * Maximizes a univariate function using a grid search followed by Brent's algorithm. * * @param fn the likelihood function to minimize * @param gridStart the lower bound for the grid search * @param gridEnd the upper bound for the grid search * @param gridStep step size for the grid search * @param relErr relative error tolerance for Brent's algorithm * @param absErr absolute error tolerance for Brent's algorithm * @param maxIter maximum # of iterations to perform in Brent's algorithm * @param maxEval maximum # of Likelihood function evaluations in Brent's algorithm * * @return the value of the parameter that maximizes the function */ public static double maximize(UnivariateFunction fn, double gridStart, double gridEnd, double gridStep, double relErr, double absErr, int maxIter, int maxEval) { Interval interval = gridSearch(fn, gridStart, gridEnd, gridStep); BrentOptimizer bo = new BrentOptimizer(relErr, absErr); UnivariatePointValuePair max = bo.optimize( new MaxIter(maxIter), new MaxEval(maxEval), new SearchInterval(interval.getInf(), interval.getSup()), new UnivariateObjectiveFunction(fn), GoalType.MAXIMIZE); return max.getPoint(); } }
QuadraticFunction qFunc = new QuadraticFunction(optimum.getPoint()); BrentOptimizer bo = new BrentOptimizer(1e-10, 1e-14); UnivariatePointValuePair optimalMin = bo.optimize(GoalType.MINIMIZE, new SearchInterval(0, 512, 1), new UnivariateObjectiveFunction(qFunc),
final boolean isMinim = getGoalType() == GoalType.MINIMIZE; final double lo = getMin(); final double mid = getStartValue(); final double hi = getMax(); = getConvergenceChecker(); double d = 0; double e = 0; double fx = computeObjectiveValue(x); if (!isMinim) { fx = -fx; double fu = computeObjectiveValue(u); if (!isMinim) { fu = -fu; best = best(best, best(previous, current, isMinim), isMinim); if (checker != null && checker.converged(getIterations(), previous, current)) { return best; return best(best, best(previous, current,
/** * Default constructor. */ public ExtreumumFinderBrent() { this.brentOptimizer = new BrentOptimizer(Kernel.STANDARD_PRECISION, Kernel.MAX_PRECISION); }
/** * Maximizes a univariate function using a grid search followed by Brent's algorithm. * * @param fn the likelihood function to minimize * @param gridStart the lower bound for the grid search * @param gridEnd the upper bound for the grid search * @param gridStep step size for the grid search * @param relErr relative error tolerance for Brent's algorithm * @param absErr absolute error tolerance for Brent's algorithm * @param maxIter maximum # of iterations to perform in Brent's algorithm * @param maxEval maximum # of Likelihood function evaluations in Brent's algorithm * * @return the value of the parameter that maximizes the function */ public static double maximize(UnivariateFunction fn, double gridStart, double gridEnd, double gridStep, double relErr, double absErr, int maxIter, int maxEval) { Interval interval = gridSearch(fn, gridStart, gridEnd, gridStep); BrentOptimizer bo = new BrentOptimizer(relErr, absErr); UnivariatePointValuePair max = bo.optimize( new MaxIter(maxIter), new MaxEval(maxEval), new SearchInterval(interval.getInf(), interval.getSup()), new UnivariateObjectiveFunction(fn), GoalType.MAXIMIZE); return max.getPoint(); } }
final boolean isMinim = getGoalType() == GoalType.MINIMIZE; final double lo = getMin(); final double mid = getStartValue(); final double hi = getMax(); = getConvergenceChecker(); double d = 0; double e = 0; double fx = computeObjectiveValue(x); if (!isMinim) { fx = -fx; double fu = computeObjectiveValue(u); if (!isMinim) { fu = -fu; best = best(best, best(previous, current, isMinim), isMinim); if (checker != null && checker.converged(getIterations(), previous, current)) { return best; return best(best, best(previous, current,
double initialBracketingRange) { mainOptimizer = optimizer; lineOptimizer = new BrentOptimizer(REL_TOL_UNUSED, ABS_TOL_UNUSED, new SimpleUnivariateValueChecker(relativeTolerance,
double initialBracketingRange) { mainOptimizer = optimizer; lineOptimizer = new BrentOptimizer(REL_TOL_UNUSED, ABS_TOL_UNUSED, new SimpleUnivariateValueChecker(relativeTolerance,
/** * Maximum likelihood estimate (MLE) of examinee ability. * * @param thetaMin smallest possible ability estimate (lower bound on BrentOptimizer) * @param thetaMax largest possible ability estimate (upper bound on BrentOptimizer) * @return MLE of examinee ability */ public double maximumLikelihoodEstimate(double thetaMin, double thetaMax, int maxIter, double tolerance){ method = EstimationMethod.ML; UnivariateOptimizer optimizer = new BrentOptimizer(tolerance, 1e-14); UnivariatePointValuePair pair = optimizer.optimize(new MaxEval(maxIter), new UnivariateObjectiveFunction(this), GoalType.MAXIMIZE, new SearchInterval(thetaMin, thetaMax)); estimatedTheta = pair.getPoint(); return estimatedTheta; }
/** * Maximum a Posteriori (MAP) estimate of examinee ability using a normal prior * quadrature. * * @param mean mean of normal prior quadrature * @param sd standard deviation of prior quadrature * @param thetaMin smallest possible ability estimate (lower bound on BrentOptimizer) * @param thetaMax largest possible ability estimate (upper bound on BrentOptimizer) * @return MAP estimate of examinee ability */ public double mapEstimate(double mean, double sd, double thetaMin, double thetaMax, int maxIter, double tolerance){ mapPrior = new NormalDistribution(mean, sd); method = EstimationMethod.MAP; UnivariateOptimizer optimizer = new BrentOptimizer(tolerance, 1e-14); UnivariatePointValuePair pair = optimizer.optimize(new MaxEval(maxIter), new UnivariateObjectiveFunction(this), GoalType.MAXIMIZE, new SearchInterval(thetaMin, thetaMax)); estimatedTheta = pair.getPoint(); return estimatedTheta; }
UnivariateOptimizer underlying = new BrentOptimizer(1e-10, 1e-14); JDKRandomGenerator g = new JDKRandomGenerator();