Examples of propagate()


Examples of solver.Solver.propagate()

            vars[0].instantiateTo(1, Cause.Null);
            s.propagate();
            Assert.assertEquals(vars[1].getLB(), 0);
            Assert.assertEquals(vars[1].getUB(), 2);
            vars[1].removeValue(2, Cause.Null);
            s.propagate();
            Assert.assertEquals(vars[1].getLB(), 0);
            Assert.assertEquals(vars[1].getUB(), 0);
        } catch (ContradictionException e) {
            Assert.fail();
        }
View Full Code Here

Examples of solver.Solver.propagate()

        PropagationEngineFactory.DEFAULT.make(sum);
        Variable[] vars = sum.getVars();
    int offSet = 2;// ZERO and ONE constants
        ((IntVar) vars[0+offSet]).instantiateTo(-2, Cause.Null);
        ((IntVar) vars[1+offSet]).instantiateTo(-1, Cause.Null);
        sum.propagate();
//        sum.getSearchLoop().timeStamp++;
        ((IntVar) vars[2+offSet]).removeValue(-2, Cause.Null);
        sum.propagate();
        Assert.assertTrue(vars[2+offSet].isInstantiated());
    }
View Full Code Here

Examples of solver.Solver.propagate()

        ((IntVar) vars[0+offSet]).instantiateTo(-2, Cause.Null);
        ((IntVar) vars[1+offSet]).instantiateTo(-1, Cause.Null);
        sum.propagate();
//        sum.getSearchLoop().timeStamp++;
        ((IntVar) vars[2+offSet]).removeValue(-2, Cause.Null);
        sum.propagate();
        Assert.assertTrue(vars[2+offSet].isInstantiated());
    }

}
View Full Code Here

Examples of solver.Solver.propagate()

    private static Solver referencePropagation(Modeler modeler, int nbVar, int[][] domains, THashMap<int[], IntVar> map, Object parameters) {
        Solver ref = modeler.model(nbVar, domains, map, parameters);
        ref.getEnvironment().worldPush();
        try {
            ref.propagate();
        } catch (ContradictionException e) {
            LoggerFactory.getLogger("test").info("Pas de solution pour ce probleme => rien a tester !");
            return null;
        } catch (Exception e) {
            File f = new File("SOLVER_ERROR.ser");
View Full Code Here

Examples of solver.Solver.propagate()

    private static Solver referencePropagation(Model modeler, int nbVar, Variable[] rvars, Domain[] domains, Object parameters) {
        Solver ref = modeler.model(nbVar, rvars, domains, parameters);
        ref.getEnvironment().worldPush();
        try {
            ref.propagate();
        } catch (ContradictionException e) {
            LoggerFactory.getLogger("test").info("Pas de solution pour ce probleme => rien a tester !");
            return null;
        } catch (Exception e) {
            File f = new File("SOLVER_ERROR.ser");
View Full Code Here

Examples of solver.Solver.propagate()

        // square2,0={1,2,5,7,8,9...,15} square2,1={5,7} square2,2=11 square2,3={2,5,7,8,9,10...,15}
        // square3,0={14,15} square3,1={5,7} square3,2={8,9,10} square3,3=4
        //== >square0,2  ==  12 (0)
        Solver solver = modeler(4);
        Variable[] vars = solver.getVars();
        solver.propagate();
    int offset = 2;
        ((IntVar) vars[0+offset]).instantiateTo(3, Cause.Null);
        ((IntVar) vars[15+offset]).instantiateTo(4, Cause.Null);
        ((IntVar) vars[5+offset]).removeInterval(11, 15, Cause.Null);
        ((IntVar) vars[1+offset]).removeValue(2, Cause.Null);
View Full Code Here

Examples of solver.Solver.propagate()

        ((IntVar) vars[5+offset]).removeInterval(11, 15, Cause.Null);
        ((IntVar) vars[1+offset]).removeValue(2, Cause.Null);
        ((IntVar) vars[9+offset]).removeInterval(1, 2, Cause.Null);
        ((IntVar) vars[13+offset]).removeInterval(1, 2, Cause.Null);
        ((IntVar) vars[1+offset]).instantiateTo(6, Cause.Null);
        solver.propagate();
        LoggerFactory.getLogger("test").error("************************");
        ((IntVar) vars[2+offset]).instantiateTo(12, Cause.Null);
        try {
            solver.propagate();
            LoggerFactory.getLogger("test").error("************************");
 
View Full Code Here

Examples of solver.Solver.propagate()

        ((IntVar) vars[1+offset]).instantiateTo(6, Cause.Null);
        solver.propagate();
        LoggerFactory.getLogger("test").error("************************");
        ((IntVar) vars[2+offset]).instantiateTo(12, Cause.Null);
        try {
            solver.propagate();
            LoggerFactory.getLogger("test").error("************************");
            Assert.fail("should fail");
        } catch (ContradictionException ignored) {
        }
        LoggerFactory.getLogger("test").error("************************");
 
View Full Code Here

Examples of solver.Solver.propagate()

        // square1,0={4,5,6,7,8,9...,14} square1,1={7,8,9,10,11,12...,14} square1,2={4,5,6,7,8,9...,10} square1,3={1,4,5,6,7,8...,15}
        // square2,0={4,5,6,7,8,9...,14} square2,1={6,7,8,9,10,11...,12} square2,2={4,5,6,7,8,9...,10} square2,3={1,4,5,6,7,8...,15}
        // square3,0={14,15} square3,1={1,4,5,6,7,8...,8} square3,2={4,5,6,7,8,9...,10} square3,3={8,9,10,11,12,14...,15}
        //[R]!square3,0  ==  14 (1)
        Solver solver = modeler(4);
        solver.propagate();
    int offset = 2;
        Variable[] vars = solver.getVars();
        ((IntVar) vars[0+offset]).instantiateTo(2, Cause.Null);
        solver.propagate();
        ((IntVar) vars[3+offset]).instantiateTo(3, Cause.Null);
View Full Code Here

Examples of solver.Solver.propagate()

        Solver solver = modeler(4);
        solver.propagate();
    int offset = 2;
        Variable[] vars = solver.getVars();
        ((IntVar) vars[0+offset]).instantiateTo(2, Cause.Null);
        solver.propagate();
        ((IntVar) vars[3+offset]).instantiateTo(3, Cause.Null);
        solver.propagate();
        ((IntVar) vars[1+offset]).instantiateTo(13, Cause.Null);
        solver.propagate();
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.