Examples of findSolution()


Examples of solver.Solver.findSolution()

        Solver solver = new Solver();
        NurseSchedulingProblem m = new NSCPModelConstrained(data, basisOptions, patternOptions, solver);
        SearchMonitorFactory.limitTime(solver, 180000);
        IntVar[] vars = ArrayUtils.flatten(ArrayUtils.transpose(m.getShifts()));
        solver.set(strategy.getGoal(solver, vars));
        if (Boolean.TRUE == solver.findSolution()) {
            m.printSolution(solver);
            NSChecker checker = new NSChecker(data);
            if (checker.checkSolution(m.getSolution(solver)))
                System.out.println("Solution checked.");
        }
View Full Code Here

Examples of solver.Solver.findSolution()

        IntVar[] vars = ArrayUtils.flatten(ArrayUtils.transpose(m.getShifts()));

        solver.set(strategy.getGoal(solver, vars));

        System.out.printf("%s\n", solver.toString());
        if (Boolean.TRUE == solver.findSolution()) {
            NSChecker checker = new NSChecker(data);
            if (checker.checkSolution(m.getSolution(solver)))
                System.out.println("Solution checked.");
        }
    }
View Full Code Here

Examples of solver.Solver.findSolution()

        NurseSchedulingProblem m = new NSCPModelConstrained(data, basisOptions, patternOptions, solver);
        SearchMonitorFactory.limitTime(solver, 180000);
        IntVar[] vars = ArrayUtils.flatten(ArrayUtils.transpose(m.getShifts()));
        solver.set(strategy.getGoal(solver, vars));
        String solved = "0";
        if (Boolean.TRUE == solver.findSolution()) {
            m.printSolution(solver);
            NSChecker checker = new NSChecker(data);
            if (checker.checkSolution(m.getSolution(solver)))
                System.out.println("Solution checked.");
            solved = "1";
View Full Code Here

Examples of solver.Solver.findSolution()

      }
    }

    pb.set(IntStrategyFactory.lexico_LB(X));

    pb.findSolution();
    System.out.println("Back  : " + pb.getMeasures().getBackTrackCount());
    System.out.println("Time  : " + pb.getMeasures().getTimeCount()+" (sec)");

    List<Integer> values = new LinkedList<Integer>();
    if (pb.isFeasible() == ESat.TRUE) {
View Full Code Here

Examples of solver.Solver.findSolution()

                            _domains[d] = new int[]{val};
                            System.arraycopy(domains, d + 1, _domains, d + 1, nbVar - (d + 1));

                            Solver test = modeler.model(nbVar, _domains, map, parameters);
                            try {
                                if (!test.findSolution()) {
                                    LOGGER.error("ds :{}, ide:{}, h:{}, var:{}, val:{}, loop:{}, seed: {}",
                                            ds, ide, h, rvars[d], val, loop, seed);
                                    LOGGER.error("REF:\n{}\nTEST:\n{}", ref, test);
                                    writeDown(ref);
                                    Assert.fail("no solution found");
View Full Code Here

Examples of solver.Solver.findSolution()

        final IntVar i0 = VF.bool("i0", solver);
        solver.set(ISF.lexico_LB(i0));
        solver.post(SCF.bool_channel(new BoolVar[]{b0, b1}, s0, 0));
        solver.post(SCF.cardinality(s0, VF.fixed(0, solver)));

        solver.findSolution();
        solver.getSearchLoop().reset();
        solver.findSolution();
    }

}
View Full Code Here

Examples of solver.Solver.findSolution()

        solver.post(SCF.bool_channel(new BoolVar[]{b0, b1}, s0, 0));
        solver.post(SCF.cardinality(s0, VF.fixed(0, solver)));

        solver.findSolution();
        solver.getSearchLoop().reset();
        solver.findSolution();
    }

}
View Full Code Here

Examples of solver.Solver.findSolution()

                            _domains[d] = new int[]{val};
                            System.arraycopy(domains, d + 1, _domains, d + 1, nbVar - (d + 1));

                            Solver test = modeler.model(nbVar, _domains, null, parameters);
                            try {
                                if (test.findSolution()) {
                                    LoggerFactory.getLogger("test").error("ds :{}, ide:{}, h:{}, var:{}, val:{}, loop:{}, seed: {}",
                                            ds, ide, h, rvars[d], val, loop, seed);
                                    LoggerFactory.getLogger("test").error("REF:\n{}\n", ref);
                                    ref.getEnvironment().worldPop();
                                    LoggerFactory.getLogger("test").error("REF:\n{}\nTEST:\n{}", ref, test);
View Full Code Here

Examples of solver.Solver.findSolution()

    private static void checkNoSol(Model m, Variable[] rvars, Domain[] _domains, Object parameters, Solver ref, Object[] logObjects) {
        int nbVar = rvars.length;
        Solver test = m.model(nbVar, rvars, _domains, parameters);
        try {
            if (test.findSolution()) {
                LoggerFactory.getLogger("test").error("ds :{}, ide:{}, h:{}, var:{}, val:{}, loop:{}, seed: {}",
                        logObjects);
                LoggerFactory.getLogger("test").error("REF:\n{}\n", ref);
                ref.getEnvironment().worldPop();
                LoggerFactory.getLogger("test").error("REF:\n{}\nTEST:\n{}", ref, test);
View Full Code Here

Examples of solver.Solver.findSolution()

        int[] sols = {1, 1, 1, 1, 1, 1, 1, 1, 1};
        int[] nodes = {633, 760, 2250, 6331, 19832, 19592, 60477, 139296, 180302};

        for (int i = 0; i < size.length; i++) {
            Solver sol = modeler(size[i]);
            sol.findSolution();
            Assert.assertEquals(sol.getMeasures().getSolutionCount(), sols[i]);
//            Assert.assertEquals(sol.getMeasures().getNodeCount(), nodes[i]);
        }
    }
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.