Search in sources :

Example 6 with BoolVar

use of org.chocosolver.solver.variables.BoolVar 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 7 with BoolVar

use of org.chocosolver.solver.variables.BoolVar 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 8 with BoolVar

use of org.chocosolver.solver.variables.BoolVar 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)

Example 9 with BoolVar

use of org.chocosolver.solver.variables.BoolVar in project scheduler by btrplace.

the class FastImpliesEqTest method test7.

@Test
public void test7() {
    Model s = new Model();
    BoolVar b = s.boolVar(false);
    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());
}
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 BoolVar

use of org.chocosolver.solver.variables.BoolVar in project scheduler by btrplace.

the class FastImpliesEqTest method test1.

@Test
public void test1() {
    Model s = new Model();
    // SMF.log(s, true, true);
    BoolVar b = s.boolVar("b");
    IntVar x = s.intVar("x", 0, 3, true);
    int c = 2;
    s.post(new FastImpliesEq(b, x, c));
    Assert.assertEquals(5, 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

BoolVar (org.chocosolver.solver.variables.BoolVar)22 Model (org.chocosolver.solver.Model)17 IntVar (org.chocosolver.solver.variables.IntVar)17 Test (org.testng.annotations.Test)16 VM (org.btrplace.model.VM)4 Constraint (org.chocosolver.solver.constraints.Constraint)4 DefaultModel (org.btrplace.model.DefaultModel)2 Mapping (org.btrplace.model.Mapping)2 Model (org.btrplace.model.Model)2 Node (org.btrplace.model.Node)2 OptConstraint (org.btrplace.model.constraint.OptConstraint)2 SatConstraint (org.btrplace.model.constraint.SatConstraint)2 ReconfigurationPlan (org.btrplace.plan.ReconfigurationPlan)2 Slice (org.btrplace.scheduler.choco.Slice)2 VMTransition (org.btrplace.scheduler.choco.transition.VMTransition)2 ShareableResource (org.btrplace.model.view.ShareableResource)1 CMinMTTR (org.btrplace.scheduler.choco.constraint.mttr.CMinMTTR)1 KeepRunningVM (org.btrplace.scheduler.choco.transition.KeepRunningVM)1 RelocatableVM (org.btrplace.scheduler.choco.transition.RelocatableVM)1 ContradictionException (org.chocosolver.solver.exception.ContradictionException)1