use of org.btrplace.scheduler.choco.extensions.Disjoint in project scheduler by btrplace.
the class CLonely method inject.
@Override
public boolean inject(Parameters ps, ReconfigurationProblem rp) {
// Remove non future-running VMs
List<IntVar> myHosts = new ArrayList<>();
List<IntVar> otherHosts = new ArrayList<>();
Collection<VM> vms = new HashSet<>();
Set<VM> otherVMs = new HashSet<>();
for (VM vm : rp.getFutureRunningVMs()) {
IntVar host = rp.getVMAction(vm).getDSlice().getHoster();
if (cstr.getInvolvedVMs().contains(vm)) {
myHosts.add(host);
vms.add(vm);
} else {
otherHosts.add(host);
otherVMs.add(vm);
}
}
// Link the assignment variables with the set
Model s = rp.getModel();
s.post(new Disjoint(myHosts.toArray(new IntVar[myHosts.size()]), otherHosts.toArray(new IntVar[otherHosts.size()]), rp.getNodes().size()));
if (cstr.isContinuous()) {
continuousRestriction(rp, vms, otherVMs);
}
return true;
}
Aggregations