use of org.optaplanner.core.config.localsearch.LocalSearchPhaseConfig in project droolsjbpm-integration by kiegroup.
the class AbstractTaskAssigningCoreTest method createNonDaemonSolver.
protected Solver<TaskAssigningSolution> createNonDaemonSolver(int stepCountLimit) {
SolverConfig config = createBaseConfig();
ConstructionHeuristicPhaseConfig constructionHeuristicPhaseConfig = new ConstructionHeuristicPhaseConfig();
constructionHeuristicPhaseConfig.setConstructionHeuristicType(ConstructionHeuristicType.FIRST_FIT);
LocalSearchPhaseConfig phaseConfig = new LocalSearchPhaseConfig();
phaseConfig.setTerminationConfig(new TerminationConfig().withStepCountLimit(stepCountLimit));
config.setPhaseConfigList(Arrays.asList(constructionHeuristicPhaseConfig, phaseConfig));
SolverFactory<TaskAssigningSolution> solverFactory = SolverFactory.create(config);
return solverFactory.buildSolver();
}
use of org.optaplanner.core.config.localsearch.LocalSearchPhaseConfig 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.localsearch.LocalSearchPhaseConfig in project droolsjbpm-integration by kiegroup.
the class PlannerCloudBalanceIntegrationTest method solveSolution.
private void solveSolution(CloudBalance cloudBalance) {
LocalSearchPhaseConfig localSearchPhaseConfig = new LocalSearchPhaseConfig();
localSearchPhaseConfig.setTerminationConfig(new TerminationConfig().withStepCountLimit(20));
SolverConfig config = new SolverConfig().withEntityClassList(Arrays.asList(CloudProcess.class)).withSolutionClass(CloudBalance.class).withScoreDirectorFactory(new ScoreDirectorFactoryConfig().withIncrementalScoreCalculatorClass(CloudBalancingIncrementalScoreCalculator.class)).withPhases(new ConstructionHeuristicPhaseConfig().withConstructionHeuristicType(ConstructionHeuristicType.FIRST_FIT_DECREASING), localSearchPhaseConfig);
Assert.assertEquals(cloudBalance.getScore().getHardScore(), Integer.MIN_VALUE);
Assert.assertEquals(cloudBalance.getScore().getSoftScore(), Integer.MIN_VALUE);
SolverFactory<CloudBalance> solverFactory = SolverFactory.create(config);
Solver<CloudBalance> solver = solverFactory.buildSolver();
solver.solve(cloudBalance);
CloudBalance solution = solver.getBestSolution();
Assert.assertNotEquals(solution.getScore().getHardScore(), Integer.MIN_VALUE);
Assert.assertNotEquals(solution.getScore().getSoftScore(), Integer.MIN_VALUE);
}
Aggregations