Examples of SatSolver


Examples of edu.mit.csail.sdg.alloy4compiler.translator.A4Options.SatSolver

        try {
            wrap = true;
            optmenu.removeAll();
            menuItem(optmenu, "Welcome Message at Start Up: "+(Welcome.get() < welcomeLevel ? "Yes" : "No"), doOptWelcome());
            //
            final SatSolver now = SatSolver.get();
            final JMenu sat = new JMenu("SAT Solver: "+now);
            for(SatSolver sc:satChoices) { menuItem(sat, ""+sc, doOptSolver(sc), sc==now?iconYes:iconNo); }
            optmenu.add(sat);
            //
            menuItem(optmenu, "Warnings are Fatal: "+(WarningNonfatal.get()?"No":"Yes"), doOptWarning());
View Full Code Here

Examples of edu.mit.csail.sdg.alloy4compiler.translator.A4Options.SatSolver

                log.flush();
                satChoices.remove(SatSolver.MiniSatJNI);
            }
            if (!loadLibrary("minisatprover")) satChoices.remove(SatSolver.MiniSatProverJNI);
            if (!loadLibrary("zchaff"))        satChoices.remove(SatSolver.ZChaffJNI);
            SatSolver now = SatSolver.get();
            if (!satChoices.contains(now)) {
                now=SatSolver.ZChaffJNI;
                if (!satChoices.contains(now)) now=SatSolver.SAT4J;
                now.set();
            }
            if (now==SatSolver.SAT4J && satChoices.size()>3 && satChoices.contains(SatSolver.CNF) && satChoices.contains(SatSolver.KK)) {
                log.logBold("Warning: Alloy4 defaults to SAT4J since it is pure Java and very reliable.\n");
                log.log("For faster performance, go to Options menu and try another solver like MiniSat.\n");
                log.log("If these native solvers fail on your computer, remember to change back to SAT4J.\n");
View Full Code Here

Examples of kodkod.engine.satlab.SATSolver

   * @param translation the translation
   * @param stats translation / solving stats
   * @return the result of solving an unsat formula.
   */
  private static Solution unsat(Translation translation, Statistics stats) {
    final SATSolver cnf = translation.cnf();
    final TranslationLog log = translation.log();
    if (cnf instanceof SATProver && log != null) {
      return Solution.unsatisfiable(stats, new ResolutionBasedProof((SATProver) cnf, log));
    } else { // can free memory
      final Solution sol = Solution.unsatisfiable(stats, null);
      cnf.free();
      return sol;
    }
  }
View Full Code Here

Examples of kodkod.engine.satlab.SATSolver

     * the  current solution from the set of possible solutions
     * @return current solution
     */
    private Solution nonTrivialSolution() {
      try {
        final SATSolver cnf = translation.cnf();
        options.reporter().solvingCNF(translation.numPrimaryVariables(), cnf.numberOfVariables(), cnf.numberOfClauses());
        final long startSolve = System.currentTimeMillis();
        final boolean isSat = cnf.solve();
        final long endSolve = System.currentTimeMillis();

        final Statistics stats = new Statistics(translation, translTime, endSolve - startSolve);
        if (isSat) {
          // extract the current solution; can't use the sat(..) method because it frees the sat solver
          final Solution sol = Solution.satisfiable(stats, padInstance(translation.interpret(), bounds));
          // add the negation of the current model to the solver
          final int primary = translation.numPrimaryVariables();
          final int[] notModel = new int[primary];
          for(int i = 1; i <= primary; i++) {
            notModel[i-1] = cnf.valueOf(i) ? -i : i;
          }
          cnf.addClause(notModel);
          return sol;
        } else {
          formula = null; bounds = null; // unsat, no more solutions, free up some space
          return unsat(translation, stats);
        }
View Full Code Here

Examples of kodkod.engine.satlab.SATSolver

   * @return Translation constructed from a SAT solver initialized with the CNF translation
   * of the given circuit, the provided arguments, this.bounds, and this.log
   */
  private Translation toCNF(BooleanFormula circuit, int primaryVars, Map<Relation,IntSet> varUsage) { 
    options.reporter().translatingToCNF(circuit);
    final SATSolver cnf = Bool2CNFTranslator.translate((BooleanFormula)circuit, options.solver(), primaryVars);
    return new Translation(cnf, bounds, varUsage, primaryVars, log);
  }
View Full Code Here

Examples of kodkod.engine.satlab.SATSolver

   * allocated during translation from FOL to boolean.
   * @return a SATSolver instance returned by the given factory and initialized
   * to contain the CNF translation of the given circuit.
   */
  static SATSolver translate(BooleanFormula circuit, SATFactory factory, int numPrimaryVariables) {
    final SATSolver solver = factory.instance();
    final Bool2CNFTranslator translator = new Bool2CNFTranslator(solver, numPrimaryVariables, circuit);
//    System.out.println("--------------transls2-------------");
    if (circuit.op()==Operator.AND) {
      for(BooleanFormula input : circuit) {
//        System.out.println(input);
//        solver.addClause(input.accept(translator,null));
        input.accept(translator, null);
      }
      for(BooleanFormula input : circuit) {
        translator.unaryClause[0] = input.label();
        solver.addClause(translator.unaryClause);
      }
    } else {
      solver.addClause(circuit.accept(translator,null));
    }
    return solver;
  }
View Full Code Here

Examples of kodkod.engine.satlab.SATSolver

    try {   
   
      final Translation translation = Translator.translate(formula, bounds, options);
      final long endTransl = System.currentTimeMillis();

      final SATSolver cnf = translation.cnf();
     
      options.reporter().solvingCNF(translation.numPrimaryVariables(), cnf.numberOfVariables(), cnf.numberOfClauses());
      final long startSolve = System.currentTimeMillis();
      final boolean isSat = cnf.solve();
      final long endSolve = System.currentTimeMillis();

      final Statistics stats = new Statistics(translation, endTransl - startTransl, endSolve - startSolve);
      return isSat ? sat(bounds, translation, stats) : unsat(translation, stats);
     
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.