@Test public void test() { final OptaplannerSolver optaplannerSolver = ((Validator) OptaplannerSolvers.builder() .withValidated(true) .withUnimprovedMsLimit(10L) .withObjectiveFunction(Gendreau06ObjectiveFunction.instance()) .withName("test") .buildSolverSupplier() .get(123L)) .solver; final GlobalStateObject gso = GlobalStateObjectBuilder.globalBuilder() .addAvailableParcel(Parcel.builder(new Point(0, 0), new Point(2, 0)).build()) .addAvailableParcel(Parcel.builder(new Point(3, 0), new Point(2, 0)).build()) .addVehicle( GlobalStateObjectBuilder.vehicleBuilder() .setLocation(new Point(5, 5)) .setRoute(ImmutableList.<Parcel>of()) .build()) .build(); compare(optaplannerSolver, gso); }
/** Test for {@link PDPModelRenderer} in combination with a realtime clock. */ @Test public void test() { final Simulator sim = Simulator.builder() .addModel(TimeModel.builder().withRealTime()) .addModel(RoadModelBuilders.plane()) .addModel(DefaultPDPModel.builder()) .addModel( View.builder() .with(PlaneRoadModelRenderer.builder()) .with( RoadUserRenderer.builder() .withColorAssociation(Depot.class, new RGB(255, 200, 0)) .withCircleAroundObjects()) .with(PDPModelRenderer.builder().withDestinationLines()) .withAutoPlay() .withAutoClose() .withSimulatorEndTime(5000)) .build(); for (int i = 0; i < 10; i++) { if (i != 5) { sim.register(Parcel.builder(new Point(i, i + 1), new Point(5, 5)).build()); sim.register(new TestVehicle(new Point(i, 10 - i), new Point(i, i + 1))); } } sim.register(new Depot(new Point(5, 5))); sim.start(); }
@Test public void testPartiallyLoadedParcel() { final Parcel A = Parcel.builder(new Point(5, 5), new Point(2, 0)).serviceDuration(180000L).build(); final GlobalStateObject gso = GlobalStateObjectBuilder.globalBuilder() .addAvailableParcel(A) .addVehicle( GlobalStateObjectBuilder.vehicleBuilder() .setLocation(new Point(5, 5)) .setRoute(ImmutableList.<Parcel>of(A, A)) .setRemainingServiceTime(120000L) .setDestination(A) .build()) .build(); final OptaplannerSolver optaplannerSolver = ((Validator) OptaplannerSolvers.builder() .withValidated(true) .withUnimprovedMsLimit(10L) .withName("test") .withObjectiveFunction(Gendreau06ObjectiveFunction.instance()) .buildSolverSupplier() .get(123L)) .solver; compare(optaplannerSolver, gso); }