Search in sources :

Example 6 with Model

use of org.chocosolver.solver.Model in project scheduler by btrplace.

the class FastIFFEqTest method test5.

@Test
public void test5() {
    Model csp = new Model();
    BoolVar b = csp.boolVar(true);
    IntVar x = csp.intVar("x", 0, 3);
    int c = 2;
    csp.post(new FastIFFEq(b, x, c));
    Assert.assertEquals(1, csp.getSolver().findAllSolutions().size());
}
Also used : Model(org.chocosolver.solver.Model) IntVar(org.chocosolver.solver.variables.IntVar) BoolVar(org.chocosolver.solver.variables.BoolVar) Test(org.testng.annotations.Test)

Example 7 with Model

use of org.chocosolver.solver.Model in project scheduler by btrplace.

the class FastIFFEqTest method test1.

@Test
public void test1() {
    Model csp = new Model();
    // SMF.log(s, true, true);
    BoolVar b = csp.boolVar("b");
    IntVar x = csp.intVar("x", 0, 3, true);
    int c = 2;
    csp.post(new FastIFFEq(b, x, c));
    Assert.assertEquals(4, csp.getSolver().findAllSolutions().size());
}
Also used : Model(org.chocosolver.solver.Model) IntVar(org.chocosolver.solver.variables.IntVar) BoolVar(org.chocosolver.solver.variables.BoolVar) Test(org.testng.annotations.Test)

Example 8 with Model

use of org.chocosolver.solver.Model in project scheduler by btrplace.

the class FastIFFEqTest method test7.

@Test
public void test7() {
    Model csp = new Model();
    BoolVar b = csp.boolVar(false);
    IntVar x = csp.intVar("x", 0, 2, true);
    int c = 3;
    csp.post(new FastIFFEq(b, x, c));
    Assert.assertEquals(3, csp.getSolver().findAllSolutions().size());
}
Also used : Model(org.chocosolver.solver.Model) IntVar(org.chocosolver.solver.variables.IntVar) BoolVar(org.chocosolver.solver.variables.BoolVar) Test(org.testng.annotations.Test)

Example 9 with Model

use of org.chocosolver.solver.Model in project scheduler by btrplace.

the class FastIFFEqTest method test4.

@Test
public void test4() {
    Model csp = new Model();
    BoolVar b = csp.boolVar(true);
    IntVar x = csp.intVar("x", 0, 2);
    int c = 3;
    csp.post(new FastIFFEq(b, x, c));
    Assert.assertEquals(0, csp.getSolver().findAllSolutions().size());
}
Also used : Model(org.chocosolver.solver.Model) IntVar(org.chocosolver.solver.variables.IntVar) BoolVar(org.chocosolver.solver.variables.BoolVar) Test(org.testng.annotations.Test)

Example 10 with Model

use of org.chocosolver.solver.Model in project scheduler by btrplace.

the class FastImpliesEqTest method test6.

@Test
public void test6() {
    Model s = new Model();
    BoolVar b = s.boolVar(false);
    IntVar x = s.intVar("x", 0, 3, true);
    int c = 2;
    s.post(new FastImpliesEq(b, x, c));
    Assert.assertEquals(4, s.getSolver().findAllSolutions().size());
}
Also used : Model(org.chocosolver.solver.Model) IntVar(org.chocosolver.solver.variables.IntVar) BoolVar(org.chocosolver.solver.variables.BoolVar) Test(org.testng.annotations.Test)

Aggregations

Model (org.chocosolver.solver.Model)38 IntVar (org.chocosolver.solver.variables.IntVar)32 Test (org.testng.annotations.Test)20 BoolVar (org.chocosolver.solver.variables.BoolVar)17 Node (org.btrplace.model.Node)7 VM (org.btrplace.model.VM)7 ArrayList (java.util.ArrayList)6 VMTransition (org.btrplace.scheduler.choco.transition.VMTransition)4 TIntArrayList (gnu.trove.list.array.TIntArrayList)3 RelocatableVM (org.btrplace.scheduler.choco.transition.RelocatableVM)3 HashSet (java.util.HashSet)2 SchedulerModelingException (org.btrplace.scheduler.SchedulerModelingException)2 Task (org.chocosolver.solver.variables.Task)2 Collection (java.util.Collection)1 Collections (java.util.Collections)1 List (java.util.List)1 Objects (java.util.Objects)1 Among (org.btrplace.model.constraint.Among)1 SplitAmong (org.btrplace.model.constraint.SplitAmong)1 Parameters (org.btrplace.scheduler.choco.Parameters)1