/** * Provides a {@link MASConfiguration} that configures a MAS that is * controlled centrally by a {@link Solver}. * @param solverCreator The solver creator to use for instantiating solvers. * @param nameSuffix A string which is append to the toString() for the * configuration. * @return A new configuration. */ public static MASConfiguration solverConfiguration( StochasticSupplier<? extends Solver> solverCreator, String nameSuffix) { return MASConfiguration.pdptwBuilder() .addEventHandler(AddVehicleEvent.class, VehicleCreator.INSTANCE) .addModel(Builder.create(solverCreator)) .setName("Central-" + solverCreator.toString() + nameSuffix) .build(); }
.addModel(StatsTracker.builder()) .build())
.addModel(StatsTracker.builder()) .build())
.addEventHandler(AddVehicleEvent.class, VehicleHandler.INSTANCE) .addEventHandler(AddParcelEvent.class, ParcelHandler.INSTANCE) .addModel(GradientModel.builder()) .build()) .addScenario(scenario)
.addEventHandler(AddVehicleEvent.class, VehicleHandler.INSTANCE) .addEventHandler(AddParcelEvent.class, ParcelHandler.INSTANCE) .addModel(GradientModel.builder()) .build()) .addScenario(scenario)
/** * 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
public static MASConfiguration solverConfigurationAdapt( StochasticSupplier<? extends Solver> solverSupplier, String nameSuffix, boolean threadGrouping) { return configBuilder(solverSupplier, nameSuffix) .addModel(builder(AdapterSupplier.create(solverSupplier)) .withThreadGrouping(threadGrouping)) .build(); }
/** * Adds the specified model builders. * @param models The model builders to add. * @return This, as per the builder pattern. */ public Builder addModels(Iterable<? extends ModelBuilder<?, ?>> models) { for (final ModelBuilder<?, ?> mb : models) { addModel(mb); } return this; }
/** * Adds the specified model builders. * @param models The model builders to add. * @return This, as per the builder pattern. */ public Builder addModels(Iterable<? extends ModelBuilder<?, ?>> models) { for (final ModelBuilder<?, ?> mb : models) { addModel(mb); } return this; }