use of org.chocosolver.solver.variables.BoolVar in project scheduler by btrplace.
the class FastImpliesEqTest method test4.
@Test
public void test4() {
Model s = new Model();
BoolVar b = s.boolVar(true);
IntVar x = s.intVar("x", 0, 2, true);
int c = 3;
s.post(new FastImpliesEq(b, x, c));
Assert.assertEquals(0, s.getSolver().findAllSolutions().size());
}
use of org.chocosolver.solver.variables.BoolVar in project scheduler by btrplace.
the class CNoDelay method inject.
@Override
public boolean inject(Parameters ps, ReconfigurationProblem rp) {
VM v = noDelay.getInvolvedVMs().iterator().next();
// For each vm involved in the constraint
VMTransition vt = rp.getVMAction(v);
// Get the VMTransition start time
// Add the constraint "start = 0" to the solver
Slice d = vt.getDSlice();
if (d == null) {
return true;
}
if (!(vt instanceof RelocatableVM)) {
try {
d.getStart().instantiateTo(0, Cause.Null);
} catch (ContradictionException ex) {
rp.getLogger().error("Unable to prevent any delay on '" + v + "'", ex);
return false;
}
} else {
Constraint c = rp.getModel().arithm(d.getStart(), "=", 0);
BoolVar move = ((RelocatableVM) vt).isStaying().not();
ChocoUtils.postImplies(rp, move, c);
}
return true;
}
Aggregations