Search in sources :

Example 11 with MaxOnline

use of org.btrplace.model.constraint.MaxOnline 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()));
}
Also used : DefaultModel(org.btrplace.model.DefaultModel) DefaultChocoScheduler(org.btrplace.scheduler.choco.DefaultChocoScheduler) ChocoScheduler(org.btrplace.scheduler.choco.ChocoScheduler) MaxOnline(org.btrplace.model.constraint.MaxOnline) DefaultChocoScheduler(org.btrplace.scheduler.choco.DefaultChocoScheduler) Node(org.btrplace.model.Node) VM(org.btrplace.model.VM) ReconfigurationPlan(org.btrplace.plan.ReconfigurationPlan) Model(org.btrplace.model.Model) DefaultModel(org.btrplace.model.DefaultModel) Mapping(org.btrplace.model.Mapping) Test(org.testng.annotations.Test)

Aggregations

MaxOnline (org.btrplace.model.constraint.MaxOnline)11 DefaultModel (org.btrplace.model.DefaultModel)9 Node (org.btrplace.model.Node)9 Test (org.testng.annotations.Test)9 Model (org.btrplace.model.Model)8 ReconfigurationPlan (org.btrplace.plan.ReconfigurationPlan)6 ChocoScheduler (org.btrplace.scheduler.choco.ChocoScheduler)6 DefaultChocoScheduler (org.btrplace.scheduler.choco.DefaultChocoScheduler)6 ArrayList (java.util.ArrayList)5 VM (org.btrplace.model.VM)5 SatConstraint (org.btrplace.model.constraint.SatConstraint)5 Mapping (org.btrplace.model.Mapping)4 ShareableResource (org.btrplace.model.view.ShareableResource)4 HashSet (java.util.HashSet)3 Instance (org.btrplace.model.Instance)2 Online (org.btrplace.model.constraint.Online)2 DefaultParameters (org.btrplace.scheduler.choco.DefaultParameters)2 TIntIntHashMap (gnu.trove.map.hash.TIntIntHashMap)1 Collection (java.util.Collection)1 List (java.util.List)1