Skip to content
Snippets Groups Projects
Commit 3f956822 authored by Johannes Mey's avatar Johannes Mey
Browse files

make random solver more reliable

parent ce87f1ed
No related branches found
No related tags found
No related merge requests found
......@@ -27,12 +27,11 @@ public class RandomSolver implements BenchmarkableSolver {
private long maxSolvingTime;
private boolean timedOut;
public RandomSolver() {
this(Long.MAX_VALUE);
}
private final Random random;
public RandomSolver(long maxSolvingTime) {
public RandomSolver(long maxSolvingTime, long seed) {
this.maxSolvingTime = maxSolvingTime;
this.random = new Random(seed);
reset();
}
......@@ -50,8 +49,6 @@ public class RandomSolver implements BenchmarkableSolver {
List<Solution> solutions = new ArrayList<>();
Random random = new Random();
do {
numTotalSoftwareSolutions++;
......
......@@ -6,6 +6,6 @@ public class RandomHandwrittenTest extends HandwrittenTestSuite {
@Override
protected Solver getSolver() {
return new RandomSolver(60000);
return new RandomSolver(5000, 0);
}
}
......@@ -42,7 +42,7 @@ public class RandomSolverTest {
ScenarioGenerator generator = new ScenarioGenerator(new ScenarioDescription(tlc, iac, isd, cac, csd, dep, imp, res, req, cpu, seed));
Root model = generator.generate();
RandomSolver solver = new RandomSolver(5000);
RandomSolver solver = new RandomSolver(5000, 1337);
Solution solution = solver.solve(model);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment