Search in sources :

Example 1 with KeepRunningVM

use of org.btrplace.scheduler.choco.transition.KeepRunningVM in project scheduler by btrplace.

the class DefaultCumulatives method symmetryBreakingForStayingVMs.

/**
 * Symmetry breaking for VMs that stay running, on the same node.
 *
 * @return {@code true} iff the symmetry breaking does not lead to a problem without solutions
 */
private boolean symmetryBreakingForStayingVMs(ReconfigurationProblem rp) {
    for (VM vm : rp.getFutureRunningVMs()) {
        VMTransition a = rp.getVMAction(vm);
        Slice dSlice = a.getDSlice();
        Slice cSlice = a.getCSlice();
        if (dSlice != null && cSlice != null) {
            BoolVar stay = ((KeepRunningVM) a).isStaying();
            Boolean ret = strictlyDecreasingOrUnchanged(vm);
            if (Boolean.TRUE.equals(ret) && !zeroDuration(rp, stay, cSlice)) {
                return false;
            // Else, the resource usage is decreasing, so
            // we set the cSlice duration to 0 to directly reduces the resource allocation
            } else if (Boolean.FALSE.equals(ret) && !zeroDuration(rp, stay, dSlice)) {
                // (the allocation will be performed at the end of the reconfiguration process)
                return false;
            }
        }
    }
    return true;
}
Also used : Slice(org.btrplace.scheduler.choco.Slice) KeepRunningVM(org.btrplace.scheduler.choco.transition.KeepRunningVM) VM(org.btrplace.model.VM) KeepRunningVM(org.btrplace.scheduler.choco.transition.KeepRunningVM) VMTransition(org.btrplace.scheduler.choco.transition.VMTransition) BoolVar(org.chocosolver.solver.variables.BoolVar)

Aggregations

VM (org.btrplace.model.VM)1 Slice (org.btrplace.scheduler.choco.Slice)1 KeepRunningVM (org.btrplace.scheduler.choco.transition.KeepRunningVM)1 VMTransition (org.btrplace.scheduler.choco.transition.VMTransition)1 BoolVar (org.chocosolver.solver.variables.BoolVar)1