Search in sources :

Example 6 with SolvingStatistics

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());
}
Also used : DefaultModel(org.btrplace.model.DefaultModel) VM(org.btrplace.model.VM) Node(org.btrplace.model.Node) ReconfigurationPlan(org.btrplace.plan.ReconfigurationPlan) Model(org.btrplace.model.Model) DefaultModel(org.btrplace.model.DefaultModel) Running(org.btrplace.model.constraint.Running) Offline(org.btrplace.model.constraint.Offline) Mapping(org.btrplace.model.Mapping) SolvingStatistics(org.btrplace.scheduler.choco.runner.SolvingStatistics) Test(org.testng.annotations.Test)

Example 7 with SolvingStatistics

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);
    }
}
Also used : DefaultChocoScheduler(org.btrplace.scheduler.choco.DefaultChocoScheduler) ChocoScheduler(org.btrplace.scheduler.choco.ChocoScheduler) SchedulerException(org.btrplace.scheduler.SchedulerException) DefaultChocoScheduler(org.btrplace.scheduler.choco.DefaultChocoScheduler) UnstatableProblemException(org.btrplace.scheduler.UnstatableProblemException) SolvingStatistics(org.btrplace.scheduler.choco.runner.SolvingStatistics) File(java.io.File)

Aggregations

SolvingStatistics (org.btrplace.scheduler.choco.runner.SolvingStatistics)7 ReconfigurationPlan (org.btrplace.plan.ReconfigurationPlan)4 Model (org.btrplace.model.Model)3 Node (org.btrplace.model.Node)3 SchedulerException (org.btrplace.scheduler.SchedulerException)3 Test (org.testng.annotations.Test)3 ArrayList (java.util.ArrayList)2 DefaultModel (org.btrplace.model.DefaultModel)2 Instance (org.btrplace.model.Instance)2 Mapping (org.btrplace.model.Mapping)2 VM (org.btrplace.model.VM)2 Offline (org.btrplace.model.constraint.Offline)2 Running (org.btrplace.model.constraint.Running)2 SatConstraint (org.btrplace.model.constraint.SatConstraint)2 ChocoScheduler (org.btrplace.scheduler.choco.ChocoScheduler)2 DefaultChocoScheduler (org.btrplace.scheduler.choco.DefaultChocoScheduler)2 File (java.io.File)1 Collection (java.util.Collection)1 HashSet (java.util.HashSet)1 List (java.util.List)1