|
|
@ -957,18 +957,13 @@ final public class ParamModelChecker extends PrismComponent |
|
|
*/ |
|
|
*/ |
|
|
protected RegionValues checkExpressionReward(ParamModel model, ExpressionReward expr, BitSet needStates) throws PrismException |
|
|
protected RegionValues checkExpressionReward(ParamModel model, ExpressionReward expr, BitSet needStates) throws PrismException |
|
|
{ |
|
|
{ |
|
|
Object rs; // Reward struct index |
|
|
|
|
|
RewardStruct rewStruct = null; // Reward struct object |
|
|
|
|
|
Expression rb; // Reward bound (expression) |
|
|
Expression rb; // Reward bound (expression) |
|
|
BigRational r = null; // Reward bound (actual value) |
|
|
BigRational r = null; // Reward bound (actual value) |
|
|
//String relOp; // Relational operator |
|
|
|
|
|
ModelType modelType = model.getModelType(); |
|
|
|
|
|
RegionValues rews = null; |
|
|
RegionValues rews = null; |
|
|
int i; |
|
|
|
|
|
boolean min = false; |
|
|
boolean min = false; |
|
|
|
|
|
|
|
|
// Get info from reward operator |
|
|
// Get info from reward operator |
|
|
rs = expr.getRewardStructIndex(); |
|
|
|
|
|
|
|
|
RewardStruct rewStruct = expr.getRewardStructByIndexObject(modulesFile, constantValues); |
|
|
RelOp relOp = expr.getRelOp(); |
|
|
RelOp relOp = expr.getRelOp(); |
|
|
rb = expr.getReward(); |
|
|
rb = expr.getReward(); |
|
|
if (rb != null) { |
|
|
if (rb != null) { |
|
|
@ -979,24 +974,6 @@ final public class ParamModelChecker extends PrismComponent |
|
|
} |
|
|
} |
|
|
min = relOp.isLowerBound() || relOp.isMin(); |
|
|
min = relOp.isLowerBound() || relOp.isMin(); |
|
|
|
|
|
|
|
|
// Get reward info |
|
|
|
|
|
if (modulesFile == null) |
|
|
|
|
|
throw new PrismException("No model file to obtain reward structures"); |
|
|
|
|
|
if (modulesFile.getNumRewardStructs() == 0) |
|
|
|
|
|
throw new PrismException("Model has no rewards specified"); |
|
|
|
|
|
if (rs == null) { |
|
|
|
|
|
rewStruct = modulesFile.getRewardStruct(0); |
|
|
|
|
|
} else if (rs instanceof Expression) { |
|
|
|
|
|
i = ((Expression) rs).evaluateInt(constantValues); |
|
|
|
|
|
rs = new Integer(i); // for better error reporting below |
|
|
|
|
|
rewStruct = modulesFile.getRewardStruct(i - 1); |
|
|
|
|
|
} else if (rs instanceof String) { |
|
|
|
|
|
rewStruct = modulesFile.getRewardStructByName((String) rs); |
|
|
|
|
|
} |
|
|
|
|
|
if (rewStruct == null) |
|
|
|
|
|
throw new PrismException("Invalid reward structure index \"" + rs + "\""); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ParamRewardStruct rew = constructRewards(model, rewStruct, constantValues); |
|
|
ParamRewardStruct rew = constructRewards(model, rewStruct, constantValues); |
|
|
mainLog.println("Building reward structure..."); |
|
|
mainLog.println("Building reward structure..."); |
|
|
rews = checkRewardFormula(model, rew, expr.getExpression(), min, needStates); |
|
|
rews = checkRewardFormula(model, rew, expr.getExpression(), min, needStates); |
|
|
|