Package solver

Examples of solver.Solver.findSolution()


            // p[0], p[1] are just for fun
            solver.set(ISF.lexico_LB(p[0], p[1], p[9], p[8], bs[0]));
            engines[e].plugin(solver, false);
            SMF.log(solver,true, true);
            SMF.shortlog(solver);
            Assert.assertFalse(solver.findSolution());
        }
    }

    @Test(groups = "1s")
    public void testReif3() { // to test PropagatorActivation, from bs to p
View Full Code Here


            // p[0], p[1] are just for fun
            solver.set(ISF.lexico_LB(p[0], p[1], bs[0], p[9], p[8]));
            engines[e].plugin(solver, false);
            SMF.log(solver,true, true);
            SMF.shortlog(solver);
            Assert.assertFalse(solver.findSolution());
        }
    }
}
View Full Code Here

    @Test(groups = "1s")
    public static void test1() {
        Solver solver = new Solver();
        IntVar[] x = VariableFactory.boundedArray("x", 10, 0, 20, solver);
        solver.post(IntConstraintFactory.circuit(x, 0));
        solver.findSolution();
        Assert.assertEquals(1, solver.getMeasures().getSolutionCount());
    }

    @Test(groups = "1s")
    public static void test2() {
View Full Code Here

    @Test(groups = "1s")
    public static void test2() {
        Solver solver = new Solver();
        IntVar[] x = VariableFactory.enumeratedArray("x", 10, 0, 10, solver);
        solver.post(IntConstraintFactory.circuit(x, 0));
        solver.findSolution();
        Assert.assertEquals(1, solver.getMeasures().getSolutionCount());
    }

    @Test(groups = "1s")
    public static void test3() {
View Full Code Here

        Solver solver = new Solver();
        IntVar[] x = VariableFactory.boundedArray("x", 5, 0, 4, solver);
        IntVar[] y = VariableFactory.boundedArray("y", 5, 5, 9, solver);
        IntVar[] vars = ArrayUtils.append(x, y);
        solver.post(IntConstraintFactory.circuit(vars, 0));
        solver.findSolution();
        Assert.assertEquals(0, solver.getMeasures().getSolutionCount());
    }

    @Test(groups = "1s")
    public static void test4() {
View Full Code Here

            Solver solver = new Solver();
            IntVar[] vars = VF.enumeratedArray("X", 3, 0, 1, solver);
            Constraint tableConstraint = ICF.table(vars, tuples, a);
            solver.post(tableConstraint);

            solver.findSolution();
        }
    }


    private void allEquals(Solver solver, IntVar[] vars, int algo) {
View Full Code Here

    Solver solver = new Solver();
    IntVar[] vars = VF.enumeratedArray("vars", 10, 0,100, solver);
    Tuples t = new Tuples(false);
    t.add(1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
    solver.post(ICF.table(vars, t, "GAC3rm"));
    solver.findSolution();
  }

}
View Full Code Here

        // or x : [1.000000, 1.000000], y : [8.000000, 8.000000]
        // but it always like this : x : [2.418267, 2.418267], y : [3.308154, 3.308154]
//        rcons.discretize(x,y);
        solver.post(new RealConstraint("RC","{0} * {1} = 8", vars));
        solver.set(new RealStrategy(vars, new Cyclic(), new RealDomainMiddle()));
        solver.findSolution();
        Assert.assertEquals(x.getValue(), 2);
        Assert.assertEquals(y.getValue(), 4);
    }
}
View Full Code Here

    public void test2() {
        Solver s = new Solver();
        IntVar three = VF.fixed(3, s);
        IntVar two = VF.fixed(2, s);
        s.post(ICF.arithm(three, "-", two, "=", 1));
        Assert.assertTrue(s.findSolution());
        Assert.assertEquals(ESat.TRUE, s.isSatisfied());
    }

    @Test(groups = "1s")
    public void test3() {
View Full Code Here

    public void test3() {
        Solver s = new Solver();
        IntVar three = VF.fixed(3, s);
        IntVar two = VF.fixed(2, s);
        s.post(ICF.arithm(three, "=", two, "+", 1));
        Assert.assertTrue(s.findSolution());
        Assert.assertEquals(ESat.TRUE, s.isSatisfied());
    }
}
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.