Package org.sat4j.specs

Examples of org.sat4j.specs.ContradictionException


   *     when detected by unit propagation
   */
  static boolean propagationCheck(IVecInt ps, UnitPropagationListener s)
      throws ContradictionException {
    if (ps.size() == 0) {
      throw new ContradictionException("Creating Empty clause ?"); //$NON-NLS-1$
    } else if (ps.size() == 1) {
      if (!s.enqueue(ps.get(0))) {
        throw new ContradictionException("Contradictory Unit Clauses"); //$NON-NLS-1$
      }
      return true;
    }

    return false;
View Full Code Here


            throws ContradictionException {

        int mydegree = degree + linearisation(voc, ps);

        if (ps.size() == 0 && mydegree > 0) {
            throw new ContradictionException();
        } else if (ps.size() == mydegree || ps.size() <= 0) {
            for (int i = 0; i < ps.size(); i++)
                if (!s.enqueue(ps.get(i))) {
                    throw new ContradictionException();
                }
            return null;
        }

        // La contrainte est maintenant cr??e
View Full Code Here

        // Si on a des litteraux impliques
        if (watchCumul == degree) {
            for (int i = 0; i < lits.length; i++)
                if (!s.enqueue(lits[i])) {
                    throw new ContradictionException();
                }
            return null;
        }

        // Si on n'observe pas suffisamment
        if (watchCumul < degree) {
            throw new ContradictionException();
        }
        return this;
    }
View Full Code Here

  public static int niceParameters(UnitPropagationListener s, ILits voc,
          IVecInt ps, int deg) throws ContradictionException {
 
      if (ps.size() < deg)
          throw new ContradictionException();
      int degree = deg;
      for (int i = 0; i < ps.size();) {
          // on verifie si le litteral est affecte
          if (voc.isUnassigned(ps.get(i))) {
              // go to next literal
              i++;
          } else {
              // Si le litteral est satisfait,
              // ?a revient ? baisser le degr?
              if (voc.isSatisfied(ps.get(i))) {
                  degree--;
              }
              // dans tous les cas, s'il est assign?,
              // on enleve le ieme litteral
              ps.delete(i);
          }
      }
 
      // on trie le vecteur ps
      ps.sortUnique();
      // ?limine les clauses tautologiques
      // deux litt?raux de signe oppos?s apparaissent dans la m?me
      // clause
 
      if (ps.size() == degree) {
          for (int i = 0; i < ps.size(); i++) {
              if (!s.enqueue(ps.get(i))) {
                  throw new ContradictionException();
              }
          }
          return 0;
      }
 
      if (ps.size() < degree)
          throw new ContradictionException();
      return degree;
 
  }
View Full Code Here

TOP

Related Classes of org.sat4j.specs.ContradictionException

Copyright © 2018 www.massapicom. 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.