use of org.btrplace.scheduler.choco.DefaultChocoScheduler in project scheduler by btrplace.
the class CGatherTest method testDiscreteWithRunningVMs.
@Test
public void testDiscreteWithRunningVMs() throws SchedulerException {
Model mo = new DefaultModel();
VM vm1 = mo.newVM();
VM vm2 = mo.newVM();
Node n1 = mo.newNode();
Node n2 = mo.newNode();
Mapping map = mo.getMapping().ready(vm1).on(n1, n2).run(n2, vm2);
Gather g = new Gather(map.getAllVMs());
g.setContinuous(false);
ChocoScheduler cra = new DefaultChocoScheduler();
List<SatConstraint> cstrs = new ArrayList<>();
cstrs.add(g);
cstrs.addAll(Running.newRunning(map.getAllVMs()));
ReconfigurationPlan plan = cra.solve(mo, cstrs);
Assert.assertNotNull(plan);
Model res = plan.getResult();
Assert.assertEquals(res.getMapping().getVMLocation(vm1), res.getMapping().getVMLocation(vm2));
}
use of org.btrplace.scheduler.choco.DefaultChocoScheduler in project scheduler by btrplace.
the class CGatherTest method testContinuousWithNoRunningVMs.
@Test
public void testContinuousWithNoRunningVMs() throws SchedulerException {
Model mo = new DefaultModel();
VM vm1 = mo.newVM();
VM vm2 = mo.newVM();
Node n1 = mo.newNode();
Node n2 = mo.newNode();
Mapping map = mo.getMapping().on(n1, n2).ready(vm1, vm2);
Gather g = new Gather(map.getAllVMs());
g.setContinuous(true);
List<SatConstraint> cstrs = new ArrayList<>();
cstrs.add(g);
cstrs.addAll(Running.newRunning(map.getAllVMs()));
ChocoScheduler cra = new DefaultChocoScheduler();
ReconfigurationPlan plan = cra.solve(mo, cstrs);
Assert.assertNotNull(plan);
}
use of org.btrplace.scheduler.choco.DefaultChocoScheduler in project scheduler by btrplace.
the class CGatherTest method testDiscreteWithoutRunningVM.
@Test
public void testDiscreteWithoutRunningVM() throws SchedulerException {
Model mo = new DefaultModel();
VM vm1 = mo.newVM();
VM vm2 = mo.newVM();
Node n1 = mo.newNode();
Node n2 = mo.newNode();
Mapping map = mo.getMapping().ready(vm1).on(n1, n2).run(n2, vm2);
Gather g = new Gather(map.getAllVMs());
g.setContinuous(false);
ChocoScheduler cra = new DefaultChocoScheduler();
ReconfigurationPlan plan = cra.solve(mo, Collections.singleton(g));
Assert.assertNotNull(plan);
Assert.assertEquals(plan.getSize(), 0);
Model res = plan.getResult();
Assert.assertTrue(res.getMapping().isReady(vm1));
}
use of org.btrplace.scheduler.choco.DefaultChocoScheduler in project scheduler by btrplace.
the class CLonelyTest method testFeasibleDiscrete.
@Test
public void testFeasibleDiscrete() throws SchedulerException {
Model mo = new DefaultModel();
VM vm1 = mo.newVM();
VM vm2 = mo.newVM();
VM vm3 = mo.newVM();
VM vm4 = mo.newVM();
VM vm5 = mo.newVM();
Node n1 = mo.newNode();
Node n2 = mo.newNode();
Node n3 = mo.newNode();
mo.getMapping().on(n1, n2, n3).run(n1, vm1, vm2).run(n2, vm3, vm4, vm5);
Set<VM> mine = new HashSet<>(Arrays.asList(vm1, vm2, vm3));
ChocoScheduler cra = new DefaultChocoScheduler();
Lonely l = new Lonely(mine);
l.setContinuous(false);
ReconfigurationPlan plan = cra.solve(mo, Collections.singleton(l));
Assert.assertNotNull(plan);
// System.out.println(plan);
// Assert.assertEquals(l.isSatisfied(plan.getResult()), SatConstraint.Sat.SATISFIED);
}
use of org.btrplace.scheduler.choco.DefaultChocoScheduler in project scheduler by btrplace.
the class CMaxOnlineTest method discreteMaxOnlineTest.
@Test
public void discreteMaxOnlineTest() throws SchedulerException {
Model model = new DefaultModel();
Node n1 = model.newNode();
Node n2 = model.newNode();
Node n3 = model.newNode();
VM vm1 = model.newVM();
VM vm2 = model.newVM();
VM vm3 = model.newVM();
Mapping map = model.getMapping().on(n1, n2, n3).run(n1, vm1).run(n2, vm2).run(n3, vm3);
MappingUtils.fill(map, model.getMapping());
Set<Node> nodes = map.getAllNodes();
MaxOnline maxon = new MaxOnline(nodes, 1);
ChocoScheduler cra = new DefaultChocoScheduler();
cra.setMaxEnd(3);
// cra.setTimeLimit(3);
ReconfigurationPlan plan = cra.solve(model, Collections.singleton(maxon));
Assert.assertTrue(maxon.isSatisfied(plan.getResult()));
}
Aggregations