static TravelTimes createTravelTimes( Iterable<? extends ModelBuilder<?, ?>> modelSuppliers, Unit<Duration> tu, Iterable<? extends AddDepotEvent> depots, Iterable<? extends AddVehicleEvent> vehicles) { final RoadModel rm = getRm(modelSuppliers); if (rm instanceof GraphRoadModel) { return new GraphTravelTimes<>((GraphRoadModel) rm, tu, depots, vehicles); } return new DefaultTravelTimes(rm, tu, depots, vehicles); }
/** * @return Constructs a new {@link ScenarioGenerator} instance based on this * builder. */ public ScenarioGenerator build() { return new ScenarioGenerator(new Builder(this)); } }
@Override public IntensityFunction get(long seed) { return builder.build(seed); } }
/** * Tests whether times which are outside the interval [0,length) are correctly * rejected. */ @Test(expected = IllegalArgumentException.class) public void timesFail() { final int scenarioLength = 10; final ParcelGenerator pg2 = Parcels .builder() .announceTimes( TimeSeries.homogenousPoisson(scenarioLength + 0.1, 100)) .build(); pg2.generate(123, TravelTimesUtil.distance(), scenarioLength); }
/** * Sets the borders of the location generator such that the min position is * <code>(0,0)</code> and the max position is <code>(side,side)</code>. * @param side The side of a square. * @return This, as per the builder pattern. */ public Builder square(double side) { return xMin(0d).yMin(0d).xMax(side).yMax(side); }
@Override public Point getMax() { return locationGenerator.getMax(); } }
/** * Sets the durations of the parcel pickup and delivery operations. * @param durations The supplier to draw the durations from. * @return This, as per the builder pattern. */ public Builder serviceDurations(StochasticSupplier<Long> durations) { return pickupDurations(durations).deliveryDurations(durations); }
/** * @return A new builder for creating arbitrarily complex * {@link DepotGenerator}s. */ public static Builder builder() { return new Builder(); }
TimeSeriesIterator(RealDistribution distr, double len) { super(next(0d, len, distr)); length = len; ed = distr; }
/** * Create a {@link Builder} for constructing {@link ScenarioGenerator}s. * @param problemClass The {@link ProblemClass} of the scenarios that will be * generated by the generator under construction. * @return The builder. */ public static Builder builder(ProblemClass problemClass) { return new Builder(problemClass); }
/** * @return A newly constructed {@link Builder} for constructing * {@link VehicleGenerator}s. */ public static Builder builder() { return new Builder(); }
/** * @return A new {@link Builder} instance for creating * {@link TimeWindowGenerator}s. */ public static Builder builder() { return new Builder(); }
/** * @return The time window of generated scenarios. */ public TimeWindow getTimeWindow() { return builder.getTimeWindow(); }
SupplierIterator(double len, StochasticSupplier<Double> sup, RandomGenerator rng) { super(next(0d, len, sup, rng)); length = len; supplier = sup; randomNumberGenerator = rng; }
/** * @return A newly constructed {@link Builder} for constructing * {@link DynamicSpeedGenerator}s. */ public static Builder builder() { return new Builder(); }