commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pste...@apache.org
Subject svn commit: r1088895 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/CMAESOptimizer.java
Date Tue, 05 Apr 2011 04:53:54 GMT
Author: psteitz
Date: Tue Apr  5 04:53:53 2011
New Revision: 1088895

URL: http://svn.apache.org/viewvc?rev=1088895&view=rev
Log:
Changed CMAESOptimizer constructors to copy, rather than reference array arguments.
JIRA: MATH-556



Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/CMAESOptimizer.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/CMAESOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/CMAESOptimizer.java?rev=1088895&r1=1088894&r2=1088895&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/CMAESOptimizer.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/CMAESOptimizer.java
Tue Apr  5 04:53:53 2011
@@ -294,8 +294,17 @@ public class CMAESOptimizer extends
             boolean isActiveCMA, int diagonalOnly, int checkFeasableCount,
             RandomGenerator random, boolean generateStatistics) {
         this.lambda = lambda;
-        this.inputSigma = inputSigma;
-        this.boundaries = boundaries;
+        this.inputSigma = inputSigma == null ? null : (double[]) inputSigma.clone();
+        if (boundaries == null) {
+            this.boundaries = null;
+        } else {
+            final int len = boundaries.length;
+            this.boundaries = new double[len][];
+            for (int i = 0; i < len; i++) {
+                this.boundaries[i] =
+                    boundaries[i] == null ? null : (double[]) boundaries[i].clone();
+            }
+        }
         this.maxIterations = maxIterations;
         this.stopfitness = stopfitness;
         this.isActiveCMA = isActiveCMA;



Mime
View raw message