use of org.optaplanner.core.config.solver.SolverConfig in project kie-benchmarks by kiegroup.
the class TravelingSalesmanExample method getBaseSolverConfig.
@Override
public SolverConfig getBaseSolverConfig() {
SolverConfig solverConfig = new SolverConfig();
solverConfig.withEntityClasses(Visit.class);
solverConfig.withSolutionClass(TspSolution.class);
solverConfig.setEnvironmentMode(EnvironmentMode.REPRODUCIBLE);
solverConfig.setScoreDirectorFactoryConfig(new ScoreDirectorFactoryConfig());
solverConfig.getScoreDirectorFactoryConfig().setIncrementalScoreCalculatorClass(TspIncrementalScoreCalculator.class);
solverConfig.getScoreDirectorFactoryConfig().setInitializingScoreTrend("ONLY_DOWN");
return solverConfig;
}
use of org.optaplanner.core.config.solver.SolverConfig in project kie-benchmarks by kiegroup.
the class VehicleRoutingExample method createInitialSolution.
public VehicleRoutingSolution createInitialSolution(DataSet dataSet) {
CustomPhaseConfig customPhaseConfig = new CustomPhaseConfig();
customPhaseConfig.setCustomPhaseCommandClassList(Collections.singletonList(VehicleRoutingSolutionInitializer.class));
SolverConfig solverConfig = Examples.VEHICLE_ROUTING.getBaseSolverConfig();
solverConfig.setPhaseConfigList(Collections.singletonList(customPhaseConfig));
SolverFactory<VehicleRoutingSolution> solverFactory = SolverFactory.create(solverConfig);
Solver<VehicleRoutingSolution> constructionSolver = solverFactory.buildSolver();
VehicleRoutingSolution solution = Examples.VEHICLE_ROUTING.loadSolvingProblem(dataSet);
return constructionSolver.solve(solution);
}
use of org.optaplanner.core.config.solver.SolverConfig in project kie-benchmarks by kiegroup.
the class FlightCrewSchedulingExample method getBaseSolverConfig.
@Override
public SolverConfig getBaseSolverConfig() {
SolverConfig solverConfig = new SolverConfig();
solverConfig.withEntityClasses(FlightAssignment.class, Employee.class);
solverConfig.withSolutionClass(FlightCrewSolution.class);
solverConfig.setEnvironmentMode(EnvironmentMode.REPRODUCIBLE);
ScoreDirectorFactoryConfig scoreDirectorFactoryConfig = new ScoreDirectorFactoryConfig();
scoreDirectorFactoryConfig.setConstraintProviderClass(FlightCrewSchedulingConstraintProvider.class);
scoreDirectorFactoryConfig.setInitializingScoreTrend("ONLY_DOWN");
solverConfig.setScoreDirectorFactoryConfig(scoreDirectorFactoryConfig);
return solverConfig;
}
use of org.optaplanner.core.config.solver.SolverConfig in project kie-benchmarks by kiegroup.
the class TravelingTournamentExample method createInitialSolution.
public TravelingTournament createInitialSolution(TravelingTournamentExample.DataSet dataSet) {
SolverConfig solverConfig = Examples.TRAVELING_TOURNAMENT.getBaseSolverConfig();
SolverFactory<TravelingTournament> solverFactory = SolverFactory.create(solverConfig);
Solver<TravelingTournament> constructionSolver = solverFactory.buildSolver();
TravelingTournament solution = Examples.TRAVELING_TOURNAMENT.loadSolvingProblem(dataSet);
return constructionSolver.solve(solution);
}
use of org.optaplanner.core.config.solver.SolverConfig in project kie-benchmarks by kiegroup.
the class AbstractVRPTWLocalSearchBenchmark method createInitialSolution.
@Override
protected VehicleRoutingSolution createInitialSolution() {
SolverConfig solverConfig = Examples.VEHICLE_ROUTING.getBaseSolverConfig();
// different from simple VRP
solverConfig.getEntityClassList().add(TimeWindowedCustomer.class);
CustomPhaseConfig customPhaseConfig = new CustomPhaseConfig();
customPhaseConfig.setCustomPhaseCommandClassList(Collections.singletonList(VehicleRoutingSolutionInitializer.class));
solverConfig.setPhaseConfigList(Collections.singletonList(customPhaseConfig));
SolverFactory<VehicleRoutingSolution> solverFactory = SolverFactory.create(solverConfig);
Solver<VehicleRoutingSolution> constructionSolver = solverFactory.buildSolver();
VehicleRoutingSolution solution = Examples.VEHICLE_ROUTING.loadSolvingProblem(dataset);
return constructionSolver.solve(solution);
}
Aggregations