@Test public void simpleTest() { OverbookSplitter splitter = new OverbookSplitter(); List<Instance> instances = new ArrayList<>(); Model m0 = new DefaultModel(); Node n = m0.newNode(0); m0.getMapping().addOnlineNode(n); m0.getMapping().addOnlineNode(m0.newNode(1)); Model m1 = new DefaultModel(); m1.getMapping().addOnlineNode(m1.newNode(2)); m1.getMapping().addOnlineNode(m1.newNode(3)); instances.add(new Instance(m0, new ArrayList<>(), new MinMTTR())); instances.add(new Instance(m1, new ArrayList<>(), new MinMTTR())); Set<Node> all = new HashSet<>(m0.getMapping().getAllNodes()); all.addAll(m1.getMapping().getAllNodes()); TIntIntHashMap nodeIndex = Instances.makeNodeIndex(instances); Overbook oSimple = new Overbook(n, "cpu", 2); Assert.assertTrue(splitter.split(oSimple, null, instances, new TIntIntHashMap(), nodeIndex)); Assert.assertTrue(instances.get(0).getSatConstraints().contains(oSimple)); Assert.assertFalse(instances.get(1).getSatConstraints().contains(oSimple)); }
@Override public boolean split(Overbook cstr, Instance origin, final List<Instance> partitions, TIntIntHashMap vmsPosition, TIntIntHashMap nodePosition) { Node n = cstr.getInvolvedNodes().iterator().next(); int i = nodePosition.get(n.id()); return partitions.get(i).getSatConstraints().add(cstr); }
OverbookSplitter implements ConstraintSplitter<Overbook> { @Override public boolean split(Overbook cstr, Instance origin, final List<Instance> partitions, TIntIntHashMap vmsPosition, TIntIntHashMap nodePosition) { Node n = cstr.getInvolvedNodes().iterator().next(); int i = nodePosition.get(n.id()); return partitions.get(i).getSatConstraints().add(cstr); } }
OverbookSplitter implements ConstraintSplitter<Overbook> { @Override public boolean split(Overbook cstr, Instance origin, final List<Instance> partitions, TIntIntHashMap vmsPosition, TIntIntHashMap nodePosition) { Node n = cstr.getInvolvedNodes().iterator().next(); int i = nodePosition.get(n.id()); return partitions.get(i).getSatConstraints().add(cstr); }  }
OverbookSplitter implements ConstraintSplitter<Overbook> { @Override public boolean split(Overbook cstr, Instance origin, final List<Instance> partitions, TIntIntHashMap vmsPosition, TIntIntHashMap nodePosition) { Node n = cstr.getInvolvedNodes().iterator().next(); int i = nodePosition.get(n.id()); return partitions.get(i).getSatConstraints().add(cstr); }  @Override Class<Overbook> getKey(); @Override boolean split(Overbook cstr, Instance origin, final List<Instance> partitions, TIntIntHashMap vmsPosition, TIntIntHashMap nodePosition); }
OverbookSplitter implements ConstraintSplitter<Overbook> { @Override public boolean split(Overbook cstr, Instance origin, final List<Instance> partitions, TIntIntHashMap vmsPosition, TIntIntHashMap nodePosition) { Node n = cstr.getInvolvedNodes().iterator().next(); int i = nodePosition.get(n.id()); return partitions.get(i).getSatConstraints().add(cstr); }  @Override Class<Overbook> getKey(); @Override boolean split(Overbook cstr, Instance origin, final List<Instance> partitions, TIntIntHashMap vmsPosition, TIntIntHashMap nodePosition);  }