Search in sources :

Example 1 with RoundedUpDivision

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;
}
Also used : RoundedUpDivision(org.btrplace.scheduler.choco.extensions.RoundedUpDivision) ContradictionException(org.chocosolver.solver.exception.ContradictionException) Node(org.btrplace.model.Node) SatConstraint(org.btrplace.model.constraint.SatConstraint)

Aggregations

Node (org.btrplace.model.Node)1 SatConstraint (org.btrplace.model.constraint.SatConstraint)1 RoundedUpDivision (org.btrplace.scheduler.choco.extensions.RoundedUpDivision)1 ContradictionException (org.chocosolver.solver.exception.ContradictionException)1