Beispiel #1
0
  public void testMeanAndVariance() throws MathException {
    long ms = System.currentTimeMillis();
    int iters = mcm.addSamples(500000);
    ms = System.currentTimeMillis() - ms;
    System.out.println(ms + " ms");
    double rate = iters * 1000.0 / ms;
    System.out.format("%f iters/s %n", rate);

    double mean = summary.stats.getMean();
    double stddev = summary.stats.getStandardDeviation();

    System.out.println(iters);
    System.out.println(mean);
    System.out.println(stddev);
    assertEquals(expectedMean, mean, 0.01);
    // assertEquals(expectedStdDev, stddev, 0.05);
  }
Beispiel #2
0
  public void testMeanAndVarianceParallel() throws MathException {
    LogArrivedPointValuation apv = new LogArrivedPointValuation();
    mcm =
        new ParallelMonteCarloModel<Double>(
            new FastRandomFactory(), process, 1.0, 100, apv, summary, true, false);

    long ms = System.currentTimeMillis();
    int iters = mcm.addSamples(500000);
    ms = System.currentTimeMillis() - ms;
    System.out.println(ms + " ms");
    double rate = iters * 1000.0 / ms;
    System.out.format("%f iters/s %n", rate);

    double mean = summary.stats.getMean();
    double stddev = summary.stats.getStandardDeviation();

    System.out.println(iters);
    System.out.println(mean);
    System.out.println(stddev);
    assertEquals(expectedMean, mean, 0.01);
    assertEquals(expectedStdDev, stddev, 0.02);
  }