@Test public void testGetMisplaced() { 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(); Node n4 = mo.newNode(); Mapping map = mo.getMapping() .on(n1, n2, n3, n4) .run(n1, vm1).run(n2, vm2, vm3) .ready(vm4, vm5); Set<VM> vms = new HashSet<>(Arrays.asList(vm1, vm2, vm5)); Collection<Node> s1 = new HashSet<>(Arrays.asList(n1, n2)); Collection<Node> s2 = new HashSet<>(Arrays.asList(n3, n4)); Collection<Collection<Node>> pGrps = new HashSet<>(Arrays.asList(s1, s2)); Among a = new Among(vms, pGrps); CAmong ca = new CAmong(a); Instance i = new Instance(mo, Collections.emptyList(), new MinMTTR()); Assert.assertEquals(ca.getMisPlacedVMs(i), Collections.emptySet()); map.addRunningVM(vm5, n3); Assert.assertEquals(ca.getMisPlacedVMs(i), vms); }
@Override public Set<VM> getMisPlacedVMs(Instance i) { if (!cstr.isSatisfied(i.getModel())) { return new HashSet<>(cstr.getInvolvedVMs()); } return Collections.emptySet(); }
CAmong implements ChocoConstraint { @Override public Set<VM> getMisPlacedVMs(Instance i) { if (!cstr.isSatisfied(i.getModel())) { return new HashSet<>(cstr.getInvolvedVMs()); } return Collections.emptySet(); } }
CAmong implements ChocoConstraint { @Override public Set<VM> getMisPlacedVMs(Instance i) { if (!cstr.isSatisfied(i.getModel())) { return new HashSet<>(cstr.getInvolvedVMs()); } return Collections.emptySet(); } CAmong(Among a); }
CAmong implements ChocoConstraint { @Override public Set<VM> getMisPlacedVMs(Instance i) { if (!cstr.isSatisfied(i.getModel())) { return new HashSet<>(cstr.getInvolvedVMs()); } return Collections.emptySet(); } CAmong(Among a); IntVar getGroupVariable(); @Override boolean inject(Parameters ps, ReconfigurationProblem rp); int getGroup(Node n, List<Collection<Node>> grps); @Override Set<VM> getMisPlacedVMs(Instance i); @Override String toString(); }
CAmong implements ChocoConstraint { @Override public Set<VM> getMisPlacedVMs(Instance i) { if (!cstr.isSatisfied(i.getModel())) { return new HashSet<>(cstr.getInvolvedVMs()); } return Collections.emptySet(); } CAmong(Among a); IntVar getGroupVariable(); @Override boolean inject(Parameters ps, ReconfigurationProblem rp); int getGroup(Node n, List<Collection<Node>> grps); @Override Set<VM> getMisPlacedVMs(Instance i); @Override String toString(); static final String GROUP_LABEL; }