diff --git a/prism/src/explicit/ProbModelChecker.java b/prism/src/explicit/ProbModelChecker.java index 5d355981..01a8ea2d 100644 --- a/prism/src/explicit/ProbModelChecker.java +++ b/prism/src/explicit/ProbModelChecker.java @@ -683,6 +683,10 @@ public class ProbModelChecker extends NonProbModelChecker */ protected StateValues checkProbNext(Model model, ExpressionTemporal expr, MinMax minMax, BitSet statesOfInterest) throws PrismException { + if (expr.getBounds().hasRewardBounds()) { + throw new PrismException("Reachability reward operator with reward bounds is not supported."); + } + // Model check the operand for all states BitSet target = checkExpression(model, expr.getOperand2(), null).getBitSet(); diff --git a/prism/src/prism/NondetModelChecker.java b/prism/src/prism/NondetModelChecker.java index 806a1410..61148f25 100644 --- a/prism/src/prism/NondetModelChecker.java +++ b/prism/src/prism/NondetModelChecker.java @@ -942,8 +942,17 @@ public class NondetModelChecker extends NonProbModelChecker StateValues probs = null; expr = Expression.convertSimplePathFormulaToCanonicalForm(expr); + ExpressionTemporal exprTemp = Expression.getTemporalOperatorForSimplePathFormula(expr); + if (exprTemp.getBounds().hasRewardBounds()) { + throw new PrismException("Reward bounds are currently not supported with the symbolic engine"); + } + + if (exprTemp.getBounds().countTimeBoundsDiscrete() > 1) { + throw new PrismException("Multiple time / step bounds are currently not supported with the symbolic engine"); + } - // Negation + + // Negation if (expr instanceof ExpressionUnaryOp && ((ExpressionUnaryOp)expr).getOperator() == ExpressionUnaryOp.NOT) { // mark as negated, switch from min to max and vice versa @@ -953,7 +962,7 @@ public class NondetModelChecker extends NonProbModelChecker } if (expr instanceof ExpressionTemporal) { - ExpressionTemporal exprTemp = (ExpressionTemporal) expr; + exprTemp = (ExpressionTemporal) expr; // Next if (exprTemp.getOperator() == ExpressionTemporal.P_X) { probs = checkProbNext(exprTemp, min, statesOfInterest); @@ -1360,6 +1369,10 @@ public class NondetModelChecker extends NonProbModelChecker // currently, ignore statesOfInterest JDD.Deref(statesOfInterest); + if (expr.getBounds().hasRewardBounds()) { + throw new PrismException("Cumulative reward operator does not support reward bounds"); + } + // check that there is an upper time bound if (!expr.hasBounds() || !expr.getBounds().getStepBoundForDiscreteTime().hasUpperBound()) { throw new PrismException("Cumulative reward operator without time bound (C) is only allowed for multi-objective queries"); @@ -1412,6 +1425,10 @@ public class NondetModelChecker extends NonProbModelChecker // currently, ignore statesOfInterest JDD.Deref(statesOfInterest); + if (expr.getBounds().hasRewardBounds()) { + throw new PrismException("Instantaneous reward operator does not support reward bounds"); + } + // get info from bounded until time = expr.getBounds().getStepBoundForDiscreteTime().getUpperBound().evaluateInt(constantValues); if (time < 0) { diff --git a/prism/src/prism/ProbModelChecker.java b/prism/src/prism/ProbModelChecker.java index dfd4b07c..19380c52 100644 --- a/prism/src/prism/ProbModelChecker.java +++ b/prism/src/prism/ProbModelChecker.java @@ -502,8 +502,16 @@ public class ProbModelChecker extends NonProbModelChecker StateValues probs = null; expr = Expression.convertSimplePathFormulaToCanonicalForm(expr); - - // Negation + ExpressionTemporal exprTemp = Expression.getTemporalOperatorForSimplePathFormula(expr); + if (exprTemp.getBounds().hasRewardBounds()) { + throw new PrismException("Reward bounds are currently not supported with the symbolic engine"); + } + + if (exprTemp.getBounds().countTimeBoundsDiscrete() > 1) { + throw new PrismException("Multiple time / step bounds are currently not supported with the symbolic engine"); + } + + // Negation if (expr instanceof ExpressionUnaryOp && ((ExpressionUnaryOp)expr).getOperator() == ExpressionUnaryOp.NOT) { negated = true; @@ -511,7 +519,7 @@ public class ProbModelChecker extends NonProbModelChecker } if (expr instanceof ExpressionTemporal) { - ExpressionTemporal exprTemp = (ExpressionTemporal) expr; + exprTemp = (ExpressionTemporal) expr; // Next if (exprTemp.getOperator() == ExpressionTemporal.P_X) { probs = checkProbNext(exprTemp, statesOfInterest); @@ -828,6 +836,10 @@ public class ProbModelChecker extends NonProbModelChecker { int time; // time StateValues rewards = null; + + if (expr.getBounds().hasRewardBounds()) { + throw new PrismException("Cumulative reward operator does not support reward bounds"); + } // currently, ignore statesOfInterest JDD.Deref(statesOfInterest); @@ -887,6 +899,10 @@ public class ProbModelChecker extends NonProbModelChecker // currently, we ignore statesOfInterest JDD.Deref(statesOfInterest); + if (expr.getBounds().hasRewardBounds()) { + throw new PrismException("Instantaneous reward operator does not support reward bounds"); + } + // get info from inst reward time = expr.getBounds().getStepBoundForDiscreteTime().getUpperBound().evaluateInt(constantValues); if (time < 0) { @@ -970,6 +986,12 @@ public class ProbModelChecker extends NonProbModelChecker ProbModelChecker mcProduct; long l; + + if (Expression.containsTemporalRewardBounds(expr)) { + JDD.Deref(statesOfInterest); + throw new PrismException("Can not handle reward bounds via deterministic automata."); + } + if (Expression.containsTemporalTimeBounds(expr)) { if (model.getModelType().continuousTime()) { JDD.Deref(statesOfInterest); diff --git a/prism/src/simulator/sampler/SamplerRewardCumulDisc.java b/prism/src/simulator/sampler/SamplerRewardCumulDisc.java index c3f4af8c..cd578a0e 100644 --- a/prism/src/simulator/sampler/SamplerRewardCumulDisc.java +++ b/prism/src/simulator/sampler/SamplerRewardCumulDisc.java @@ -48,6 +48,10 @@ public class SamplerRewardCumulDisc extends SamplerDouble if (expr.getOperator() != ExpressionTemporal.R_C) throw new PrismException("Error creating Sampler"); + if (expr.getBounds().hasRewardBounds()) { + throw new PrismException("Cumulative reward operator does not support reward bounds"); + } + timeBound = expr.getBounds().getStepBoundForDiscreteTime().getUpperBound().evaluateInt(); this.rewardStructIndex = rewardStructIndex; // Initialise sampler info diff --git a/prism/src/simulator/sampler/SamplerRewardInstDisc.java b/prism/src/simulator/sampler/SamplerRewardInstDisc.java index 820a2d94..ef3b6c50 100644 --- a/prism/src/simulator/sampler/SamplerRewardInstDisc.java +++ b/prism/src/simulator/sampler/SamplerRewardInstDisc.java @@ -47,6 +47,11 @@ public class SamplerRewardInstDisc extends SamplerDouble // Then extract other required info if (expr.getOperator() != ExpressionTemporal.R_I) throw new PrismException("Error creating Sampler"); + + if (expr.getBounds().hasRewardBounds()) { + throw new PrismException("Instantaneous reward operator does not support reward bounds"); + } + time = expr.getBounds().getStepBoundForDiscreteTime().getUpperBound().evaluateInt(); this.rewardStructIndex = rewardStructIndex; // Initialise sampler info