/** * {@inheritDoc} * * @throws TooManyEvaluationsException */ public void trigger(int max) { throw new TooManyEvaluationsException(max); } }
/** * Construct the exception. * * @param max Maximum number of evaluations. */ public TooManyEvaluationsException(Number max) { super(max); getContext().addMessage(LocalizedFormats.EVALUATIONS); } }
public void regress(int[] target, int numValues, double[][] regressors) { try { int numParams = regressors.length + 1; double[] coefficients = new double[(numValues - 1) * numParams]; // Apparently this needs to be fairly loose. int tolerance = 250; MultivariateOptimizer search = new PowellOptimizer(tolerance, tolerance); PointValuePair pair = search.optimize( new InitialGuess(coefficients), new ObjectiveFunction(new FittingFunction(target, regressors)), GoalType.MAXIMIZE, new MaxEval(1000000) ); this.likelihood = pair.getValue(); } catch (TooManyEvaluationsException e) { e.printStackTrace(); this.likelihood = Double.NaN; } }
/** * {@inheritDoc} * @throws TooManyEvaluationsException */ public void trigger(int max) { throw new TooManyEvaluationsException(max); } }
/** * Construct the exception. * * @param max Maximum number of evaluations. */ public TooManyEvaluationsException(Number max) { super(max); getContext().addMessage(LocalizedFormats.EVALUATIONS); } }
/** * Increment the evaluation count by one. * Method {@link #computeObjectiveValue(double)} calls this method internally. * It is provided for subclasses that do not exclusively use * {@code computeObjectiveValue} to solve the function. * See e.g. {@link AbstractUnivariateDifferentiableSolver}. * * @throws TooManyEvaluationsException when the allowed number of function * evaluations has been exhausted. */ protected void incrementEvaluationCount() throws TooManyEvaluationsException { try { evaluations.increment(); } catch (MaxCountExceededException e) { throw new TooManyEvaluationsException(e.getMax()); } } }
/** * Construct the exception. * * @param max Maximum number of evaluations. */ public TooManyEvaluationsException(Number max) { super(max); getContext().addMessage(LocalizedFormats.EVALUATIONS); } }
/** * @param f Function. * @param x Argument. * @return {@code f(x)} * @throws TooManyEvaluationsException if the maximal number of evaluations is * exceeded. */ private double eval(UnivariateFunction f, double x) { try { evaluations.increment(); } catch (MaxCountExceededException e) { throw new TooManyEvaluationsException(e.getMax()); } return f.value(x); } }
/** * Compute the objective function value. * * @param point Point at which the objective function must be evaluated. * @return the objective function value at the specified point. * @throws TooManyEvaluationsException if the maximal number of evaluations is * exceeded. */ protected double[] computeObjectiveValue(double[] point) { try { evaluations.incrementCount(); } catch (MaxCountExceededException e) { throw new TooManyEvaluationsException(e.getMax()); } return function.value(point); }
/** * Compute the objective function value. * * @param point Point at which the objective function must be evaluated. * @return the objective function value at specified point. * @throws TooManyEvaluationsException if the maximal number of evaluations * is exceeded. */ protected double computeObjectiveValue(double point) { try { evaluations.incrementCount(); } catch (MaxCountExceededException e) { throw new TooManyEvaluationsException(e.getMax()); } return function.value(point); }
/** * Compute the objective function value. * * @param point Point at which the objective function must be evaluated. * @return the objective function value at the specified point. * @throws TooManyEvaluationsException if the maximal number of * evaluations is exceeded. */ protected double computeObjectiveValue(double[] point) { try { evaluations.incrementCount(); } catch (MaxCountExceededException e) { throw new TooManyEvaluationsException(e.getMax()); } return function.value(point); }
/** * @param f Function. * @param x Argument. * @return {@code f(x)} * @throws TooManyEvaluationsException if the maximal number of evaluations is * exceeded. */ private double eval(UnivariateFunction f, double x) { try { evaluations.incrementCount(); } catch (MaxCountExceededException e) { throw new TooManyEvaluationsException(e.getMax()); } return f.value(x); } }
/** * Compute the objective function value. * * @param point Point at which the objective function must be evaluated. * @return the objective function value at specified point. * @throws TooManyEvaluationsException if the maximal number of function * evaluations is exceeded. */ protected double computeObjectiveValue(final double point) throws TooManyEvaluationsException { try { evaluations.increment(); } catch (MaxCountExceededException e) { throw new TooManyEvaluationsException(e.getMax()); } return function.value(point); }
while (s == null) { if (attempts++ >= getMaxEvaluations()) { throw new TooManyEvaluationsException(getMaxEvaluations());
/** * {@inheritDoc} * @throws TooManyEvaluationsException */ public void trigger(int max) { throw new TooManyEvaluationsException(max); } }
/** * {@inheritDoc} * * @throws TooManyEvaluationsException */ public void trigger(int max) { throw new TooManyEvaluationsException(max); } }
/** * {@inheritDoc} * @throws TooManyEvaluationsException */ public void trigger(int max) { throw new TooManyEvaluationsException(max); } }
/** * {@inheritDoc} * * @throws TooManyEvaluationsException */ public void trigger(int max) { throw new TooManyEvaluationsException(max); } }
/** * Increment the evaluation count by one. * Method {@link #computeObjectiveValue(double)} calls this method internally. * It is provided for subclasses that do not exclusively use * {@code computeObjectiveValue} to solve the function. * See e.g. {@link AbstractUnivariateDifferentiableSolver}. * * @throws TooManyEvaluationsException when the allowed number of function * evaluations has been exhausted. */ protected void incrementEvaluationCount() throws TooManyEvaluationsException { try { evaluations.increment(); } catch (MaxCountExceededException e) { throw new TooManyEvaluationsException(e.getMax()); } } }
/** * Increment the evaluation count by one. * Method {@link #computeObjectiveValue(double)} calls this method internally. * It is provided for subclasses that do not exclusively use * {@code computeObjectiveValue} to solve the function. * See e.g. {@link AbstractUnivariateDifferentiableSolver}. * * @throws TooManyEvaluationsException when the allowed number of function * evaluations has been exhausted. */ protected void incrementEvaluationCount() throws TooManyEvaluationsException { try { evaluations.increment(); } catch (MaxCountExceededException e) { throw new TooManyEvaluationsException(e.getMax()); } } }