.period(period) .area(ordersPerPeriod) .build();
TimeSeries.nonHomogenousPoisson(scenarioLengthMs - 30 * 60 * 1000L, IntensityFunctions.sineIntensity() .period(30 * 60 * 1000L) .area(10) .build()))
.period(3600d) .height(10) .build();
/** * @return Test configs */ @Parameters public static Collection<Object[]> data() { return Arrays.asList(new Object[][] { {TimeSeries.homogenousPoisson(60d, 10)}, {TimeSeries.homogenousPoisson(60d, 100)}, {TimeSeries.homogenousPoisson(180d, 10)}, {TimeSeries.homogenousPoisson(180d, 100)}, {TimeSeries.nonHomogenousPoisson(60d, IntensityFunctions .sineIntensity() .period(60).area(10).build())}, {TimeSeries.nonHomogenousPoisson(60d, IntensityFunctions .sineIntensity() .period(60).area(10).phaseShift(2).build())}, {TimeSeries.nonHomogenousPoisson(60d, IntensityFunctions .sineIntensity() .period(60).area(10).height(1).build())}, {TimeSeries.nonHomogenousPoisson(300d, IntensityFunctions .sineIntensity() .period(60).area(10).height(1).build())}, {TimeSeries.nonHomogenousPoisson(600d, IntensityFunctions .sineIntensity() .period(600).area(200).height(1).build())} }); }
/** * Check whether the * {@link TimeSeries#nonHomogenousPoisson(double, StochasticSupplier)} * function behaves as expected. */ @Test public void test2() { final IntensityFunction func1 = IntensityFunctions.sineIntensity() .period(60) .height(-.5) .build(); final IntensityFunction func2 = IntensityFunctions.sineIntensity() .period(30) .height(1.5) .build(); final StochasticSupplier<IntensityFunction> funcSup = StochasticSuppliers .fromIterable(Iterables.cycle(func1, func2)); final TimeSeriesGenerator tsg = TimeSeries.nonHomogenousPoisson(120, funcSup); // note that these tests will not work for all results of the // TimeSeriesGenerator, it is possible (but less likely) that the produced // dynamism values are different from the expectations as expressed in the // tests below. for (int i = 0; i < 20; i++) { assertTrue(Metrics.measureDynamism(tsg.generate(i), 120) < .25); assertTrue(Metrics.measureDynamism(tsg.generate(i), 120) > .40); } }
/** * @return The test configs. */ @Parameters public static Collection<Object[]> data() { return Arrays .asList(new Object[][] { {IntensityFunctions.sineIntensity().area(10).period(20).build()}, {IntensityFunctions.sineIntensity().area(10).height(.5).period(20) .build()}, {IntensityFunctions.sineIntensity().area(10).height(-.5).period(20) .build()}, {IntensityFunctions.sineIntensity().area(10).phaseShift(0) .period(20) .build()}, {IntensityFunctions.sineIntensity().area(10).height(1).period(20) .build()} }); }