use of org.chocosolver.solver.Model in project scheduler by btrplace.
the class FastImpliesEqTest method test2.
@Test
public void test2() {
Model s = new Model();
BoolVar b = s.boolVar("b");
IntVar x = s.intVar("x", 0, 3, false);
int c = 2;
s.post(new FastImpliesEq(b, x, c));
Assert.assertEquals(5, s.getSolver().findAllSolutions().size());
}
use of org.chocosolver.solver.Model in project scheduler by btrplace.
the class FastImpliesEqTest method test5.
@Test
public void test5() {
Model s = new Model();
BoolVar b = s.boolVar(true);
IntVar x = s.intVar("x", 0, 3, true);
int c = 2;
s.post(new FastImpliesEq(b, x, c));
Assert.assertEquals(1, s.getSolver().findAllSolutions().size());
}
use of org.chocosolver.solver.Model 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.Model 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.Model 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);
}
Aggregations