use of org.btrplace.scheduler.choco.extensions.RoundedUpDivision in project scheduler by btrplace.
the class CShareableResource method overbook.
private boolean overbook(int nIdx, double r) {
Node n = rp.getNode(nIdx);
int maxPhy = getSourceResource().getCapacity(n);
int maxVirt = (int) (maxPhy * r);
if (maxVirt != 0) {
csp.post(new RoundedUpDivision(phyRcUsage.get(nIdx), virtRcUsage.get(nIdx), r));
return true;
}
try {
phyRcUsage.get(nIdx).instantiateTo(0, Cause.Null);
} catch (ContradictionException ex) {
rp.getLogger().error("Unable to restrict the physical '" + getResourceIdentifier() + "' capacity of " + n + " to " + maxPhy, ex);
return false;
}
return true;
}
Aggregations