Esempio n. 1
0
 public Object leq(Object exp, int value) {
   try {
     return vc.leExpr((Expr) exp, vc.ratExpr(value));
   } catch (Exception e) {
     e.printStackTrace();
     throw new RuntimeException("## Error CVC3: Exception caught in CVC3 JNI: \n" + e);
   }
 }
Esempio n. 2
0
 public Object neq(Object exp, double value) {
   try {
     return vc.notExpr(vc.eqExpr((Expr) exp, vc.ratExpr(Double.toString(value), base)));
   } catch (Exception e) {
     e.printStackTrace();
     throw new RuntimeException("## Error CVC3: Exception caught in CVC3 JNI: \n" + e);
   }
 }
Esempio n. 3
0
 public Object neq(Object exp1, Object exp2) {
   try {
     return vc.notExpr(vc.eqExpr((Expr) exp1, (Expr) exp2));
   } catch (Exception e) {
     e.printStackTrace();
     throw new RuntimeException("## Error CVC3: Exception caught in CVC3 JNI: \n" + e);
   }
 }
Esempio n. 4
0
 public Object getExpr() {
   // if (pb == null) return new
   if (listConstraint.size() != 0) {
     pb = vc.andExpr(listConstraint);
     if (listExistentialIntegerVar != null) ;
     pb = vc.existsExpr(listExistentialIntegerVar, pb);
   }
   return pb;
 }
Esempio n. 5
0
 public Object makeIntVar(String name, int min, int max) {
   try {
     /*
      * Type sType = vc.subrangeType(vc.ratExpr(min), vc.ratExpr(max)); return
      * vc.varExpr(name, sType);
      */
     Expr expr = vc.varExpr(name, vc.intType());
     return expr;
   } catch (Exception e) {
     e.printStackTrace();
     throw new RuntimeException("## Error CVC3: Exception caught in CVC3 JNI: \n" + e);
   }
 }
Esempio n. 6
0
  @Override
  public boolean isSubsumedBy(NumericConstraint constraint) {
    vc.push();
    Expr cc = vc.impliesExpr(pb, (Expr) (constraint.getExpr()));
    System.out.println("Implication: " + cc);
    QueryResult sr = vc.query(cc);

    System.out.println(sr.toString());
    if (sr == QueryResult.VALID) {
      vc.pop();
      return true;
    }
    return false;
  }
Esempio n. 7
0
 public Object makeRealVar(String name, double min, double max) {
   // WARNING: need to downcast double to int - I don't see
   // a way in CVC3 to create a sub-range for real types
   // other choice is not to bound and use vc.realType() to
   // create the expression
   int minInt = (int) min;
   int maxInt = (int) max;
   try {
     // Expr x = vc.varExpr(name, vc.realType());
     /*
      * Type sType = vc.subrangeType(vc.ratExpr(minInt), vc.ratExpr(maxInt));
      * return vc.varExpr(name, sType);
      */
     Expr expr = vc.varExpr(name, vc.intType());
     return expr;
   } catch (Exception e) {
     e.printStackTrace();
     throw new RuntimeException("## Error CVC3: Exception caught in CVC3 JNI: \n" + e);
   }
 }
Esempio n. 8
0
 public static void initCVC3Constraint() {
   flags = ValidityChecker.createFlags(null);
   flags.setFlag("dagify-exprs", false);
   vc = ValidityChecker.create(flags);
 }