add a retry feature for randomly failing CMA-ES optimizer test
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1103418 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e12caa8de1
commit
e401d4ac06
|
@ -20,6 +20,8 @@ import java.util.Arrays;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import org.apache.commons.math.MathException;
|
import org.apache.commons.math.MathException;
|
||||||
|
import org.apache.commons.math.Retry;
|
||||||
|
import org.apache.commons.math.RetryRunner;
|
||||||
import org.apache.commons.math.analysis.MultivariateRealFunction;
|
import org.apache.commons.math.analysis.MultivariateRealFunction;
|
||||||
import org.apache.commons.math.exception.MathUserException;
|
import org.apache.commons.math.exception.MathUserException;
|
||||||
import org.apache.commons.math.exception.MultiDimensionMismatchException;
|
import org.apache.commons.math.exception.MultiDimensionMismatchException;
|
||||||
|
@ -32,10 +34,12 @@ import org.apache.commons.math.optimization.RealPointValuePair;
|
||||||
import org.apache.commons.math.random.MersenneTwister;
|
import org.apache.commons.math.random.MersenneTwister;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for {@link CMAESOptimizer}.
|
* Test for {@link CMAESOptimizer}.
|
||||||
*/
|
*/
|
||||||
|
@RunWith(RetryRunner.class)
|
||||||
public class CMAESOptimizerTest {
|
public class CMAESOptimizerTest {
|
||||||
|
|
||||||
static final int DIM = 13;
|
static final int DIM = 13;
|
||||||
|
@ -130,6 +134,7 @@ public class CMAESOptimizerTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Retry(3)
|
||||||
public void testMaximize() throws MathException {
|
public void testMaximize() throws MathException {
|
||||||
double[] startPoint = point(DIM,1.0);
|
double[] startPoint = point(DIM,1.0);
|
||||||
double[] insigma = point(DIM,0.1);
|
double[] insigma = point(DIM,0.1);
|
||||||
|
|
Loading…
Reference in New Issue