From 659e5ec09bca90e9b80022ea72f6f2f28233c42a Mon Sep 17 00:00:00 2001 From: tdurieux Date: Tue, 7 Mar 2017 13:15:06 +0100 Subject: [PATCH] fixed files form Math #19 --- .../math3/optimization/direct/CMAESOptimizer.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/projects/Math/19/org/apache/commons/math3/optimization/direct/CMAESOptimizer.java b/projects/Math/19/org/apache/commons/math3/optimization/direct/CMAESOptimizer.java index 51d1c64..f6a4f28 100644 --- a/projects/Math/19/org/apache/commons/math3/optimization/direct/CMAESOptimizer.java +++ b/projects/Math/19/org/apache/commons/math3/optimization/direct/CMAESOptimizer.java @@ -537,6 +537,19 @@ private void checkParameters() { boundaries[1] = uB; // Abort early if the normalization will overflow (cf. "encode" method). + for (int i = 0; i < lB.length; i++) { + if (Double.isInfinite(boundaries[1][i] - boundaries[0][i])) { + final double max = Double.MAX_VALUE + boundaries[0][i]; + final NumberIsTooLargeException e + = new NumberIsTooLargeException(boundaries[1][i], + max, + true); + e.getContext().addMessage(LocalizedFormats.OVERFLOW); + e.getContext().addMessage(LocalizedFormats.INDEX, i); + + throw e; + } + } } } else { // Convert API to internal handling of boundaries.