Skip to content

Commit bf97f1e

Browse files
committed
improvements to common app
1 parent e7ed585 commit bf97f1e

File tree

1 file changed

+13
-5
lines changed
  • src/main/java/ai/timefold/solver/benchmarks/examples/common/app

1 file changed

+13
-5
lines changed

src/main/java/ai/timefold/solver/benchmarks/examples/common/app/CommonApp.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
package ai.timefold.solver.benchmarks.examples.common.app;
22

3-
import java.io.File;
4-
import java.nio.file.Path;
5-
import java.util.Collections;
6-
import java.util.Set;
7-
83
import ai.timefold.solver.benchmarks.examples.common.persistence.AbstractSolutionImporter;
94
import ai.timefold.solver.core.api.domain.solution.PlanningSolution;
105
import ai.timefold.solver.core.api.solver.SolverConfigOverride;
116
import ai.timefold.solver.core.api.solver.SolverFactory;
127
import ai.timefold.solver.core.config.solver.termination.TerminationConfig;
138
import ai.timefold.solver.persistence.common.api.domain.solution.SolutionFileIO;
149

10+
import java.io.File;
11+
import java.nio.file.Path;
12+
import java.util.Collections;
13+
import java.util.Set;
14+
1515
/**
1616
* @param <Solution_> the solution type, the class with the {@link PlanningSolution} annotation
1717
*/
@@ -117,9 +117,17 @@ public final Solution_ solve(String datasetName) {
117117
return solve(datasetName, 1L);
118118
}
119119

120+
public final Solution_ solve(Solution_ solution) {
121+
return solve(solution, 1L);
122+
}
123+
120124
public final Solution_ solve(String datasetName, long minutesSpentLimit) {
121125
var solutionFileIo = createSolutionFileIO();
122126
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) {
123131
var solverFactory = SolverFactory.<Solution_> createFromXmlResource(solverConfigResource);
124132
var solver = solverFactory.buildSolver(new SolverConfigOverride<Solution_>()
125133
.withTerminationConfig(new TerminationConfig()

0 commit comments

Comments
 (0)