/** * Constructs a new {@link MASConfiguration} that uses a * {@link RealtimeSolver} created by the specified <code>solverSupplier</code> * to control all vehicles. * @param solverSupplier A {@link StochasticSupplier} that should create * instances of {@link RealtimeSolver}. * @param nameSuffix The suffix to the name of the {@link MASConfiguration}. * The name is formatted as * <code>RtCentral-[solverSupplier][nameSuffix]</code>. * @return A new {@link MASConfiguration} instance. */ public static MASConfiguration solverConfiguration( StochasticSupplier<? extends RealtimeSolver> solverSupplier, String nameSuffix) { return configBuilder(solverSupplier, nameSuffix) .addModel(builder(solverSupplier)) .build(); } // TODO create builder
/** * Constructs a new {@link MASConfiguration} that uses a {@link Solver} * created by the specified <code>solverSupplier</code> to control all * vehicles. The {@link Solver} is converted to a {@link RealtimeSolver} using * {@link RtStAdapters#toRealtime(StochasticSupplier)}. * @param solverSupplier A {@link StochasticSupplier} that should create * instances of {@link Solver}. * @param nameSuffix The suffix to the name of the {@link MASConfiguration}. * The name is formatted as * <code>RtCentral-[solverSupplier][nameSuffix]</code>. * @return A new {@link MASConfiguration} instance. */ public static MASConfiguration solverConfigurationAdapt( StochasticSupplier<? extends Solver> solverSupplier, String nameSuffix) { return solverConfiguration(AdapterSupplier.create(solverSupplier), nameSuffix); }
static MASConfiguration.Builder configBuilder( StochasticSupplier<?> solverSupplier, String nameSuffix) { return MASConfiguration.pdptwBuilder() .addEventHandler(AddVehicleEvent.class, vehicleHandler()) .setName(String.format("RtCentral-%s%s", solverSupplier, nameSuffix)); }
RealtimeTestHelper.init(RtCentral.vehicleHandler(), events) .addModel(TimeUtil.timeTracker()) .addModel( RtCentral.builder( StochasticSuppliers.constant(new TestRtSolver(150))) .withSleepOnChange(true))
public void nameTest() { assertThat(RtCentral .solverConfigurationAdapt(RandomSolver.supplier(), "hallo").getName()) .isEqualTo("RtCentral-RtAdapter{RandomSolver.supplier()}hallo"); .solverConfiguration(StochasticSuppliers.constant(new RealtimeSolver() { @Override public void problemChanged(GlobalStateObject snapshot) {}
.init(RtCentral.vehicleHandler(), events) .addModel(TimeUtil.timeTracker()) .addModel(RtCentral.builderAdapt(RandomSolver.supplier())) .build();
/** * Constructs a {@link Builder} for creating a real-time central model. The * real-time central model is a model that takes control of all vehicles in a * simulation and uses a {@link RealtimeSolver} to compute routes for all * vehicles. The supplied {@link Solver} is adapted using * {@link RtStAdapters#toRealtime(StochasticSupplier)}. * @param solverSupplier A {@link StochasticSupplier} that creates the * {@link Solver} that will be used for controlling all vehicles. * @return A new {@link Builder} instance. */ public static Builder builderAdapt( StochasticSupplier<? extends Solver> solverSupplier) { return builder(AdapterSupplier.create(solverSupplier)); }
RealtimeTestHelper.init(new TestVehicleHandler(vehicles), events) .addModel( RtCentral.builderAdapt(StochasticSuppliers.constant(new Solver() { @Override public ImmutableList<ImmutableList<Parcel>> solve(
.withThreads(1) .addConfiguration( RtCentral.solverConfigurationAdapt(RandomSolver.supplier(), "")) .usePostProcessor(PostProcessors .statisticsPostProcessor(Gendreau06ObjectiveFunction.instance()))
RealtimeTestHelper.init(RtCentral.vehicleHandler(), events) .addModel( RtCentral.builder(r)) .build();
.addModel(PDPRoadModel.builder(RoadModelBuilders.plane())) .addModel(DefaultPDPModel.builder()) .addModel(RtCentral.builderAdapt(RandomSolver.supplier())) .build();
public static MASConfiguration solverConfigurationAdapt( StochasticSupplier<? extends Solver> solverSupplier, String nameSuffix, boolean threadGrouping) { return configBuilder(solverSupplier, nameSuffix) .addModel(builder(AdapterSupplier.create(solverSupplier)) .withThreadGrouping(threadGrouping)) .build(); }
RealtimeTestHelper.init(new TestVehicleHandler(vehicles), events) .addModel( RtCentral.builderAdapt(StochasticSuppliers.constant(new Solver() { @Override public ImmutableList<ImmutableList<Parcel>> solve(