|
|
|
@ -42,7 +42,7 @@ import prism.PrismUtils; |
|
|
|
public abstract class MDPExplicit extends ModelExplicit implements MDP |
|
|
|
{ |
|
|
|
// Accessors (for Model) |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public ModelType getModelType() |
|
|
|
{ |
|
|
|
@ -136,6 +136,43 @@ public abstract class MDPExplicit extends ModelExplicit implements MDP |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void exportToDotFileWithAdv(String filename, BitSet mark, int adv[]) throws PrismException |
|
|
|
{ |
|
|
|
int i, j, numChoices; |
|
|
|
String nij; |
|
|
|
Object action; |
|
|
|
String style; |
|
|
|
try { |
|
|
|
FileWriter out = new FileWriter(filename); |
|
|
|
out.write("digraph " + getModelType() + " {\nsize=\"8,5\"\nnode [shape=box];\n"); |
|
|
|
for (i = 0; i < numStates; i++) { |
|
|
|
if (mark != null && mark.get(i)) |
|
|
|
out.write(i + " [style=filled fillcolor=\"#cccccc\"]\n"); |
|
|
|
numChoices = getNumChoices(i); |
|
|
|
for (j = 0; j < numChoices; j++) { |
|
|
|
style = (adv[i] == j) ? ",color=\"#ff0000\",fontcolor=\"#ff0000\"" : ""; |
|
|
|
action = getAction(i, j); |
|
|
|
nij = "n" + i + "_" + j; |
|
|
|
out.write(i + " -> " + nij + " [ arrowhead=none,label=\"" + j); |
|
|
|
if (action != null) |
|
|
|
out.write(":" + action); |
|
|
|
out.write("\"" + style + " ];\n"); |
|
|
|
out.write(nij + " [ shape=point,height=0.1,label=\"\"" + style + " ];\n"); |
|
|
|
Iterator<Map.Entry<Integer, Double>> iter = getTransitionsIterator(i, j); |
|
|
|
while (iter.hasNext()) { |
|
|
|
Map.Entry<Integer, Double> e = iter.next(); |
|
|
|
out.write(nij + " -> " + e.getKey() + " [ label=\"" + e.getValue() + "\"" + style + " ];\n"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
out.write("}\n"); |
|
|
|
out.close(); |
|
|
|
} catch (IOException e) { |
|
|
|
throw new PrismException("Could not write " + getModelType() + " to file \"" + filename + "\"" + e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void exportToPrismLanguage(String filename) throws PrismException |
|
|
|
{ |
|
|
|
@ -258,7 +295,7 @@ public abstract class MDPExplicit extends ModelExplicit implements MDP |
|
|
|
result[s] = mvMultRewMinMaxSingle(s, vect, mdpRewards, min, adv); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public double mvMultRewGSMinMax(double vect[], MDPRewards mdpRewards, boolean min, BitSet subset, boolean complement, boolean absolute) |
|
|
|
{ |
|
|
|
|