Commit 3f956822 authored by Johannes Mey's avatar Johannes Mey
Browse files

make random solver more reliable

parent ce87f1ed
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment