Examples of Solver


Examples of solver.Solver

    IntVar[] vars;

    @Override
    public void createSolver() {
        solver = new Solver("BigSum");
    }
View Full Code Here

Examples of solver.Solver

     * If the reified boolean variable already exists, an additional (equality) constraint is automatically posted.
     *
     * @param bool
     */
    public final void reifyWith(BoolVar bool) {
        Solver s = propagators[0].getSolver();
        if (boolReif == null) {
            boolReif = bool;
            s.post(new ReificationConstraint(boolReif, this, getOpposite()));
        } else {
            s.post(ICF.arithm(bool, "=", boolReif));
        }
    }
View Full Code Here

Examples of solver.Solver

     *
     * @return the boolean reifying the constraint
     */
    public final BoolVar reif() {
        if (boolReif == null) {
            Solver s = propagators[0].getSolver();
            boolReif = VF.bool(StringUtils.randomName(), s);
            s.post(new ReificationConstraint(boolReif, this, getOpposite()));
        }
        return boolReif;
    }
View Full Code Here

Examples of solver.Solver

    IntVar[] vars;

    @Override
    public void createSolver() {
        solver = new Solver("Eq20");
    }
View Full Code Here

Examples of solver.Solver

  // METHODS

  @Override
  public void createSolver() {
    solver = new Solver("Mario's Path Finder");
  }
View Full Code Here

Examples of solver.Solver

//        NSCPModelConstrained.ConstraintOptions patternOptions = NSCPModelConstrained.ConstraintOptions.WITH_REG;
        NSCPModelConstrained.ConstraintOptions patternOptions = NSCPModelConstrained.ConstraintOptions.WITH_MCR;

        BranchingStrategy strategy = BranchingStrategy.FORCE_DOMWDEG;

        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.");
        }
        String content =
                solver.getMeasures().getTimeCount() + " ms,\t " + solver.getMeasures().getNodeCount() + " nodes,\t "
                        + solver.getMeasures().getBackTrackCount() + " bks,\t "
                        + strategy.name() + "\t " + patternOptions.name() + "\t "
                        + m.getDescription() + "\n";
        System.out.println(content);
    }
View Full Code Here

Examples of solver.Solver

//        NSCPModelConstrained.ConstraintOptions patternOptions = NSCPModelConstrained.ConstraintOptions.WITH_MCRW;
//        NSCPModelConstrained.ConstraintOptions patternOptions = NSCPModelConstrained.ConstraintOptions.WITH_REG;
        NSCPModelConstrained.ConstraintOptions patternOptions = NSCPModelConstrained.ConstraintOptions.WITH_MCR;
        BranchingStrategy strategy = BranchingStrategy.FORCE_DOMWDEG;

        Solver solver = new Solver();
        NurseSchedulingProblem m = new NSCPModelConstrained(data, basisOptions, patternOptions, solver);
        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

    int[][] optfreq, matrix, options, idleConfs;


    @Override
    public void createSolver() {
        solver = new Solver("CarSequencing");
    }
View Full Code Here

Examples of solver.Solver

    }


    public static void runOne(NSData data, BranchingStrategy strategy, NSCPModelConstrained.ConstraintOptions basisOptions, NSCPModelConstrained.ConstraintOptions patternOptions) {
        System.out.println(strategy.name() + "\t " + patternOptions.name() + "\t " + basisOptions.name());
        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));
        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";
        }
        String content =
                solved + ",\t" + solver.getMeasures().getTimeCount() + " ms,\t "
                        + solver.getMeasures().getNodeCount() + " nodes,\t "
                        + solver.getMeasures().getBackTrackCount() + " bks,\t "
                        + strategy.name() + "\t " + patternOptions.name() + "\t " + basisOptions.name() + "\t "
                        + m.getDescription() + "\n";
        String contentCSV =
                solved + "," + solver.getMeasures().getTimeCount() + ","
                        + solver.getMeasures().getNodeCount() + ","
                        + solver.getMeasures().getBackTrackCount() + ","
                        + strategy.name() + "," + patternOptions.name() + "," + basisOptions.name() + ","
                        + m.getDescription() + "\n";
        System.out.println(content);
        BufferedWriter writer = null;
        try {
View Full Code Here

Examples of solver.Solver

    int n = 4;
    int vals = n + 1;

    @Override
    public void createSolver() {
        solver = new Solver();
    }
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.