use of org.btrplace.scheduler.choco.runner.SolvingStatistics in project scheduler by btrplace.
the class DefaultChocoSchedulerTest method testGetStatisticsWithNoSolution.
@Test
public void testGetStatisticsWithNoSolution() throws SchedulerException {
Model mo = new DefaultModel();
Mapping map = mo.getMapping();
VM v = mo.newVM();
Node n = mo.newNode();
map.addReadyVM(v);
map.addOfflineNode(n);
ChocoScheduler cra = new DefaultChocoScheduler();
ReconfigurationPlan p = cra.solve(mo, Arrays.asList(new Running(v), new Offline(n)));
Assert.assertNull(p);
SolvingStatistics stats = cra.getStatistics();
Assert.assertNotNull(stats);
Assert.assertTrue(stats.getSolutions().isEmpty());
// Assert.assertFalse(stats.hitTimeout());
}
use of org.btrplace.scheduler.choco.runner.SolvingStatistics in project scheduler by btrplace.
the class Bench method solve.
private static void solve(LabelledInstance i, Parameters ps) throws IOException {
ChocoScheduler s = new DefaultChocoScheduler().setParameters(ps);
String status = "OK";
try {
s.solve(i);
} catch (@SuppressWarnings("unused") UnstatableProblemException ex) {
status = "TO";
} catch (@SuppressWarnings("unused") SchedulerException ex) {
status = "FAIL";
}
if (opts.single()) {
out(0, "%s%n", s.getStatistics());
} else {
SolvingStatistics stats = s.getStatistics();
if (stats.getSolutions().isEmpty()) {
status = "KO*";
} else {
status = "OK";
if (stats.completed()) {
status += "*";
}
}
if (opts.verbosity() == 0) {
out(0, "%s: %s%n", i.label, status);
} else {
out(1, "----- %s -----%n", i.label);
out(1, "%s%n", stats);
out(1, "%n");
}
File output = opts.output();
store(i, stats, output);
}
}
Aggregations