optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/StatisticUtils.java
public static double[] determineStandardDeviationDoubles(
            List<? extends BenchmarkResult> benchmarkResultList, Score averageScore, int successCount) {
        if (successCount <= 0) {
            return null;
        }
        if (averageScore == null) {
            throw new IllegalArgumentException("Average score (" + averageScore + ") cannot be null.");
        }
        // averageScore can no longer be null
        double[] differenceSquaredTotalDoubles = null;
        for (BenchmarkResult benchmarkResult : benchmarkResultList) {
            if (benchmarkResult.hasAllSuccess()) {
                Score difference = benchmarkResult.getAverageScore().subtract(averageScore);
                // Calculations done on doubles to avoid common overflow when executing with an int score > 500 000
                double[] differenceDoubles = ScoreUtils.extractLevelDoubles(difference);
                if (differenceSquaredTotalDoubles == null) {
                    differenceSquaredTotalDoubles = new double[differenceDoubles.length];
                }
                for (int i = 0; i < differenceDoubles.length; i++) {
                    differenceSquaredTotalDoubles[i] += Math.pow(differenceDoubles[i], 2.0);
                }
            }
        }
        double[] standardDeviationDoubles = new double[differenceSquaredTotalDoubles.length];
        for (int i = 0; i < differenceSquaredTotalDoubles.length; i++) {
            standardDeviationDoubles[i] = Math.pow(differenceSquaredTotalDoubles[i] / successCount, 0.5);
        }
        return standardDeviationDoubles;
    }
public static double[] determineStandardDeviationDoubles(
            List<? extends BenchmarkResult> benchmarkResultList, Score averageScore, int successCount) {
        if (successCount <= 0) {
            return null;
        }
        if (averageScore == null) {
            throw new IllegalArgumentException("Average score (" + averageScore + ") cannot be null.");
        }
        // averageScore can no longer be null
        double[] differenceSquaredTotalDoubles = null;
        for (BenchmarkResult benchmarkResult : benchmarkResultList) {
            if (benchmarkResult.hasAllSuccess()) {
                Score difference = benchmarkResult.getAverageScore().subtract(averageScore);
                // Calculations done on doubles to avoid common overflow when executing with an int score > 500 000
                double[] differenceDoubles = ScoreUtils.extractLevelDoubles(difference);
                if (differenceSquaredTotalDoubles == null) {
                    differenceSquaredTotalDoubles = new double[differenceDoubles.length];
                }
                for (int i = 0; i < differenceDoubles.length; i++) {
                    differenceSquaredTotalDoubles[i] += Math.pow(differenceDoubles[i], 2.0);
                }
            }
        }
        double[] standardDeviationDoubles = new double[differenceSquaredTotalDoubles.length];
        for (int i = 0; i < differenceSquaredTotalDoubles.length; i++) {
            standardDeviationDoubles[i] = Math.pow(differenceSquaredTotalDoubles[i] / successCount, 0.5);
        }
        return standardDeviationDoubles;
    }
public static double [ ] determineStandardDeviationDoubles ( List < ? extends BenchmarkResult > benchmarkResultList , Score averageScore , int successCount ) { if ( successCount <= 0 ) { return null ; } if ( averageScore == null ) { throw new IllegalArgumentException ( "Average score (" + averageScore + ") cannot be null." ) ; } // averageScore can no longer be null double [ ] differenceSquaredTotalDoubles = null ; for ( BenchmarkResult benchmarkResult : benchmarkResultList ) { if ( benchmarkResult . hasAllSuccess ( ) ) { Score difference = benchmarkResult . getAverageScore ( ) . subtract ( averageScore ) ; // Calculations done on doubles to avoid common overflow when executing with an int score > 500 000 double [ ] differenceDoubles = ScoreUtils . extractLevelDoubles ( difference ) ; if ( differenceSquaredTotalDoubles == null ) { differenceSquaredTotalDoubles = new double [ differenceDoubles . length ] ; } for ( int i = 0 ; i < differenceDoubles . length ; i ++ ) { differenceSquaredTotalDoubles [ i ] += Math . pow ( differenceDoubles [ i ] , 2.0 ) ; } } } double [ ] standardDeviationDoubles = new double [ differenceSquaredTotalDoubles . length ] ; for ( int i = 0 ; i < differenceSquaredTotalDoubles . length ; i ++ ) { standardDeviationDoubles [ i ] = Math . pow ( differenceSquaredTotalDoubles [ i ] / successCount , 0.5 ) ; } return standardDeviationDoubles ; }
Calculates standard deviation of {@link BenchmarkResult#getAverageScore()}s from {@code averageScore}.
@param averageScore not null
@return standard deviation double values
Calculates standard deviation of {