|
|
|
@ -195,14 +195,65 @@ public class DTMCEmbeddedSimple extends DTMCExplicit |
|
|
|
|
|
|
|
public int getNumTransitions(int s) |
|
|
|
{ |
|
|
|
// TODO |
|
|
|
throw new RuntimeException("Not implemented yet"); |
|
|
|
if (exitRates[s] == 0) { |
|
|
|
return 1; |
|
|
|
} else { |
|
|
|
return ctmc.getNumTransitions(s); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public Iterator<Entry<Integer,Double>> getTransitionsIterator(int s) |
|
|
|
{ |
|
|
|
// TODO |
|
|
|
throw new RuntimeException("Not implemented yet"); |
|
|
|
if (exitRates[s] == 0) { |
|
|
|
// return prob-1 self-loop |
|
|
|
Map<Integer,Double> m = new TreeMap<Integer,Double>(); |
|
|
|
m.put(s, 1.0); |
|
|
|
return m.entrySet().iterator(); |
|
|
|
} else { |
|
|
|
final Iterator<Entry<Integer,Double>> ctmcIterator = ctmc.getTransitionsIterator(s); |
|
|
|
|
|
|
|
// return iterator over entries, with probabilities divided by exitRates[s] |
|
|
|
final double er = exitRates[s]; |
|
|
|
return new Iterator<Entry<Integer,Double>>() { |
|
|
|
@Override |
|
|
|
public boolean hasNext() |
|
|
|
{ |
|
|
|
return ctmcIterator.hasNext(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Entry<Integer, Double> next() |
|
|
|
{ |
|
|
|
final Entry<Integer, Double> ctmcEntry = ctmcIterator.next(); |
|
|
|
|
|
|
|
return new Entry<Integer, Double>() { |
|
|
|
@Override |
|
|
|
public Integer getKey() |
|
|
|
{ |
|
|
|
return ctmcEntry.getKey(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Double getValue() |
|
|
|
{ |
|
|
|
return ctmcEntry.getValue() / er; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Double setValue(Double value) |
|
|
|
{ |
|
|
|
throw new UnsupportedOperationException(); |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void remove() |
|
|
|
{ |
|
|
|
throw new UnsupportedOperationException(); |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public void prob0step(BitSet subset, BitSet u, BitSet result) |
|
|
|
|