Make CMA-ES input sigma is now consistent with boundaries units.

JIRA: MATH-702

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1198741 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Luc Maisonobe 2011-11-07 14:12:45 +00:00
parent 7231b6fe8e
commit ae22813ab1
3 changed files with 8 additions and 4 deletions

View File

@ -515,8 +515,8 @@ public class CMAESOptimizer
throw new NotPositiveException(inputSigma[i]);
}
if (boundaries != null) {
if (inputSigma[i] > 1.0) {
throw new OutOfRangeException(inputSigma[i], 0, 1.0);
if (inputSigma[i] > boundaries[1][i] - boundaries[0][i]) {
throw new OutOfRangeException(inputSigma[i], 0, boundaries[1][i] - boundaries[0][i]);
}
}
}
@ -535,7 +535,8 @@ public class CMAESOptimizer
// initialize sigma
double[][] sigmaArray = new double[guess.length][1];
for (int i = 0; i < guess.length; i++) {
sigmaArray[i][0] = inputSigma != null ? inputSigma[i] : 0.3;
final double range = (boundaries == null) ? 1.0 : boundaries[1][i] - boundaries[0][i];
sigmaArray[i][0] = ((inputSigma == null) ? 0.3 : inputSigma[i]) / range;
}
RealMatrix insigma = new Array2DRowRealMatrix(sigmaArray, false);
sigma = max(insigma); // overall standard deviation

View File

@ -52,6 +52,9 @@ The <action> type attribute can be add,update,fix,remove.
If the output is not quite correct, check for invisible trailing spaces!
-->
<release version="3.0" date="TBD" description="TBD">
<action dev="luc" type="fix" issue="MATH-702" >
CMA-ES optimizer input sigma is now consistent with boundaries range units.
</action>
<action dev="psteitz" type="add" issue="MATH-462" due-to="Pavel Ryzhof">
Added stable random generator based on Chambers-Mallows-Stuck method.
</action>

View File

@ -96,7 +96,7 @@ public class CMAESOptimizerTest {
public void testInputSigmaOutOfRange() {
double[] startPoint = point(DIM,0.5);
double[] insigma = point(DIM, 1.1);
double[][] boundaries = boundaries(DIM,-1,2);
double[][] boundaries = boundaries(DIM,-0.5,0.5);
RealPointValuePair expected =
new RealPointValuePair(point(DIM,1.0),0.0);
doTest(new Rosen(), startPoint, insigma, boundaries,