|
|
@ -894,7 +894,11 @@ public class ProbModelChecker extends NonProbModelChecker |
|
|
rewards = checkRewardInstantaneous(model, modelRewards, exprTemp, minMax); |
|
|
rewards = checkRewardInstantaneous(model, modelRewards, exprTemp, minMax); |
|
|
break; |
|
|
break; |
|
|
case ExpressionTemporal.R_C: |
|
|
case ExpressionTemporal.R_C: |
|
|
rewards = checkRewardCumulative(model, modelRewards, exprTemp, minMax); |
|
|
|
|
|
|
|
|
if (exprTemp.hasBounds()) { |
|
|
|
|
|
rewards = checkRewardCumulative(model, modelRewards, exprTemp, minMax); |
|
|
|
|
|
} else { |
|
|
|
|
|
rewards = checkRewardTotal(model, modelRewards, exprTemp, minMax); |
|
|
|
|
|
} |
|
|
break; |
|
|
break; |
|
|
default: |
|
|
default: |
|
|
throw new PrismNotSupportedException("Explicit engine does not yet handle the " + exprTemp.getOperatorSymbol() + " reward operator"); |
|
|
throw new PrismNotSupportedException("Explicit engine does not yet handle the " + exprTemp.getOperatorSymbol() + " reward operator"); |
|
|
@ -972,7 +976,7 @@ public class ProbModelChecker extends NonProbModelChecker |
|
|
|
|
|
|
|
|
// Check that there is an upper time bound |
|
|
// Check that there is an upper time bound |
|
|
if (expr.getUpperBound() == null) { |
|
|
if (expr.getUpperBound() == null) { |
|
|
throw new PrismNotSupportedException("Cumulative reward operator without time bound (C) is only allowed for multi-objective queries"); |
|
|
|
|
|
|
|
|
throw new PrismNotSupportedException("This is not a cumulative reward operator"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Get time bound |
|
|
// Get time bound |
|
|
@ -1013,6 +1017,33 @@ public class ProbModelChecker extends NonProbModelChecker |
|
|
return StateValues.createFromDoubleArray(res.soln, model); |
|
|
return StateValues.createFromDoubleArray(res.soln, model); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Compute expected rewards for a total reward operator. |
|
|
|
|
|
*/ |
|
|
|
|
|
protected StateValues checkRewardTotal(Model model, Rewards modelRewards, ExpressionTemporal expr, MinMax minMax) throws PrismException |
|
|
|
|
|
{ |
|
|
|
|
|
// Check that there is no upper time bound |
|
|
|
|
|
if (expr.getUpperBound() != null) { |
|
|
|
|
|
throw new PrismException("This is not a total reward operator"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Compute/return the rewards |
|
|
|
|
|
ModelCheckerResult res = null; |
|
|
|
|
|
switch (model.getModelType()) { |
|
|
|
|
|
case DTMC: |
|
|
|
|
|
res = ((DTMCModelChecker) this).computeTotalRewards((DTMC) model, (MCRewards) modelRewards); |
|
|
|
|
|
break; |
|
|
|
|
|
case CTMC: |
|
|
|
|
|
break; |
|
|
|
|
|
case MDP: |
|
|
|
|
|
break; |
|
|
|
|
|
default: |
|
|
|
|
|
throw new PrismNotSupportedException("Explicit engine does not yet handle the " + expr.getOperatorSymbol() + " reward operator for " + model.getModelType() |
|
|
|
|
|
+ "s"); |
|
|
|
|
|
} |
|
|
|
|
|
return StateValues.createFromDoubleArray(res.soln, model); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Model check an S operator expression and return the values for all states. |
|
|
* Model check an S operator expression and return the values for all states. |
|
|
*/ |
|
|
*/ |
|
|
|