rm = PDPRoadModel.builder( RoadModelBuilders.plane() .withMinPoint(new Point(0, 0)) .withMaxPoint(new Point(10, 10)) .withDistanceUnit(SI.KILOMETER) .withMaxSpeed(0.1) .withSpeedUnit(NonSI.KILOMETERS_PER_HOUR)) .withAllowVehicleDiversion(allowDiversion) .build(dep);
@Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof RoadModelBuilders.PlaneRMB) { RoadModelBuilders.PlaneRMB that = (RoadModelBuilders.PlaneRMB) o; return (this.distanceUnit.equals(that.getDistanceUnit())) && (this.speedUnit.equals(that.getSpeedUnit())) && (this.min.equals(that.getMin())) && (this.max.equals(that.getMax())) && (Double.doubleToLongBits(this.maxSpeed) == Double.doubleToLongBits(that.getMaxSpeed())); } return false; }
PDPRoadModel.builder( RoadModelBuilders.plane() .withMinPoint(MIN_POINT) .withMaxPoint(MAX_POINT) .withMaxSpeed(MAX_VEHICLE_SPEED_KMH)))
PDPRoadModel.builder( RoadModelBuilders.plane() .withMinPoint(MIN_POINT) .withMaxPoint(MAX_POINT) .withMaxSpeed(MAX_VEHICLE_SPEED_KMH)))
.withMinPoint(MIN_POINT) .withMaxPoint(MAX_POINT) .withMaxSpeed(VEHICLE_SPEED_KMH))
rm = PDPRoadModel.builder( RoadModelBuilders.plane() .withMaxSpeed(30d)) .withAllowVehicleDiversion(diversionIsAllowed) .build(dp);
PDPRoadModel.builder( RoadModelBuilders.plane() .withMaxSpeed(50d)) .withAllowVehicleDiversion(true)) .addModel(
.withMinPoint(MIN_POINT) .withMaxPoint(MAX_POINT) .withMaxSpeed(VEHICLE_SPEED_KMH))
plane().withMaxPoint(new Point(7, 7))); assertThat(stat).isEqualTo( staticGraph(new MultimapGraph<>())); assertThat(plane).isEqualTo(RoadModelBuilders.plane()); assertThat(plane).isNotEqualTo( RoadModelBuilders.plane().withDistanceUnit(SI.CENTIMETER));
.builder() .addModel(RoadModelBuilders.plane() .withMinPoint(new Point(0, 0)) .withMaxPoint(new Point(10, 10)) .withMaxSpeed(10d)) .addModel( View
.addEvent(TimeOutEvent.create(200000)) .addModel(RoadModelBuilders.plane() .withDistanceUnit(SI.CENTIMETER) .withMaxPoint(new Point(7d, 8.4)) .withMinPoint(new Point(-1, 3)) .withMaxSpeed(7d) .withSpeedUnit(NonSI.MILES_PER_HOUR)) .addModel(DefaultPDPModel.builder() .withTimeWindowPolicy(TimeWindowPolicies.STRICT))
final Simulator sim = Simulator.builder() .addModel(RoadModelBuilders.plane() .withMinPoint(MIN_POINT) .withMaxPoint(max) .withDistanceUnit(SI.METER) .withSpeedUnit(NonSI.KILOMETERS_PER_HOUR) .withMaxSpeed(MAX_SPEED)) .addModel( View.builder()
final Simulator sim = Simulator.builder() .addModel(RoadModelBuilders.plane() .withMinPoint(MIN_POINT) .withMaxPoint(max) .withDistanceUnit(SI.METER) .withSpeedUnit(NonSI.KILOMETERS_PER_HOUR) .withMaxSpeed(MAX_SPEED)) .addModel( View.builder()
PDPRoadModel.builder( RoadModelBuilders.plane() .withMinPoint(MIN) .withMaxPoint(MAX) .withDistanceUnit(SI.KILOMETER) .withSpeedUnit(MAX_SPEED.getUnit()) .withMaxSpeed(MAX_SPEED.getValue())) .withAllowVehicleDiversion(diversion)) .add(
.addModel( RoadModelBuilders.plane() .withMinPoint(new Point(6, 6)) .withMaxPoint(new Point(1034, 32)) .withDistanceUnit(SI.METER) .withSpeedUnit(SI.METERS_PER_SECOND) .withMaxSpeed(1d)) .build();
PDPRoadModel.builder( RoadModelBuilders.plane() .withMaxSpeed(20d)) .withAllowVehicleDiversion(true)) .addModel(
.withDistanceUnit(SI.METER) .withMaxSpeed(Double.POSITIVE_INFINITY) .withSpeedUnit(SI.METERS_PER_SECOND) .build(dp);
@Before public void setUp() { sim = Simulator.builder() .addModel( PDPRoadModel.builder( RoadModelBuilders.plane() .withMaxSpeed(300d)) .withAllowVehicleDiversion(false)) .addModel( DefaultPDPModel.builder() .withTimeWindowPolicy(TimeWindowPolicies.TARDY_ALLOWED)) .build(); rm = sim.getModelProvider().getModel(PDPRoadModel.class); pm = sim.getModelProvider().getModel(PDPModel.class); depot = new Depot(new Point(5, 5)); sim.register(depot); p1 = createParcel(new Point(3, 0), new Point(0, 3)); p2 = createParcel(new Point(6, 9), new Point(2, 9)); p3 = createParcel(new Point(2, 8), new Point(8, 2)); TestUtil.testPrivateConstructor(Central.class); TestUtil.testPrivateConstructor(Solvers.class); TestUtil.testEnum(VehicleCreator.class); }
/** * Setup an environment with three vehicles and three parcels. */ @Before public void setUp() { final DependencyProvider dp = mock(DependencyProvider.class); rm = PDPRoadModel.builder( RoadModelBuilders.plane() .withMaxSpeed(300d)) .withAllowVehicleDiversion(false) .build(dp); when(dp.get(RoadModel.class)).thenReturn(rm); pm = DefaultPDPModel.builder() .withTimeWindowPolicy(TimeWindowPolicies.TARDY_ALLOWED) .build(dp); mp = new TestModelProvider(new ArrayList<>( Arrays.<Model<?>>asList(rm, pm))); rm.registerModelProvider(mp); v1 = new TestVehicle(new Point(0, 1)); v2 = new TestVehicle(new Point(0, 2)); v3 = new TestVehicle(new Point(0, 3)); p1 = createParcel(new Point(3, 0), new Point(0, 3)); p2 = createParcel(new Point(6, 9), new Point(2, 9)); p3 = createParcel(new Point(2, 8), new Point(8, 2)); ss = rm.getSnapshot(); }
/** * Supplying the builder with illegal points should yield an exception. */ @Test public void builderIllegalPoints() { boolean fail = false; try { RoadModelBuilders.plane() .withMinPoint(new Point(1, 0)) .withMaxPoint(new Point(0, 1)) .build(mock(DependencyProvider.class)); } catch (final IllegalArgumentException e) { fail = true; } assertTrue(fail); fail = false; try { RoadModelBuilders.plane() .withMinPoint(new Point(0, 1)) .withMaxPoint(new Point(1, 0)) .build(mock(DependencyProvider.class)); } catch (final IllegalArgumentException e) { fail = true; } assertTrue(fail); }