viewBuilder = viewBuilder.withSpeedUp(TEST_SPEEDUP) .withAutoClose() .withAutoPlay()
viewBuilder = viewBuilder.withSpeedUp(TEST_SPEEDUP) .withAutoClose() .withAutoPlay()
.withAutoPlay() .withSimulatorEndTime(TEST_STOP_TIME) .withSpeedUp(TEST_SPEED_UP); } else if (m != null && list != null && display != null) { view = view.withMonitor(m) .withSpeedUp(SPEED_UP) .withResolution(m.getClientArea().width, m.getClientArea().height) .withDisplay(display)
.withSimulatorEndTime(300 * 1000L) .withAutoClose() .withSpeedUp(8) .withTitleAppendix("testGraphRenderers()"))
.withSpeedUp(TEST_SPEEDUP) .withAutoClose() .withAutoPlay()
.withSpeedUp(TEST_SPEEDUP) .withAutoClose() .withAutoPlay()
viewBuilder = viewBuilder.withAutoClose() .withSimulatorEndTime(TESTING_END_TIME) .withSpeedUp(TESTING_SPEEDUP);
viewBuilder = viewBuilder.withAutoClose() .withAutoPlay() .withSpeedUp(TEST_SPEED_UP) .withSimulatorEndTime(TEST_END_TIME);
viewBuilder = viewBuilder.withAutoClose() .withSimulatorEndTime(TESTING_END_TIME) .withSpeedUp(TESTING_SPEEDUP);
viewBuilder = viewBuilder.withAutoClose() .withAutoPlay() .withSpeedUp(TEST_SPEED_UP) .withSimulatorEndTime(TEST_END_TIME);
.with(RoadUserRenderer.builder()) .with(PDPModelRenderer.builder()) .withSpeedUp(50) .withAutoClose() .withAutoPlay());
.with(VehicleRenderer.builder()) .with(DemoPanel.builder(string)) .withSpeedUp(SPEED_UP)) .build();
.withSimulatorEndTime(TEST_END_TIME) .withTitleAppendix("TESTING") .withSpeedUp(TEST_SPEED_UP); } else { viewBuilder =
.with(VehicleRenderer.builder()) .with(DemoPanel.builder(string)) .withSpeedUp(SPEED_UP)) .build();
.with(PDPModelRenderer.builder()) .with(TimeLinePanel.builder()) .withSpeedUp(200) .withAutoClose() .withSimulatorEndTime(1 * 60 * 1000)
.withSimulatorEndTime(TEST_END_TIME) .withTitleAppendix("TESTING") .withSpeedUp(TEST_SPEED_UP); } else { viewBuilder =
public static void main(String[] args) throws IOException { for (int i = 0; i < 100; i++) { final FabriRechtScenario scenario = FabriRechtParser.fromJson(Files .toString(new File("files/test/fabri-recht/lc101.scenario"), Charsets.UTF_8), 8, 20); Simulator.builder() .addModel( ScenarioController.builder(scenario) .withEventHandler(AddVehicleEvent.class, new TimedEventHandler<AddVehicleEvent>() { @Override public void handleTimedEvent(AddVehicleEvent event, SimulatorAPI simulator) { simulator.register(new Truck(event.getVehicleDTO())); } })) .addModel( View.builder() .with(PlaneRoadModelRenderer.builder()) .with(RoadUserRenderer.builder()) .with(PDPModelRenderer.builder()) .withSpeedUp(50) .withAutoClose() .withAutoPlay()) .build().start(); } } }
.withAutoPlay() .withSimulatorEndTime(TEST_STOP_TIME) .withSpeedUp(TEST_SPEED_UP); } else if (m != null && list != null && display != null) { view = view.withMonitor(m) .withSpeedUp(SPEED_UP) .withResolution(m.getClientArea().width, m.getClientArea().height) .withDisplay(display)
/** * Test for {@link CommRenderer}. */ @Test public void testRenderer() { final RandomGenerator rng = new MersenneTwister(123L); final Simulator sim = Simulator.builder() .setRandomGenerator(rng) .addModel(CommModel.builder()) .addModel(RoadModelBuilders.plane()) .addModel( View.builder() .with(CommRenderer.builder() .withReliabilityColors(new RGB(0, 0, 255), new RGB(255, 255, 0)) .withReliabilityPercentage() .withMessageCount()) .with(PlaneRoadModelRenderer.builder()) .withAutoPlay() .withAutoClose() .withSpeedUp(10) .withSimulatorEndTime(1000 * 60 * 5)) .addModel(TestModel.Builder.create()) .build(); for (int i = 0; i < 20; i++) { sim.register(new CommAgent(rng, (i + 1) / 10d, i * (1d / 20d))); } sim.register(new CommAgent(rng, -1d, 1d)); sim.start(); }
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; }