|
|
@ -43,6 +43,10 @@ public class SamplerRewardReach extends SamplerDouble |
|
|
*/ |
|
|
*/ |
|
|
public SamplerRewardReach(ExpressionTemporal expr, int rewardStructIndex) throws PrismException |
|
|
public SamplerRewardReach(ExpressionTemporal expr, int rewardStructIndex) throws PrismException |
|
|
{ |
|
|
{ |
|
|
|
|
|
// If the answer is already known we should do nothing |
|
|
|
|
|
if (valueKnown) |
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
// Make sure expression is of the correct type |
|
|
// Make sure expression is of the correct type |
|
|
// Then extract other required info |
|
|
// Then extract other required info |
|
|
if (expr.getOperator() != ExpressionTemporal.R_F) |
|
|
if (expr.getOperator() != ExpressionTemporal.R_F) |
|
|
@ -55,11 +59,17 @@ public class SamplerRewardReach extends SamplerDouble |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void update(Path path) throws PrismLangException |
|
|
|
|
|
|
|
|
public boolean update(Path path) throws PrismLangException |
|
|
{ |
|
|
{ |
|
|
|
|
|
// If the answer is already known we should do nothing |
|
|
|
|
|
if (valueKnown) |
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
if (target.evaluateBoolean(path.getCurrentState())) { |
|
|
if (target.evaluateBoolean(path.getCurrentState())) { |
|
|
valueKnown = true; |
|
|
valueKnown = true; |
|
|
value = path.getTotalCumulativeReward(rewardStructIndex); |
|
|
value = path.getTotalCumulativeReward(rewardStructIndex); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return valueKnown; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |