use of org.optaplanner.core.config.solver.SolverConfig in project kie-benchmarks by kiegroup.
the class ConferenceSchedulingBenchmark method createSolver.
@Override
protected Solver<ConferenceSolution> createSolver() {
// the pre-defined configuration in ConferenceScheduling cannot be used
SolverConfig solverConfig = new SolverConfig();
solverConfig.withEntityClasses(Talk.class);
solverConfig.withSolutionClass(ConferenceSolution.class);
ScoreDirectorFactoryConfig scoreDirectorFactoryConfig = new ScoreDirectorFactoryConfig();
scoreDirectorFactoryConfig.setConstraintProviderClass(ConferenceSchedulingConstraintProvider.class);
LocalSearchPhaseConfig localSearchPhaseConfig = new LocalSearchPhaseConfig();
localSearchPhaseConfig.setLocalSearchType(LocalSearchType.TABU_SEARCH);
solverConfig.setPhaseConfigList(Arrays.asList(new ConstructionHeuristicPhaseConfig(), localSearchPhaseConfig));
solverConfig.setScoreDirectorFactoryConfig(scoreDirectorFactoryConfig);
solverConfig.setTerminationConfig(new TerminationConfig().withTerminationClass(ConferenceSchedulingTermination.class));
SolverFactory<ConferenceSolution> solverFactory = SolverFactory.create(solverConfig);
return solverFactory.buildSolver();
}
use of org.optaplanner.core.config.solver.SolverConfig in project kie-benchmarks by kiegroup.
the class VehicleRoutingBenchmark method createSolver.
@Override
protected Solver<VehicleRoutingSolution> createSolver() {
// the pre-defined configuration in VehicleRouting cannot be used
SolverConfig solverConfig = new SolverConfig();
solverConfig.withEntityClasses(Standstill.class, Customer.class, TimeWindowedCustomer.class);
solverConfig.withSolutionClass(VehicleRoutingSolution.class);
ScoreDirectorFactoryConfig scoreDirectorFactoryConfig = new ScoreDirectorFactoryConfig();
scoreDirectorFactoryConfig.setInitializingScoreTrend("ONLY_DOWN");
scoreDirectorFactoryConfig.setConstraintProviderClass(VehicleRoutingConstraintProvider.class);
solverConfig.setPhaseConfigList(getPhaseConfigList());
solverConfig.setScoreDirectorFactoryConfig(scoreDirectorFactoryConfig);
solverConfig.setTerminationConfig(new TerminationConfig().withTerminationClass(HardVRPCalculateCountTermination.class));
SolverFactory<VehicleRoutingSolution> solverFactory = SolverFactory.create(solverConfig);
return solverFactory.buildSolver();
}
use of org.optaplanner.core.config.solver.SolverConfig in project kie-benchmarks by kiegroup.
the class CloudBalancingMultithreadedSolvingScalabilityBenchmark method createInitialSolution.
@Override
protected CloudBalance createInitialSolution() {
CustomPhaseConfig customPhaseConfig = new CustomPhaseConfig();
customPhaseConfig.setCustomPhaseCommandClassList(Collections.singletonList(CloudBalanceSolutionInitializer.class));
SolverConfig solverConfig = getBaseSolverConfig();
solverConfig.setPhaseConfigList(Collections.singletonList(customPhaseConfig));
SolverFactory<CloudBalance> solverFactory = SolverFactory.create(solverConfig);
Solver<CloudBalance> constructionSolver = solverFactory.buildSolver();
CloudBalance solution = Examples.CLOUD_BALANCING.loadSolvingProblem(dataset);
return constructionSolver.solve(solution);
}
use of org.optaplanner.core.config.solver.SolverConfig in project kie-benchmarks by kiegroup.
the class CloudBalancingExample method getBaseSolverConfig.
@Override
public SolverConfig getBaseSolverConfig() {
SolverConfig solverConfig = new SolverConfig();
solverConfig.withEntityClasses(CloudProcess.class);
solverConfig.withSolutionClass(CloudBalance.class);
solverConfig.setEnvironmentMode(EnvironmentMode.REPRODUCIBLE);
solverConfig.setScoreDirectorFactoryConfig(new ScoreDirectorFactoryConfig());
solverConfig.getScoreDirectorFactoryConfig().setIncrementalScoreCalculatorClass(CloudBalancingIncrementalScoreCalculator.class);
solverConfig.getScoreDirectorFactoryConfig().setInitializingScoreTrend("ONLY_DOWN");
return solverConfig;
}
use of org.optaplanner.core.config.solver.SolverConfig in project kie-benchmarks by kiegroup.
the class AbstractTSPLocalSearchBenchmark method createInitialSolution.
@Override
protected TspSolution createInitialSolution() {
CustomPhaseConfig customPhaseConfig = new CustomPhaseConfig();
customPhaseConfig.setCustomPhaseCommandClassList(Collections.singletonList(TSPSolutionInitializer.class));
SolverConfig solverConfig = Examples.TRAVELING_SALESMAN.getBaseSolverConfig();
solverConfig.setPhaseConfigList(Collections.singletonList(customPhaseConfig));
SolverFactory<TspSolution> solverFactory = SolverFactory.create(solverConfig);
Solver<TspSolution> constructionSolver = solverFactory.buildSolver();
TspSolution solution = Examples.TRAVELING_SALESMAN.loadSolvingProblem(dataset);
return constructionSolver.solve(solution);
}
Aggregations