Package org.sat4j.core

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


        clause.push(-y);
        clause.push(x2);
        addClause(clause);
        clause.clear();
        clause.push(y);
        clause.push(-x1);
        clause.push(-x2);
        addClause(clause);
    }
   
    /**
 
View Full Code Here


        clause.push(x2);
        addClause(clause);
        clause.clear();
        clause.push(y);
        clause.push(-x1);
        clause.push(-x2);
        addClause(clause);
    }
   
    /**
     * translate y <=> x1 \/ x2 \/ ... \/ xn into clauses.
View Full Code Here

    public void or(int y, IVecInt literals) throws ContradictionException {
        // y <=> OR x1 x2 ...xn
        // y => x1 x2 ... xn
        IVecInt clause = new VecInt(literals.size() + 2);
        literals.copyTo(clause);
        clause.push(-y);
        processClause(clause);
        clause.clear();
        for (int i = 0; i < literals.size(); i++) {
            // xi => y
            clause.clear();
View Full Code Here

        processClause(clause);
        clause.clear();
        for (int i = 0; i < literals.size(); i++) {
            // xi => y
            clause.clear();
            clause.push(y);
            clause.push(-literals.get(i));
            processClause(clause);
        }
    }
View Full Code Here

        clause.clear();
        for (int i = 0; i < literals.size(); i++) {
            // xi => y
            clause.clear();
            clause.push(y);
            clause.push(-literals.get(i));
            processClause(clause);
        }
    }

    private void processClause(IVecInt clause) throws ContradictionException {
View Full Code Here

     */
    public void not(int y, int x) throws ContradictionException {
        IVecInt clause = new VecInt(3);
        // y <=> not x
        // y => not x = not y or not x
        clause.push(-y).push(-x);
        processClause(clause);
        // y <= not x = y or x
        clause.clear();
        clause.push(y).push(x);
        processClause(clause);
View Full Code Here

        // y => not x = not y or not x
        clause.push(-y).push(-x);
        processClause(clause);
        // y <= not x = y or x
        clause.clear();
        clause.push(y).push(x);
        processClause(clause);
    }

    /**
     * translate y <=> x1 xor x2 xor ... xor xn into clauses.
View Full Code Here

    private void xor2Clause(int[] f, int prefix, boolean negation)
            throws ContradictionException {
        if (prefix == f.length - 1) {
            IVecInt clause = new VecInt(f.length + 1);
            for (int i = 0; i < f.length - 1; ++i) {
                clause.push(f[i]);
            }
            clause.push(f[f.length - 1] * (negation ? -1 : 1));
            processClause(clause);
            return;
        }
View Full Code Here

        if (prefix == f.length - 1) {
            IVecInt clause = new VecInt(f.length + 1);
            for (int i = 0; i < f.length - 1; ++i) {
                clause.push(f[i]);
            }
            clause.push(f[f.length - 1] * (negation ? -1 : 1));
            processClause(clause);
            return;
        }

        if (negation) {
View Full Code Here

    private void iff2Clause(int[] f, int prefix, boolean negation)
            throws ContradictionException {
        if (prefix == f.length - 1) {
            IVecInt clause = new VecInt(f.length + 1);
            for (int i = 0; i < f.length - 1; ++i) {
                clause.push(f[i]);
            }
            clause.push(f[f.length - 1] * (negation ? -1 : 1));
            processClause(clause);
            return;
        }
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.