Package org.sat4j.specs

Examples of org.sat4j.specs.IVecInt.push()


    VertexDegreeComparator<V, E> c = new VertexDegreeComparator<V, E>(graph);

    /* Precolor vertex v with maximum degree with first color. */
    V v = Collections.max(vertices, c);
    IVecInt literals = new VecInt(1);
    literals.push(vertices.indexOf(v) * colors + 1);
    solver.addClause(literals);
    literals.clear();

    /* Precolor neighbor of v with maximum degree with second color. */
    Collection<V> neighbors = graph.getNeighbors(v);
View Full Code Here


    /* Precolor neighbor of v with maximum degree with second color. */
    Collection<V> neighbors = graph.getNeighbors(v);
    if (!neighbors.isEmpty()) {
      v = Collections.max(neighbors, c);
      literals.push(vertices.indexOf(v) * colors + 2);
      solver.addClause(literals);
    }
  }

  private GraphColoring<V, E> getColoring(int colors, List<V> vertices,
View Full Code Here

    }

    private int readOutput(int nboutputs, Scanner scanner) {
        IVecInt outputs = new VecInt(nboutputs);
        for (int i = 0; i < nboutputs; i++) {
            outputs.push(scanner.nextInt());
        }
        return outputs.get(0);
    }

View Full Code Here


    private IVecInt readInput(int numberOfInputs, Scanner scanner) {
        IVecInt inputs = new VecInt(numberOfInputs);
        for (int i = 0; i < numberOfInputs; i++) {
            inputs.push(scanner.nextInt());
        }
        return inputs;
    }

}
View Full Code Here

                            solver.addClause(literals);
                            literals.clear();
                            realNbOfClauses++;
                        }
                    } else {
                        literals.push(lit);
                    }
                }
            }
        }
        if (expectedNbOfConstr != realNbOfClauses) {
View Full Code Here

            throws TimeoutException {
        int[] firstmodel = model();
        assert firstmodel != null;
        IVecInt clause = new VecInt(firstmodel.length);
        for (int q : firstmodel) {
            clause.push(-q);
        }
        boolean result = false;
        try {
            IConstr added = addClause(clause);
            result = !isSatisfiable(assumptions);
View Full Code Here

     */
    public static IVecInt backbone(ISolver s) throws TimeoutException {
        IVecInt backbone = new VecInt();
        int nvars = s.nVars();
        for (int i = 1; i <= nvars; i++) {
            backbone.push(i);
            if (s.isSatisfiable(backbone)) {
                backbone.pop().push(-i);
                if (s.isSatisfiable(backbone)) {
                    backbone.pop();
                } else {
View Full Code Here

                s.addClause(lit);
                lit.clear();
            } else {
                /* on ajoute le literal au vecteur */
                // s.newVar(val-1);
                lit.push(neg ? -val : val);
                neg = false;
                val = 0; /* on reinitialise les variables */
            }
            if (car != EOF)
                car = passerEspaces();
View Full Code Here

    public IVecInt getMarkedLiterals() {
        IVecInt marked = new VecInt();
        for (int i = 2; i < marks.length; i++) {
            if (isMarked(i))
                marked.push(i);
        }
        return marked;
    }

    public IVecInt getMarkedLiterals(int mark) {
View Full Code Here

    public IVecInt getMarkedLiterals(int mark) {
        IVecInt marked = new VecInt();
        for (int i = 2; i < marks.length; i++) {
            if (getMark(i) == mark)
                marked.push(i);
        }
        return marked;
    }

    public IVecInt getMarkedVariables() {
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.