|
|
@ -26,8 +26,6 @@ |
|
|
|
|
|
|
|
|
package prism; |
|
|
package prism; |
|
|
|
|
|
|
|
|
import java.util.Vector; |
|
|
|
|
|
|
|
|
|
|
|
import dv.DoubleVector; |
|
|
import dv.DoubleVector; |
|
|
import jdd.*; |
|
|
import jdd.*; |
|
|
import odd.*; |
|
|
import odd.*; |
|
|
@ -105,7 +103,8 @@ public class StateModelChecker implements ModelChecker |
|
|
* Additional constructor for creating stripped down StateModelChecker for |
|
|
* Additional constructor for creating stripped down StateModelChecker for |
|
|
* expression to MTBDD conversions. |
|
|
* expression to MTBDD conversions. |
|
|
*/ |
|
|
*/ |
|
|
public StateModelChecker(Prism prism, VarList varList, JDDVars allDDRowVars, JDDVars[] varDDRowVars, Values constantValues) throws PrismException |
|
|
|
|
|
|
|
|
public StateModelChecker(Prism prism, VarList varList, JDDVars allDDRowVars, JDDVars[] varDDRowVars, |
|
|
|
|
|
Values constantValues) throws PrismException |
|
|
{ |
|
|
{ |
|
|
// Initialise |
|
|
// Initialise |
|
|
this.prism = prism; |
|
|
this.prism = prism; |
|
|
@ -116,8 +115,17 @@ public class StateModelChecker implements ModelChecker |
|
|
this.constantValues = constantValues; |
|
|
this.constantValues = constantValues; |
|
|
// Create dummy model |
|
|
// Create dummy model |
|
|
reach = null; |
|
|
reach = null; |
|
|
model = new ProbModel(JDD.Constant(0), JDD.Constant(0), new JDDNode[] {}, null, null, allDDRowVars, null, |
|
|
|
|
|
null, 0, null, null, null, 0, varList, varDDRowVars, null, constantValues); |
|
|
|
|
|
|
|
|
allDDRowVars.refAll(); |
|
|
|
|
|
model = new ProbModel(JDD.Constant(0), JDD.Constant(0), new JDDNode[] {}, new JDDNode[] {}, null, allDDRowVars, |
|
|
|
|
|
new JDDVars(), null, 0, null, null, null, 0, varList, varDDRowVars, null, constantValues); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Clean up the dummy model created when using the abbreviated constructor |
|
|
|
|
|
*/ |
|
|
|
|
|
public void clearDummyModel() |
|
|
|
|
|
{ |
|
|
|
|
|
model.clear(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------------- |
|
|
// ----------------------------------------------------------------------------------- |
|
|
@ -773,8 +781,12 @@ public class StateModelChecker implements ModelChecker |
|
|
if (res1 instanceof StateProbsMTBDD) { |
|
|
if (res1 instanceof StateProbsMTBDD) { |
|
|
dd1 = ((StateProbsMTBDD) res1).getJDDNode(); |
|
|
dd1 = ((StateProbsMTBDD) res1).getJDDNode(); |
|
|
switch (op) { |
|
|
switch (op) { |
|
|
case ExpressionFunc.FLOOR: dd1 = JDD.MonadicApply(JDD.FLOOR, dd1); break; |
|
|
|
|
|
case ExpressionFunc.CEIL: dd1 = JDD.MonadicApply(JDD.CEIL, dd1); break; |
|
|
|
|
|
|
|
|
case ExpressionFunc.FLOOR: |
|
|
|
|
|
dd1 = JDD.MonadicApply(JDD.FLOOR, dd1); |
|
|
|
|
|
break; |
|
|
|
|
|
case ExpressionFunc.CEIL: |
|
|
|
|
|
dd1 = JDD.MonadicApply(JDD.CEIL, dd1); |
|
|
|
|
|
break; |
|
|
} |
|
|
} |
|
|
return new StateProbsMTBDD(dd1, model); |
|
|
return new StateProbsMTBDD(dd1, model); |
|
|
} |
|
|
} |
|
|
@ -784,10 +796,12 @@ public class StateModelChecker implements ModelChecker |
|
|
n = dv1.getSize(); |
|
|
n = dv1.getSize(); |
|
|
switch (op) { |
|
|
switch (op) { |
|
|
case ExpressionFunc.FLOOR: |
|
|
case ExpressionFunc.FLOOR: |
|
|
for (i = 0; i < n; i++) dv1.setElement(i, Math.floor(dv1.getElement(i))); |
|
|
|
|
|
|
|
|
for (i = 0; i < n; i++) |
|
|
|
|
|
dv1.setElement(i, Math.floor(dv1.getElement(i))); |
|
|
break; |
|
|
break; |
|
|
case ExpressionFunc.CEIL: |
|
|
case ExpressionFunc.CEIL: |
|
|
for (i = 0; i < n; i++) dv1.setElement(i, Math.ceil(dv1.getElement(i))); |
|
|
|
|
|
|
|
|
for (i = 0; i < n; i++) |
|
|
|
|
|
dv1.setElement(i, Math.ceil(dv1.getElement(i))); |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
return new StateProbsDV(dv1, model); |
|
|
return new StateProbsDV(dv1, model); |
|
|
@ -909,8 +923,12 @@ public class StateModelChecker implements ModelChecker |
|
|
dd1 = ((StateProbsMTBDD) res1).getJDDNode(); |
|
|
dd1 = ((StateProbsMTBDD) res1).getJDDNode(); |
|
|
dd2 = ((StateProbsMTBDD) res2).getJDDNode(); |
|
|
dd2 = ((StateProbsMTBDD) res2).getJDDNode(); |
|
|
switch (op) { |
|
|
switch (op) { |
|
|
case ExpressionFunc.MIN: dd1 = JDD.Apply(JDD.MIN, dd1, dd2); break; |
|
|
|
|
|
case ExpressionFunc.MAX: dd1 = JDD.Apply(JDD.MAX, dd1, dd2); break; |
|
|
|
|
|
|
|
|
case ExpressionFunc.MIN: |
|
|
|
|
|
dd1 = JDD.Apply(JDD.MIN, dd1, dd2); |
|
|
|
|
|
break; |
|
|
|
|
|
case ExpressionFunc.MAX: |
|
|
|
|
|
dd1 = JDD.Apply(JDD.MAX, dd1, dd2); |
|
|
|
|
|
break; |
|
|
} |
|
|
} |
|
|
res1 = new StateProbsMTBDD(dd1, model); |
|
|
res1 = new StateProbsMTBDD(dd1, model); |
|
|
} |
|
|
} |
|
|
|