Browse Source

imported patch JDD-SplitByValue.patch

tud-infrastructure-2018-10-12
Joachim Klein 7 years ago
parent
commit
fbe3846ed4
  1. 38
      prism/src/jdd/JDD.java

38
prism/src/jdd/JDD.java

@ -977,6 +977,44 @@ public class JDD
return rv; return rv;
} }
/**
* Splits the given MTBDD by the different values that can be
* occur for those valuations that match {@code filter}.<br>
* Returns a TreeMap with the double values as the keys and
* a 0/1-MTBDD for the valuations in {@code dd} that satisfy {@code filter}
* and map to the given key as the value.
* <br>[ REFS: <i>result (value JDDNodes in the map)</i>, DEREFS: dd, filter ]
*/
public static TreeMap<Double, JDDNode> SplitByValue(JDDNode dd, JDDNode filter)
{
TreeMap<Double, JDDNode> result = new TreeMap<>();
// As long as the filter is non-empty...
while (!filter.equals(ZERO)) {
// set all values outside of the filter to +infty
dd = JDD.ITE(filter.copy(), dd, JDD.PLUS_INFINITY.copy());
// find the minimum value
double value = FindMin(dd);
// extract the 0/1-MTBDD with the valuations that lead to this value
JDDNode ddWithValue = Equals(dd.copy(), value);
if (value == Double.POSITIVE_INFINITY) {
// ensure that we only get those valuations that match filter
ddWithValue = JDD.And(ddWithValue, filter.copy());
}
// store in map
result.put(value, ddWithValue);
// update filter to remove all valuations that were put in the map
filter = JDD.And(filter, Not(ddWithValue.copy()));
}
// cleanup
JDD.Deref(dd);
JDD.Deref(filter);
return result;
}
/** /**
* returns dd restricted to first non-zero path (cube) * returns dd restricted to first non-zero path (cube)
* <br>[ REFS: <i>result</i>, DEREFS: dd ] * <br>[ REFS: <i>result</i>, DEREFS: dd ]

Loading…
Cancel
Save