Package org.sat4j.core

Examples of org.sat4j.core.VecInt.push()


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

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


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

    public Set<Integer> getMarks() {
View Full Code Here

  public IConstr addAtMost(IVecInt literals, int degree)
      throws ContradictionException {
    int n = literals.size();
    IVecInt opliterals = new VecInt(n);
    for (IteratorInt iterator = literals.iterator(); iterator.hasNext();) {
      opliterals.push(-iterator.next());
    }
    return addAtLeast(opliterals, n - degree);
  }

  public IConstr addAtLeast(IVecInt literals, int degree)
View Full Code Here

     * @throws ContradictionException iff a trivial inconsistency is found.
     */
    public void gateFalse(int y)
            throws ContradictionException {
        IVecInt clause = new VecInt(2);
        clause.push(-y);
        processClause(clause);
    }

    /**
     * translate y <=> TRUE into a clause.
View Full Code Here

     * @throws ContradictionException
     */
    public void gateTrue(int y)
            throws ContradictionException {
        IVecInt clause = new VecInt(2);
        clause.push(y);
        processClause(clause);
    }

    /**
     * translate y <=> if x1 then x2 else x3 into clauses. 
View Full Code Here

     */
    public void ite(int y, int x1, int x2, int x3) throws ContradictionException {
        IVecInt clause = new VecInt(5);
        // y <=> (x1 -> x2) and (not x1 -> x3)
        // y -> (x1 -> x2) and (not x1 -> x3)
        clause.push(-y).push(-x1).push(x2);
        processClause(clause);
        clause.clear();
        clause.push(-y).push(x1).push(x3);
        processClause(clause);
        // y <- (x1 -> x2) and (not x1 -> x3)
View Full Code Here

        // y <=> (x1 -> x2) and (not x1 -> x3)
        // y -> (x1 -> x2) and (not x1 -> x3)
        clause.push(-y).push(-x1).push(x2);
        processClause(clause);
        clause.clear();
        clause.push(-y).push(x1).push(x3);
        processClause(clause);
        // y <- (x1 -> x2) and (not x1 -> x3)
        // not(x1 -> x2) or not(not x1 -> x3) or y
        // x1 and not x2 or not x1 and not x3 or y
        // (x1 and not x2) or ((not x1 or y) and (not x3 or y))
View Full Code Here

        // (x1 and not x2) or ((not x1 or y) and (not x3 or y))
        // (x1 or not x1 or y) and (not x2 or not x1 or y) and (x1 or not x3 or
        // y) and (not x2 or not x3 or y)
        // not x1 or not x2 or y and x1 or not x3 or y and not x2 or not x3 or y
        clause.clear();
        clause.push(-x1).push(-x2).push(y);
        processClause(clause);
        clause.clear();
        clause.push(x1).push(-x3).push(y);
        processClause(clause);
        clause.clear();
View Full Code Here

        // not x1 or not x2 or y and x1 or not x3 or y and not x2 or not x3 or y
        clause.clear();
        clause.push(-x1).push(-x2).push(y);
        processClause(clause);
        clause.clear();
        clause.push(x1).push(-x3).push(y);
        processClause(clause);
        clause.clear();
        clause.push(-x2).push(-x3).push(y);
        processClause(clause);
        // taken from Niklas Een et al SAT 2007 paper
View Full Code Here

        processClause(clause);
        clause.clear();
        clause.push(x1).push(-x3).push(y);
        processClause(clause);
        clause.clear();
        clause.push(-x2).push(-x3).push(y);
        processClause(clause);
        // taken from Niklas Een et al SAT 2007 paper
        // Adding the following redundant clause will improve unit propagation
        // y -> x2 or x3
        clause.clear();
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.