Examples of IVecInt


Examples of org.sat4j.specs.IVecInt

    }

    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;
        }

        if (negation) {
View Full Code Here

Examples of org.sat4j.specs.IVecInt

   * @see
   * org.sat4j.minisat.core.DataStructureFactory#createClause(org.sat4j.specs
   * .VecInt)
   */
  public Constr createClause(IVecInt literals) throws ContradictionException {
    IVecInt v = Clauses.sanityCheck(literals, getVocabulary(), solver);
    if (v == null)
      return null;
    return CBClause.brandNewClause(solver, getVocabulary(), v);
  }
View Full Code Here

Examples of org.sat4j.specs.IVecInt

     * @see org.sat4j.ISolver#model()
     */
    @Override
    public int[] model() {
        int[] last = super.model();
        IVecInt clause = new VecInt(last.length);
        for (int q : last) {
            clause.push(-q);
        }
        try {
            // System.out.println("adding " + clause);
            addClause(clause);
        } catch (ContradictionException e) {
View Full Code Here

Examples of org.sat4j.specs.IVecInt

     * (non-Javadoc)
     *
     * @see org.sat4j.minisat.DataStructureFactory#createClause(org.sat4j.datatype.VecInt)
     */
     public Constr createClause(IVecInt literals) throws ContradictionException {
        IVecInt v = Clauses.sanityCheck(literals, lits, solver);
        if (v == null)
            return null;
        if (v.size() == 2) {
            lits.binaryClauses(v.get(0), v.get(1));
            return null;
        }
        return OriginalHTClause.brandNewClause(solver, lits, v);
    }
View Full Code Here

Examples of org.sat4j.specs.IVecInt

     * (non-Javadoc)
     *
     * @see org.sat4j.minisat.DataStructureFactory#createClause(org.sat4j.datatype.VecInt)
     */
     public Constr createClause(IVecInt literals) throws ContradictionException {
        IVecInt v = Clauses.sanityCheck(literals, lits, solver);
        if (v == null)
            return null;
        if (v.size() == 2) {
            lits.binaryClauses(v.get(0), v.get(1));
            return null;
        }
        if (v.size() == 3) {
            lits.ternaryClauses(v.get(0), v.get(1), v.get(2));
            return null;
        }
        return OriginalHTClause.brandNewClause(solver, lits, v);
    }
View Full Code Here

Examples of org.sat4j.specs.IVecInt

     * @see org.sat4j.ISolver#model()
     */
    @Override
    public int[] model() {
        int[] prevmodel = null;
        IVecInt vec = new VecInt();
        // backUp();
        try {
            do {
                prevmodel = super.model();
                vec.clear();
                for (int i = 1; i <= nVars(); i++) {
                    vec.push(-i);
                }
                int counter = 0;
                for (int q : prevmodel) {
                    if (q < 0) {
                        counter++;
View Full Code Here

Examples of org.sat4j.specs.IVecInt

     * (non-Javadoc)
     *
     * @see org.sat4j.minisat.DataStructureFactory#createClause(org.sat4j.datatype.VecInt)
     */
    public Constr createClause(IVecInt literals) throws ContradictionException {
        IVecInt v = Clauses.sanityCheck(literals, getVocabulary(), solver);
        if (v == null)
            return null;
        return OriginalHTClause.brandNewClause(solver, getVocabulary(), v);
    }
View Full Code Here

Examples of org.sat4j.specs.IVecInt

     * (non-Javadoc)
     *
     * @see org.sat4j.minisat.Constr#simplify()
     */
    public boolean simplify() {
        IVecInt locclauses = clauses;
        final int size = clauses.size();
        for (int i = 0; i < size; i++) {
            if (voc.isSatisfied(locclauses.get(i))) {
                return true;
            }
            if (voc.isFalsified(locclauses.get(i))) {
                locclauses.delete(i);
            }

        }
        return false;
    }
View Full Code Here

Examples of org.sat4j.specs.IVecInt

     */
    @SuppressWarnings("null")
  @Override
    public int[] model() {
        int[] prevmodel = null;
        IVecInt vec = new VecInt();
        IVecInt cube = new VecInt();
        // backUp();
        try {
            do {
                prevmodel = super.model();
                vec.clear();
                cube.clear();
                for (int q : prevmodel) {
                    if (q < 0) {
                        vec.push(-q);
                    } else {
                        cube.push(q);
                    }
                }
                addClause(vec);
            } while (isSatisfiable(cube));
        } catch (TimeoutException e) {
View Full Code Here

Examples of org.sat4j.specs.IVecInt

        boolean trivialfalsity = false;

        while (!trivialfalsity && isSatisfiable(true)) {
            lowerBound++;
            int[] last = model();
            IVecInt clause = new VecInt(last.length);
            for (int q : last) {
                clause.push(-q);
            }
            try {
                // System.out.println("Sol number "+nbsols+" adding " + clause);
                addClause(clause);
            } catch (ContradictionException e) {
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.