예제 #1
0
 /**
  * Add a sub-annotation to the current LAAnnotation and explain it.
  *
  * @param reason The reason for which a sub-annotation is created.
  * @param coeff The Farkas coefficient of the sub-annotation.
  */
 public void addAnnotation(LAReason reason, Rational coeff) {
   assert ((coeff.signum() > 0) == reason.isUpper());
   Rational sign = Rational.valueOf(coeff.signum(), 1);
   LAAnnotation annot = mSubReasons.get(reason);
   if (annot == null) {
     annot = new LAAnnotation(reason);
     mSubReasons.put(reason, annot);
     if (mAnnotationStack != null) mAnnotationStack.addLast(annot);
     reason.explain(this, reason.getVar().getEpsilon(), sign);
     if (mAnnotationStack != null) mAnnotationStack.removeLast();
   }
   if (mAnnotationStack != null) mAnnotationStack.getLast().addFarkas(annot, coeff);
 }
예제 #2
0
 public void addEQAnnotation(LiteralReason reason, Rational coeff) {
   // FIXME: make a special annotation for disequalities
   assert ((coeff.signum() > 0) == reason.isUpper());
   Rational sign = Rational.valueOf(coeff.signum(), 1);
   LAAnnotation annot = mSubReasons.get(reason);
   if (annot == null) {
     annot = new LAAnnotation(reason);
     mSubReasons.put(reason, annot);
     mAnnotationStack.addLast(annot);
     if (reason.getOldReason() instanceof LiteralReason)
       reason.getOldReason().explain(this, reason.getVar().getEpsilon(), sign);
     else addAnnotation(reason.getOldReason(), sign);
     addLiteral(reason.getLiteral().negate(), sign);
     mAnnotationStack.removeLast();
   }
   mAnnotationStack.getLast().addFarkas(annot, coeff);
 }