private static void printOct(DBM dbm, LinearTerm[] substitution, IntegerInf maxK) { StringBuffer sb = new StringBuffer(); if (maxK != null) { sb.append("k>=0, "); if (maxK.isFinite()) sb.append("k<=" + maxK.toInt() + ", "); } Matrix m = dbm.mat(); int size = m.size(); for (int i = 0; i < size; ++i) { for (int j = 2 * (i / 2); j < size; ++j) { if (i == j) continue; Field f = m.get(i, j); if (!f.isFinite()) continue; sb.append( "" + substitution[i].times(1).toSB(true) + substitution[j].times(-1).toSB(false) + "<=" + f.toString() + ", "); } } if (DeltaClosure.DEBUG_LEVEL >= DeltaClosure.DEBUG_LOW) System.out.println(sb); }
public static DeltaDisjunct mat2modRels( DBM dbm, MyEnum keep, LinearTerm[] substitution, boolean isOctagon, IntegerInf maxK) { Matrix m = dbm.mat(); LinearRel lcs = new LinearRel(); int size = m.size(); boolean onlyZeroK = true; // coefficients of K always 0 for (int i = 0; i < size; ++i) { for (int j = 0; j < size; ++j) { if (i == j) continue; Field f = m.get(i, j); if (!f.isFinite()) continue; // skip $0-$0'<=0 and $0'-$0<=0 if (!isOctagon && ((i == size / 2 && j == 0) || (j == size / 2 && i == 0))) continue; LinearConstr lc = new LinearConstr(); lc.addLinTerm(substitution[i].times(1)); lc.addLinTerm(substitution[j].times(-1)); boolean zeroK = f.fillLinTerms(lc, DeltaClosure.v_k); onlyZeroK &= zeroK; lcs.add(lc); } } if (!onlyZeroK) { if (m.fs() instanceof FieldStatic.ParametricFS) lcs.addConstraint(DeltaClosure.lc_k); if (maxK.isFinite()) { lcs.add(DeltaClosure.maxKconstr(maxK.toInt())); } } if (DeltaClosure.DEBUG_LEVEL >= DeltaClosure.DEBUG_LOW) System.out.println(lcs.toSBClever(Variable.ePRINT_prime)); if (onlyZeroK) { Relation r = Relation.toMinType(lcs); Relation[] l; if (!r.contradictory()) l = new Relation[] {r}; else l = new Relation[0]; return new DeltaDisjunct(l, lcs, onlyZeroK); } else { Relation[] tmp = null; tmp = lcs.existElim1(DeltaClosure.v_k); // else keep null return new DeltaDisjunct(tmp, lcs, onlyZeroK); } }