|
1 | 1 | package ai.timefold.solver.benchmarks.examples.common.app; |
2 | 2 |
|
3 | | -import java.io.File; |
4 | | -import java.nio.file.Path; |
5 | | -import java.util.Collections; |
6 | | -import java.util.Set; |
7 | | - |
8 | 3 | import ai.timefold.solver.benchmarks.examples.common.persistence.AbstractSolutionImporter; |
9 | 4 | import ai.timefold.solver.core.api.domain.solution.PlanningSolution; |
10 | 5 | import ai.timefold.solver.core.api.solver.SolverConfigOverride; |
11 | 6 | import ai.timefold.solver.core.api.solver.SolverFactory; |
12 | 7 | import ai.timefold.solver.core.config.solver.termination.TerminationConfig; |
13 | 8 | import ai.timefold.solver.persistence.common.api.domain.solution.SolutionFileIO; |
14 | 9 |
|
| 10 | +import java.io.File; |
| 11 | +import java.nio.file.Path; |
| 12 | +import java.util.Collections; |
| 13 | +import java.util.Set; |
| 14 | + |
15 | 15 | /** |
16 | 16 | * @param <Solution_> the solution type, the class with the {@link PlanningSolution} annotation |
17 | 17 | */ |
@@ -117,9 +117,17 @@ public final Solution_ solve(String datasetName) { |
117 | 117 | return solve(datasetName, 1L); |
118 | 118 | } |
119 | 119 |
|
| 120 | + public final Solution_ solve(Solution_ solution) { |
| 121 | + return solve(solution, 1L); |
| 122 | + } |
| 123 | + |
120 | 124 | public final Solution_ solve(String datasetName, long minutesSpentLimit) { |
121 | 125 | var solutionFileIo = createSolutionFileIO(); |
122 | 126 | var solution = solutionFileIo.read(Path.of("data", dataDirName, "unsolved", datasetName).toFile().getAbsoluteFile()); |
| 127 | + return solve(solution, minutesSpentLimit); |
| 128 | + } |
| 129 | + |
| 130 | + public final Solution_ solve(Solution_ solution, long minutesSpentLimit) { |
123 | 131 | var solverFactory = SolverFactory.<Solution_> createFromXmlResource(solverConfigResource); |
124 | 132 | var solver = solverFactory.buildSolver(new SolverConfigOverride<Solution_>() |
125 | 133 | .withTerminationConfig(new TerminationConfig() |
|
0 commit comments