use of org.btrplace.plan.ReconfigurationPlan in project scheduler by btrplace.
the class SolverTuning method solve.
private static void solve(ChocoScheduler cra, Model model, Set<SatConstraint> constraints) {
try {
ReconfigurationPlan p = cra.solve(model, constraints);
if (p != null) {
System.out.println("\nReconfiguration plan:");
System.out.println(p);
}
} finally {
System.out.println("--- Solving using repair : " + cra.doRepair());
System.out.println(cra.getStatistics());
}
}
use of org.btrplace.plan.ReconfigurationPlan in project scheduler by btrplace.
the class AdvancedMigScheduling method solve.
private static void solve(Model mo, List<SatConstraint> cstrs) {
ReconfigurationPlan p = new DefaultChocoScheduler().solve(mo, cstrs);
System.out.println(p);
System.out.flush();
}
use of org.btrplace.plan.ReconfigurationPlan in project scheduler by btrplace.
the class StaticPartitioning method merge.
private ReconfigurationPlan merge(Instance i, Collection<SolvingStatistics> results) throws SplitException {
ReconfigurationPlan plan = new DefaultReconfigurationPlan(i.getModel());
// Only if there is a solution
for (SolvingStatistics result : results) {
getStatistics().addPartitionStatistics(result);
ReconfigurationPlan p = result.lastSolution();
if (p == null) {
return null;
}
for (Action a : p) {
if (!plan.add(a)) {
throw new SplitException(plan.getOrigin(), "Unable to add action '" + a + "' while merging the sub-plans");
}
}
}
return plan;
}
use of org.btrplace.plan.ReconfigurationPlan in project scheduler by btrplace.
the class FixedNodeSetsPartitioningTest method testSplit.
@Test
public void testSplit() throws SchedulerException {
Instance origin = makeInstance();
List<Collection<Node>> parts = splitIn(origin.getModel().getMapping().getAllNodes(), 3);
FixedNodeSetsPartitioning f = new FixedNodeSetsPartitioning(parts);
f.setWorkersCount(3);
List<Instance> subs = f.split(new DefaultParameters(), origin);
// Check disjoint set of ready VMs
Set<VM> allReady = new HashSet<>();
for (Instance i : subs) {
allReady.addAll(i.getModel().getMapping().getReadyVMs());
}
Assert.assertEquals(allReady.size(), 30);
// Quick solve
DefaultChocoScheduler cra = new DefaultChocoScheduler();
cra.setInstanceSolver(f);
ReconfigurationPlan plan = cra.solve(origin);
// all the VMs to launch have been booted
Assert.assertEquals(plan.getSize(), 30);
System.out.println(cra.getStatistics());
System.out.flush();
}
use of org.btrplace.plan.ReconfigurationPlan in project scheduler by btrplace.
the class FixedSizePartitioningTest method testRandomSplit.
@Test
public void testRandomSplit() throws SchedulerException {
Instance origin = makeInstance();
FixedSizePartitioning f = new FixedSizePartitioning(5);
f.randomPickUp(true);
Assert.assertEquals(f.randomPickUp(), true);
List<Instance> l1 = f.split(params, origin);
Assert.assertEquals(l1.size(), 3);
checkCorrectness(l1);
List<Instance> l2 = f.split(params, origin);
Assert.assertEquals(l2.size(), 3);
checkCorrectness(l2);
/* //Just check the list of nodes are different
for (int i = 0; i < l1.size(); i++) {
for (int j = 0; j < l2.size(); j++) {
Assert.assertFalse(l1.get(i).getModel().getMapping().getAllNodes().equals(
l2.get(j).getModel().getMapping().getAllNodes()), "l1:" + l1.get(i).getModel().getMapping().getAllNodes()
+ " l2:" + l2.get(i).getModel().getMapping().getAllNodes());
}
}*/
// Get a solution, the ready VMs must have been launched
ReconfigurationPlan plan = f.solve(params, origin);
Assert.assertEquals(plan.getSize(), 5);
}
Aggregations