|
|
|
@ -582,11 +582,13 @@ public class STPG extends ModelSimple |
|
|
|
int i, j, k; |
|
|
|
String filename = null; |
|
|
|
FileWriter out; |
|
|
|
TreeMap<Integer, Double> sorted; |
|
|
|
try { |
|
|
|
// Output transitions to .tra file |
|
|
|
filename = baseFilename + ".tra"; |
|
|
|
out = new FileWriter(filename); |
|
|
|
out.write(numStates + " " + numDistrSets + " " + numDistrs + " " + numTransitions + "\n"); |
|
|
|
sorted = new TreeMap<Integer, Double>(); |
|
|
|
for (i = 0; i < numStates; i++) { |
|
|
|
j = -1; |
|
|
|
for (DistributionSet distrs : trans.get(i)) { |
|
|
|
@ -594,10 +596,17 @@ public class STPG extends ModelSimple |
|
|
|
k = -1; |
|
|
|
for (Distribution distr : distrs) { |
|
|
|
k++; |
|
|
|
// Extract transitions and sort by destination state index (to match PRISM-exported files) |
|
|
|
for (Map.Entry<Integer, Double> e : distr) { |
|
|
|
sorted.put(e.getKey(), e.getValue()); |
|
|
|
} |
|
|
|
// Print out (sorted) transitions |
|
|
|
for (Map.Entry<Integer, Double> e : distr) { |
|
|
|
// Note use of PrismUtils.formatDouble to match PRISM-exported files |
|
|
|
out.write(i + " " + j + " " + k + " " + e.getKey() + " " |
|
|
|
+ PrismUtils.formatDouble(e.getValue()) + "\n"); |
|
|
|
} |
|
|
|
sorted.clear(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|