Java Code Examples for org.apache.commons.math.exception.util.LocalizedFormats#MAX_EVALUATIONS_EXCEEDED

The following examples show how to use org.apache.commons.math.exception.util.LocalizedFormats#MAX_EVALUATIONS_EXCEEDED . 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: AbstractEstimator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Update the residuals array and cost function value.
 * @exception EstimationException if the number of cost evaluations
 * exceeds the maximum allowed
 */
protected void updateResidualsAndCost()
throws EstimationException {

    if (++costEvaluations > maxCostEval) {
        throw new EstimationException(LocalizedFormats.MAX_EVALUATIONS_EXCEEDED,
                                      maxCostEval);
    }

    cost = 0;
    int index = 0;
    for (int i = 0; i < rows; i++, index += cols) {
        WeightedMeasurement wm = measurements[i];
        double residual = wm.getResidual();
        residuals[i] = FastMath.sqrt(wm.getWeight()) * residual;
        cost += wm.getWeight() * residual * residual;
    }
    cost = FastMath.sqrt(cost);

}
 
Example 2
Source File: MaxEvaluationsExceededException.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Constructs an exception with a default detail message.
 * @param maxEvaluations maximal number of evaluations allowed
 */
public MaxEvaluationsExceededException(final int maxEvaluations) {
    super(LocalizedFormats.MAX_EVALUATIONS_EXCEEDED, maxEvaluations);
    this.maxEvaluations = maxEvaluations;
}
 
Example 3
Source File: MaxEvaluationsExceededException.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Constructs an exception with a default detail message.
 * @param maxEvaluations maximal number of evaluations allowed
 */
public MaxEvaluationsExceededException(final int maxEvaluations) {
    super(LocalizedFormats.MAX_EVALUATIONS_EXCEEDED, maxEvaluations);
    this.maxEvaluations = maxEvaluations;
}
 
Example 4
Source File: MaxEvaluationsExceededException.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Constructs an exception with a default detail message.
 * @param maxEvaluations maximal number of evaluations allowed
 */
public MaxEvaluationsExceededException(final int maxEvaluations) {
    super(LocalizedFormats.MAX_EVALUATIONS_EXCEEDED, maxEvaluations);
    this.maxEvaluations = maxEvaluations;
}
 
Example 5
Source File: MaxEvaluationsExceededException.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Constructs an exception with a default detail message.
 * @param maxEvaluations maximal number of evaluations allowed
 */
public MaxEvaluationsExceededException(final int maxEvaluations) {
    super(LocalizedFormats.MAX_EVALUATIONS_EXCEEDED, maxEvaluations);
    this.maxEvaluations = maxEvaluations;
}