.usePostProcessor(new ExamplePostProcessor())
.usePostProcessor(new ExamplePostProcessor())
.addScenario(scenario) .addConfiguration(ExperimentTestUtil.testConfig("test")) .usePostProcessor(ExperimentTestUtil.testPostProcessor()) .withWarmup(100L) .withRandomSeed(123);
.addConfiguration(Central.solverConfiguration(dsc)) .addScenario(scenario) .usePostProcessor(PostProcessors.statisticsPostProcessor(obj)) .perform(); assertEquals(1, results.getResults().size());
.addConfiguration(Central.solverConfiguration(RandomSolver.supplier())) .withThreads(1) .usePostProcessor( PostProcessors.statisticsPostProcessor( Gendreau06ObjectiveFunction.instance(vehicleSpeedKmh),
.withRandomSeed(123) .repeat(1) .usePostProcessor(ExperimentTestUtil.testPostProcessor()) .addConfiguration(ExperimentTestUtil.testConfig("A"));
static StatisticsDTO simulate(Scenario scenario) { final ExperimentResults results = Experiment.builder() .addScenario(scenario) .addConfiguration(Central.solverConfiguration( StochasticSuppliers.constant(TestSolvers.lazyInsertion()))) .withThreads(1) .usePostProcessor(PostProcessors.statisticsPostProcessor(OBJ_FUNC)) .showGui(View.builder() .withAutoPlay() // .withAutoClose() .withSpeedUp(4) // .withFullScreen() .withTitleAppendix("AAMAS 2016 Experiment") .with(RoadUserRenderer.builder() .withToStringLabel()) .with(PDPModelRenderer.builder()) .with(RouteRenderer.builder()) .with(PlaneRoadModelRenderer.builder()) .with(TimeLinePanel.builder()) .withResolution(1280, 1024)) .showGui(false) .perform(); final SimulationResult res = results.getResults().iterator().next(); final StatisticsDTO stats = (StatisticsDTO) res.getResultObject(); return stats; }
.addConfiguration( RtCentral.solverConfigurationAdapt(RandomSolver.supplier(), "")) .usePostProcessor(PostProcessors .statisticsPostProcessor(Gendreau06ObjectiveFunction.instance())) .perform();
/** * Checks determinism of a local experiment and a JPPF experiment, both with * identical settings. Using a Gendreau scenario. */ @SuppressWarnings("unchecked") @Test public void determinismLocalVsJppf() { final Experiment.Builder experimentBuilder = Experiment.builder() .computeDistributed() .addScenario(scenario) .withRandomSeed(123) .repeat(1) .usePostProcessor(ExperimentTestUtil.testPostProcessor()) .addConfiguration(ExperimentTestUtil.testConfig("A")); final ExperimentResults results3 = experimentBuilder.perform(); experimentBuilder.computeLocal(); final ExperimentResults results4 = experimentBuilder.perform(); assertEquals(results3, results4); assertThat(results3.getResults().asList().get(0).getResultObject()) .isInstanceOf(ImmutableList.class); assertThat( (List<Point>) results3.getResults().asList().get(0).getResultObject()) .hasSize(10); }
@Test public void testCustomPostProcessor() { TestUtil.testEnum(Experiment.Computers.class); final Scenario scenario = ScenarioTestUtil.createRandomScenario(123L, StatsTracker.builder()); final Experiment.Builder builder = Experiment.builder() .addScenario(scenario) .addConfiguration(ExperimentTestUtil.testConfig("test")) .usePostProcessor(ExperimentTestUtil.testPostProcessor()) .addResultListener(new CommandLineProgress(System.out)) .withRandomSeed(123); final ExperimentResults er = builder.perform(); assertEquals(123, er.getMasterSeed()); assertEquals(123, er.getResults().asList().get(0).getSimArgs().getRandomSeed()); @SuppressWarnings("unchecked") final List<Point> positions = (List<Point>) er.getResults().asList().get(0).getResultObject(); assertEquals(10, positions.size()); }
@Test public void testRetryPostProcessor() { final Experiment.Builder builder = Experiment.builder() .addScenario(scenario) .computeDistributed() .addConfiguration(ExperimentTestUtil.testConfig("test")) .usePostProcessor(ExperimentTestUtil.retryOncePostProcessor()) .repeat(3) .withRandomSeed(123); final ExperimentResults er = builder.perform(); for (int i = 0; i < er.getResults().size(); i++) { assertThat(er.getResults().asList().get(0).getResultObject()) .isEqualTo("SUCCESS"); } }
/** * Tests a post processor that returns objects that does not implement * {@link Serializable}. */ @Test(expected = IllegalArgumentException.class) public void testFaultyPostProcessor() { Experiment.builder() .computeDistributed() .addScenario(scenario) .withRandomSeed(123) .repeat(1) .usePostProcessor(new TestFaultyPostProcessor()) .addConfiguration(ExperimentTestUtil.testConfig("A")) .perform(); }
@Test public void composite() { final Experiment.Builder builder = Experiment.builder() .addScenario(scenario) .computeDistributed() .setCompositeTaskSize(2) .addConfiguration(ExperimentTestUtil.testConfig("test")) .usePostProcessor(ExperimentTestUtil.testPostProcessor()) .repeat(3) .withRandomSeed(123); final ExperimentResults er = builder.perform(); assertThat(er.getResults()).hasSize(3); }
@Test public void testRetryPostProcessor() { final Scenario scenario = ScenarioTestUtil.createRandomScenario(123L, StatsTracker.builder()); final Experiment.Builder builder = Experiment.builder() .addScenario(scenario) .addConfiguration(ExperimentTestUtil.testConfig("test")) .withThreads(1) .usePostProcessor(ExperimentTestUtil.retryOncePostProcessor()) .repeat(3) .withRandomSeed(123); builder.perform(); }