Package org.apache.commons.math3.random

Examples of org.apache.commons.math3.random.MersenneTwister


            generators.add(new Pair<String, RandomVectorGenerator>("Uncorrelated\nUniform(JDK)",
                    new UncorrelatedRandomVectorGenerator(2, new UniformRandomGenerator(new JDKRandomGenerator()))));
            generators.add(new Pair<String, RandomVectorGenerator>("Independent\nRandom(MT)", new RandomVectorGenerator() {

                RandomGenerator[] rngs = new RandomGenerator[] {
                    new MersenneTwister(0),
                    new MersenneTwister(1)
                };
               
                public double[] nextVector() {
                    final double[] vector = new double[2];
                    vector[0] = rngs[0].nextDouble();
View Full Code Here


    @Test
    public void testMath864() {
        final CMAESOptimizer optimizer
            = new CMAESOptimizer(30000, 0, true, 10,
                                 0, new MersenneTwister(), false, null);
        final MultivariateFunction fitnessFunction = new MultivariateFunction() {
                public double value(double[] parameters) {
                    final double target = 1;
                    final double error = target - parameters[0];
                    return error * error;
 
View Full Code Here

     */
    @Test
    public void testFitAccuracyDependsOnBoundary() {
        final CMAESOptimizer optimizer
            = new CMAESOptimizer(30000, 0, true, 10,
                                 0, new MersenneTwister(), false, null);
        final MultivariateFunction fitnessFunction = new MultivariateFunction() {
                public double value(double[] parameters) {
                    final double target = 11.1;
                    final double error = target - parameters[0];
                    return error * error;
 
View Full Code Here

                        int maxEvaluations,
                        PointValuePair expected) {
        int dim = startPoint.length;
        // test diagonalOnly = 0 - slow but normally fewer feval#
        CMAESOptimizer optim = new CMAESOptimizer(30000, stopValue, isActive, diagonalOnly,
                                                  0, new MersenneTwister(), false, null);
        PointValuePair result = boundaries == null ?
            optim.optimize(new MaxEval(maxEvaluations),
                           new ObjectiveFunction(func),
                           goal,
                           new InitialGuess(startPoint),
View Full Code Here

    private RandomGenerator generator;

    @Before
    public void setUp() {
        field = new DfpField(40);
        generator = new MersenneTwister(6176597458463500194l);
    }
View Full Code Here

  private static final long STANDARD_SEED = 0xCAFEDEADBEEFBABEL;

  private final RandomGenerator random;

  RandomWrapper() {
    random = new MersenneTwister();
    random.setSeed(System.currentTimeMillis() + System.identityHashCode(random));
  }
View Full Code Here

    random = new MersenneTwister();
    random.setSeed(System.currentTimeMillis() + System.identityHashCode(random));
  }

  RandomWrapper(long seed) {
    random = new MersenneTwister(seed);
  }
View Full Code Here

    public Random createRandom() {
        switch (randomType) {
            case JDK:
                return randomSeed == null ? new Random() : new Random(randomSeed);
            case MERSENNE_TWISTER:
                return new RandomAdaptor(randomSeed == null ? new MersenneTwister() : new MersenneTwister(randomSeed));
            case WELL512A:
                return new RandomAdaptor(randomSeed == null ? new Well512a() : new Well512a(randomSeed));
            case WELL1024A:
                return new RandomAdaptor(randomSeed == null ? new Well1024a() : new Well1024a(randomSeed));
            case WELL19937A:
View Full Code Here

   * @return a new, seeded {@link RandomGenerator}
   */
  public static RandomGenerator getRandom() {
    if (useTestSeed) {
      // No need to track instances anymore
      return new MersenneTwister(TEST_SEED);
    }
    RandomGenerator random = new MersenneTwister();
    synchronized (INSTANCES) {
      INSTANCES.put(random, Boolean.TRUE);
    }
    return random;
  }
View Full Code Here

            int maxEvaluations,
            PointValuePair expected) {
        int dim = startPoint.length;
        // test diagonalOnly = 0 - slow but normally fewer feval#
        CMAESOptimizer optim = new CMAESOptimizer(30000, stopValue, isActive, diagonalOnly,
                                                  0, new MersenneTwister(), false, null);
        final double[] lB = boundaries == null ? null : boundaries[0];
        final double[] uB = boundaries == null ? null : boundaries[1];
        PointValuePair result = boundaries == null ?
            optim.optimize(maxEvaluations, func, goal,
                           new InitialGuess(startPoint),
View Full Code Here

TOP

Related Classes of org.apache.commons.math3.random.MersenneTwister

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.