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;
}
Aggregations