Examples of SetVar


Examples of solver.variables.SetVar

    @Override
    public void duplicate(Solver solver, THashMap<Object, Object> identitymap) {
        if (!identitymap.containsKey(this)) {
            set.duplicate(solver, identitymap);
            SetVar se = (SetVar) identitymap.get(set);

            sum.duplicate(solver, identitymap);
            IntVar su = (IntVar) identitymap.get(sum);

            identitymap.put(this, new PropSumOfElements(se, weights == null ? null : weights.clone(), offSet, su, notEmpty));
View Full Code Here

Examples of solver.variables.SetVar

    @Override
    public SetVar getVariable(SetVar[] variables) {
        int small_idx = -1;
        int delta = 0;
        for (int idx = 0; idx < variables.length; idx++) {
            SetVar variable = variables[idx];
            int d = variable.getEnvelopeSize() - variable.getKernelSize();
            if (d > delta) {
                delta = d;
                small_idx = idx;
            }
        }
View Full Code Here

Examples of solver.variables.SetVar

    @Override
    public SetVar getVariable(SetVar[] variables) {
        int small_idx = -1;
        int delta = Integer.MAX_VALUE;
        for (int idx = 0; idx < variables.length; idx++) {
            SetVar variable = variables[idx];
            int d = variable.getEnvelopeSize() - variable.getKernelSize();
            if (d > 0 && d < delta) {
                delta = d;
                small_idx = idx;
            }
        }
View Full Code Here

Examples of solver.variables.SetVar

    @Test(groups = "1s")
    public void testNoScope() {
        Solver solver = new Solver("OnceTest");
        IntVar[] x = VariableFactory.enumeratedArray("x", 5, 1, 6, solver);
        SetVar y = VariableFactory.set("y", 1, 10, solver);
        solver.post(ICF.alldifferent(x));
        solver.post(SetConstraintsFactory.member(x[0], y));
        solver.findSolution();
        AbstractStrategy strat = solver.getStrategy();
        Assert.assertTrue(strat instanceof StrategiesSequencer);
View Full Code Here

Examples of solver.variables.SetVar

    }

    @Test(groups = "1s")
    public void testMinDelta1() {
        Solver solver = new Solver();
        SetVar v1 = VF.set("v1", 1, 5, solver);
        VariableEvaluator<SetVar> eval = new MinDelta();
        double va = eval.evaluate(v1);
        Assert.assertEquals(5.0, va);
    }
View Full Code Here

Examples of solver.variables.SetVar

    }

    @Test(groups = "1s")
    public void testMaxDelta1() {
        Solver solver = new Solver();
        SetVar v1 = VF.set("v1", 1, 5, solver);
        VariableEvaluator<SetVar> eval = new MaxDelta();
        double va = eval.evaluate(v1);
        Assert.assertEquals(-5.0, va);
    }
View Full Code Here

Examples of solver.variables.SetVar

    }

    @Test(groups = "1s")
    public void testMinDelta2() {
        Solver solver = new Solver();
        SetVar v1 = VF.set("v1", 1, 5, solver);
        VariableEvaluator<SetVar> eval = new MinDelta();
        double va = eval.evaluate(v1);
        Assert.assertEquals(5.0, va);
    }
View Full Code Here

Examples of solver.variables.SetVar

    }

    @Test(groups = "1s")
    public void testMaxDelta2() {
        Solver solver = new Solver();
        SetVar v1 = VF.set("v1", 1, 5, solver);
        VariableEvaluator<SetVar> eval = new MaxDelta();
        double va = eval.evaluate(v1);
        Assert.assertEquals(-5.0, va);
    }
View Full Code Here

Examples of solver.variables.SetVar

    @Test(groups = "1s")
    public void testBooleanChannelingJL() {
        //#issue 190
        Solver solver = new Solver();
        BoolVar[] bs = VF.boolArray("bs", 3, solver);
        SetVar s1 = VF.set("s1", -3, 3, solver);
        SetVar s2 = VF.set("s2", -3, 3, solver);
        solver.post(LCF.or(SCF.all_equal(new SetVar[]{s1, s2}), SCF.bool_channel(bs, s1, 0)));
        solver.findAllSolutions();
        Assert.assertEquals(2040, solver.getMeasures().getSolutionCount());
    }
View Full Code Here

Examples of solver.variables.SetVar

  @Test(groups = "1s")
  public void test1() {
    Solver s = new Solver();
    IntVar[] x = VF.enumeratedArray("ints",4,0,5,s);
    SetVar values = VF.fixed("values", new int[]{0,1,4},s);
    s.post(SCF.int_values_union(x,values));
    SMF.log(s, true, false);
    s.set(ISF.lexico_LB(x));
    s.findAllSolutions();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.