use of org.chocosolver.solver.variables.IntVar in project scheduler by btrplace.
the class FastImpliesEqTest method test3.
@Test
public void test3() {
Model s = new Model();
BoolVar b = s.boolVar("b");
IntVar x = s.intVar("x", 0, 2, true);
int c = 3;
s.post(new FastImpliesEq(b, x, c));
Assert.assertEquals(3, s.getSolver().findAllSolutions().size());
}
use of org.chocosolver.solver.variables.IntVar 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.IntVar in project scheduler by btrplace.
the class PrecedencesTest method simpleTest.
/**
* Ends variables vary between 1 and 2 + index of the host
* Just a simple test.
*/
@Test
public void simpleTest() {
Model s = new Model();
IntVar[] ends = new IntVar[3];
int[] others = new int[3];
others[0] = 0;
ends[0] = s.intVar("ends[0]", 1, 2, true);
others[1] = 0;
ends[1] = s.intVar("ends[1]", 1, 3, true);
others[2] = 0;
ends[2] = s.intVar("ends[2]", 1, 4, true);
/*
on host 0, 2 * 2 * 2 -> 8
on host 1, 2 * 2 -> 4
on host 2, 4 * 4 * 2 -> 32
16 * 9 * 16 + 27 * 4 * 16 + 32 * 4 * 9
*/
IntVar host = s.intVar(0, 0);
IntVar start = s.intVar(0, 5, true);
Precedences p = new Precedences(host, start, others, ends);
s.post(p);
// TODO: A way to check if it is correct ? :D
Assert.assertEquals(s.getSolver().findAllSolutions().size(), 75);
}
use of org.chocosolver.solver.variables.IntVar in project scheduler by btrplace.
the class RoundedUpDivisionTest method test2.
@Test
public void test2() {
Model s = new Model();
IntVar a = s.intVar("a", 0, 32, true);
IntVar b = s.intVar("b", 0, 48, true);
double q = 1.5;
s.post(new RoundedUpDivision(a, b, q));
Assert.assertEquals(s.getSolver().findAllSolutions().size(), 49);
// Assert.assertEquals(s.getNbSolutions(), 33);
}
use of org.chocosolver.solver.variables.IntVar in project scheduler by btrplace.
the class VectorPackingTest method test2DGuillaume.
@Test(sequential = true)
public void test2DGuillaume() {
modelPack2D(2, 100, 3, 30);
IntVar margeLoad = s.intVar("margeLoad", 0, 50, true);
s.post(s.element(margeLoad, loads[0], bins[0], 0));
testPack(2);
}
Aggregations