Package org.apache.commons.math3.random

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


        assertVectorEquals(expectedInitialState, filter.getStateEstimation());

        RealVector pNoise = new ArrayRealVector(1);
        RealVector mNoise = new ArrayRealVector(1);

        RandomGenerator rand = new JDKRandomGenerator();
        // iterate 60 steps
        for (int i = 0; i < 60; i++) {
            filter.predict();

            // Simulate the process
            pNoise.setEntry(0, processNoise * rand.nextGaussian());

            // x = A * x + p_noise
            x = A.operate(x).add(pNoise);

            // Simulate the measurement
            mNoise.setEntry(0, measurementNoise * rand.nextGaussian());

            // z = H * x + m_noise
            RealVector z = H.operate(x).add(mNoise);

            filter.correct(z);
View Full Code Here


        // check the initial state
        double[] expectedInitialState = new double[] { 0.0, 0.0 };
        assertVectorEquals(expectedInitialState, filter.getStateEstimation());

        RandomGenerator rand = new JDKRandomGenerator();

        RealVector tmpPNoise = new ArrayRealVector(
                new double[] { FastMath.pow(dt, 2d) / 2d, dt });

        // iterate 60 steps
        for (int i = 0; i < 60; i++) {
            filter.predict(u);

            // Simulate the process
            RealVector pNoise = tmpPNoise.mapMultiply(accelNoise * rand.nextGaussian());

            // x = A * x + B * u + pNoise
            x = A.operate(x).add(B.operate(u)).add(pNoise);

            // Simulate the measurement
            double mNoise = measurementNoise * rand.nextGaussian();

            // z = H * x + m_noise
            RealVector z = H.operate(x).mapAdd(mNoise);

            filter.correct(z);
View Full Code Here

    }

    @Test
    public void testGetters() {
        final DistanceMeasure measure = new CanberraDistance();
        final RandomGenerator random = new JDKRandomGenerator();
        final FuzzyKMeansClusterer<DoublePoint> clusterer =
                new FuzzyKMeansClusterer<DoublePoint>(3, 2.0, 100, measure, 1e-6, random);

        Assert.assertEquals(3, clusterer.getK());
        Assert.assertEquals(2.0, clusterer.getFuzziness(), 1e-6);
View Full Code Here

    private RandomGenerator random;

    @Before
    public void setUp() {
        random = new JDKRandomGenerator();
        random.setSeed(1746432956321l);       
    }
View Full Code Here

                    }
                }
                return super.optimize(filtered);
            }
        };
        JDKRandomGenerator g = new JDKRandomGenerator();
        g.setSeed(16069223052l);
        RandomVectorGenerator generator =
                new UncorrelatedRandomVectorGenerator(1, new GaussianRandomGenerator(g));
        MultiStartMultivariateVectorOptimizer optimizer =
                new MultiStartMultivariateVectorOptimizer(underlyingOptimizer, 10, generator);
View Full Code Here

     */
    @Test(expected=TestException.class)
    public void testNoOptimum() {
        JacobianMultivariateVectorOptimizer underlyingOptimizer
            = new GaussNewtonOptimizer(true, new SimpleVectorValueChecker(1e-6, 1e-6));
        JDKRandomGenerator g = new JDKRandomGenerator();
        g.setSeed(12373523445l);
        RandomVectorGenerator generator
            = new UncorrelatedRandomVectorGenerator(1, new GaussianRandomGenerator(g));
        MultiStartMultivariateVectorOptimizer optimizer
            = new MultiStartMultivariateVectorOptimizer(underlyingOptimizer, 10, generator);
        optimizer.optimize(new MaxEval(100),
View Full Code Here

    @Test(expected=NullPointerException.class)
    public void testGetOptimaBeforeOptimize() {

        JacobianMultivariateVectorOptimizer underlyingOptimizer
            = new GaussNewtonOptimizer(true, new SimpleVectorValueChecker(1e-6, 1e-6));
        JDKRandomGenerator g = new JDKRandomGenerator();
        g.setSeed(16069223052l);
        RandomVectorGenerator generator
            = new UncorrelatedRandomVectorGenerator(1, new GaussianRandomGenerator(g));
        MultiStartMultivariateVectorOptimizer optimizer
            = new MultiStartMultivariateVectorOptimizer(underlyingOptimizer, 10, generator);
View Full Code Here

    public void testTrivial() {
        LinearProblem problem
            = new LinearProblem(new double[][] { { 2 } }, new double[] { 3 });
        JacobianMultivariateVectorOptimizer underlyingOptimizer
            = new GaussNewtonOptimizer(true, new SimpleVectorValueChecker(1e-6, 1e-6));
        JDKRandomGenerator g = new JDKRandomGenerator();
        g.setSeed(16069223052l);
        RandomVectorGenerator generator
            = new UncorrelatedRandomVectorGenerator(1, new GaussianRandomGenerator(g));
        MultiStartMultivariateVectorOptimizer optimizer
            = new MultiStartMultivariateVectorOptimizer(underlyingOptimizer, 10, generator);
View Full Code Here

        // version 3.1 of the library. It should be removed when NonLinearConjugateGradientOptimizer
        // will officially be declared as implementing MultivariateDifferentiableOptimizer
        GradientMultivariateOptimizer underlying
            = new NonLinearConjugateGradientOptimizer(NonLinearConjugateGradientOptimizer.Formula.POLAK_RIBIERE,
                                                      new SimpleValueChecker(1e-10, 1e-10));
        JDKRandomGenerator g = new JDKRandomGenerator();
        g.setSeed(753289573253l);
        RandomVectorGenerator generator
            = new UncorrelatedRandomVectorGenerator(new double[] { 50, 50 },
                                                    new double[] { 10, 10 },
                                                    new GaussianRandomGenerator(g));
        int nbStarts = 10;
View Full Code Here

        NelderMeadSimplex simplex = new NelderMeadSimplex(new double[][] {
                { -1.21.0 },
                { 0.9, 1.2 } ,
                3.5, -2.3 }
            });
        JDKRandomGenerator g = new JDKRandomGenerator();
        g.setSeed(16069223052l);
        RandomVectorGenerator generator
            = new UncorrelatedRandomVectorGenerator(2, new GaussianRandomGenerator(g));
        int nbStarts = 10;
        MultiStartMultivariateOptimizer optimizer
            = new MultiStartMultivariateOptimizer(underlying, nbStarts, generator);
View Full Code Here

TOP

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

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.