Limit solving duration to 2 seconds

This commit is contained in:
Geoffrey De Smet 2023-11-25 14:15:27 +01:00
parent dfd736183f
commit 25bfddf417
1 changed files with 3 additions and 3 deletions

View File

@ -20,9 +20,9 @@ public class ShiftScheduleApp {
SolverFactory<ShiftSchedule> solverFactory = SolverFactory.create(new SolverConfig().withSolutionClass(ShiftSchedule.class)
.withEntityClasses(Shift.class)
.withConstraintProviderClass(ShiftScheduleConstraintProvider.class)
// The solver runs only for 5 seconds on this small dataset.
// It's recommended to run for at least 5 minutes ("5m") otherwise.
.withTerminationSpentLimit(Duration.ofSeconds(5)));
// The solver runs only for 2 seconds on this tiny dataset.
// It's recommended to run for at least 5 minutes ("5m") on large datasets.
.withTerminationSpentLimit(Duration.ofSeconds(2)));
Solver<ShiftSchedule> solver = solverFactory.buildSolver();
ShiftSchedule problem = loadProblem();